This commit is contained in:
Mikhalkovich Stanislav 2019-03-27 21:56:13 +03:00
parent a7a5d631b7
commit 26f6937c31
5 changed files with 131 additions and 4629 deletions

View file

@ -1948,12 +1948,19 @@ namespace PascalABCCompiler
ErrorsList.Add(new ResourceFileNotFound(cd.directive));
continue;
}
string fileName = Path.Combine(cd.location.doc.file_name, cd.directive);
if (File.Exists(fileName))
ResourceFiles.Add(fileName);
else
try
{
string fileName = Path.Combine(cd.location.doc.file_name, cd.directive);
if (File.Exists(fileName))
ResourceFiles.Add(fileName);
else
ErrorsList.Add(new ResourceFileNotFound(cd.directive, cd.location));
}
catch (Exception e)
{
ErrorsList.Add(new ResourceFileNotFound(cd.directive, cd.location));
}
}
else
ResourceFiles.Add(cd.directive);

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,9 @@
//
// This CSharp output file generated by Gardens Point LEX
// Version: 1.1.3.301
// Machine: IVAN-PC
// DateTime: 09.05.2017 19:33:10
// UserName: Ivan
// Machine: DESKTOP-G8V08V4
// DateTime: 27.03.2019 21:35:17
// UserName: ?????????
// GPLEX input file <Preprocessor3.lex>
// GPLEX frame file <embedded resource>
//
@ -17,6 +17,7 @@
// Version 1.1.3 of 18-April-2010
//
//
#define BACKUP
#define PERSIST
using System;
@ -121,12 +122,15 @@ namespace GPPGPreprocessor3
enum Result {accept, noMatch, contextFound};
const int maxAccept = 4;
const int initial = 5;
const int maxAccept = 13;
const int initial = 14;
const int eofNum = 0;
const int goStart = -1;
const int INITIAL = 0;
const int INSIDEDIRECTIVE = 1;
const int COMMENT = 2;
const int COMMENT1 = 3;
const int COMMENTONELINE = 4;
#region user code
#endregion user code
@ -160,44 +164,59 @@ namespace GPPGPreprocessor3
}
};
static int[] startState = new int[] {5, 7, 0};
static int[] startState = new int[] {14, 18, 19, 20, 21, 0};
#region CompressedCharacterMap
//
// There are 5 equivalence classes
// There are 12 equivalence classes
// There are 2 character sequence regions
// There are 1 tables, 126 entries
// There are 1 runs, 0 singletons
// Decision tree depth is 1
//
static sbyte[] mapC0 = new sbyte[126] {
/* '\0' */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0,
/* '\x10' */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* '\x20' */ 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0,
/* '0' */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* '@' */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 'P' */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* '`' */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 'p' */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 4, 3 };
/* '\0' */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 4, 2, 4, 4,
/* '\x10' */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
/* '\x20' */ 4, 4, 4, 4, 6, 4, 4, 1, 9, 11, 10, 4, 4, 4, 8, 3,
/* '0' */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
/* '@' */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
/* 'P' */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
/* '`' */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
/* 'p' */ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 8, 7 };
static sbyte MapC(int code)
{ // '\0' <= code <= '\U0010FFFF'
if (code < 126) // '\0' <= code <= '}'
return mapC0[code - 0];
else // '~' <= code <= '\U0010FFFF'
return (sbyte)0;
return (sbyte)4;
}
#endregion
static Table[] NxS = new Table[8] {
static Table[] NxS = new Table[22] {
/* NxS[ 0] */ new Table(0, 0, 0, null),
/* NxS[ 1] */ new Table(4, 1, -1, new sbyte[] {1}),
/* NxS[ 2] */ new Table(0, 0, -1, null),
/* NxS[ 3] */ new Table(3, 1, 3, new sbyte[] {-1}),
/* NxS[ 1] */ new Table(8, 5, -1, new sbyte[] {1, -1, -1, -1, 1}),
/* NxS[ 2] */ new Table(6, 1, -1, new sbyte[] {4}),
/* NxS[ 3] */ new Table(0, 0, -1, null),
/* NxS[ 4] */ new Table(0, 0, -1, null),
/* NxS[ 5] */ new Table(4, 3, -1, new sbyte[] {1, -1, 6}),
/* NxS[ 6] */ new Table(2, 1, -1, new sbyte[] {2}),
/* NxS[ 7] */ new Table(3, 1, 3, new sbyte[] {4}),
/* NxS[ 5] */ new Table(0, 3, 5, new sbyte[] {-1, 5, -1}),
/* NxS[ 6] */ new Table(1, 1, -1, new sbyte[] {15}),
/* NxS[ 7] */ new Table(7, 1, 7, new sbyte[] {-1}),
/* NxS[ 8] */ new Table(0, 0, -1, null),
/* NxS[ 9] */ new Table(0, 0, -1, null),
/* NxS[ 10] */ new Table(0, 0, -1, null),
/* NxS[ 11] */ new Table(0, 0, -1, null),
/* NxS[ 12] */ new Table(11, 1, -1, new sbyte[] {13}),
/* NxS[ 13] */ new Table(0, 0, -1, null),
/* NxS[ 14] */ new Table(8, 10, -1, new sbyte[] {1, 17, -1, -1, 1, 15,
-1, 16, -1, 2}),
/* NxS[ 15] */ new Table(0, 2, 15, new sbyte[] {-1, 6}),
/* NxS[ 16] */ new Table(3, 1, -1, new sbyte[] {5}),
/* NxS[ 17] */ new Table(10, 1, -1, new sbyte[] {3}),
/* NxS[ 18] */ new Table(7, 1, 7, new sbyte[] {8}),
/* NxS[ 19] */ new Table(7, 1, 9, new sbyte[] {10}),
/* NxS[ 20] */ new Table(10, 1, 11, new sbyte[] {12}),
/* NxS[ 21] */ new Table(0, 0, -1, null),
};
int NextState() {
@ -207,7 +226,7 @@ int NextState() {
unchecked {
int rslt;
int idx = MapC(code) - NxS[state].min;
if (idx < 0) idx += 5;
if (idx < 0) idx += 12;
if ((uint)idx >= (uint)NxS[state].rng) rslt = NxS[state].dflt;
else rslt = NxS[state].nxt[idx];
return rslt;
@ -631,14 +650,45 @@ int NextState() {
return (int)Tokens.NODIRECTIVE;
break;
case 2:
BEGIN(INSIDEDIRECTIVE);
BEGIN(COMMENT);
break;
case 3:
BEGIN(COMMENT1);
break;
case 4:
BEGIN(INSIDEDIRECTIVE);
break;
case 5:
{
}
break;
case 6:
{
}
break;
case 7:
yylval = new Directive(yytext, new LexLocation(tokLin, tokCol, tokELin, tokECol));
var t1 = yylloc;
return (int)Tokens.DIRECTIVE;
break;
case 4:
case 8:
BEGIN(INITIAL);
break;
case 9:
{
}
break;
case 10:
BEGIN(INITIAL);
break;
case 11:
case 12:
{
}
break;
case 13:
BEGIN(INITIAL);
break;
default:

View file

@ -7,13 +7,30 @@
%using PascalABCCompiler.SyntaxTree;
%using QUT.Gppg;
DotChr [^\r\n]
OneLineCmnt \/\/{DotChr}*
STRINGNUM \'([^\'\n]|\'\')*\'
DIRECTIVE [^\}]+
NODIRECTIVE [.|\n]+
%x INSIDEDIRECTIVE
%x COMMENT
%x COMMENT1
%x COMMENTONELINE
%%
{STRINGNUM} {
}
{OneLineCmnt} {
}
"{$" {
BEGIN(INSIDEDIRECTIVE);
}
@ -35,6 +52,29 @@ NODIRECTIVE [.|\n]+
return (int)Tokens.NODIRECTIVE;
}
"{" {
BEGIN(COMMENT);
}
<COMMENT> "}" {
BEGIN(INITIAL);
}
<COMMENT>.|\n {
}
"(*" {
BEGIN(COMMENT1);
}
<COMMENT1> "*)" {
BEGIN(INITIAL);
}
<COMMENT1>.|\n {
}
%{
yylloc = new LexLocation(tokLin, tokCol, tokELin, tokECol);
%}

View file

@ -3,9 +3,9 @@
// (see accompanying GPPGcopyright.rtf)
// GPPG version 1.3.6
// Machine: IVAN-PC
// DateTime: 09.05.2017 19:33:14
// UserName: Ivan
// Machine: DESKTOP-G8V08V4
// DateTime: 27.03.2019 21:35:18
// UserName: ?????????
// Input file <Preprocessor3Yacc.y>
// options: no-lines gplex