diff --git a/CodeCompletion/CodeFormatter.cs b/CodeCompletion/CodeFormatter.cs index 7b63594f0..b7e2e4af5 100644 --- a/CodeCompletion/CodeFormatter.cs +++ b/CodeCompletion/CodeFormatter.cs @@ -927,6 +927,9 @@ namespace CodeFormatters public override void visit(string_const _string_const) { + int pos = GetPosition(_string_const.source_context.begin_position.line_num, _string_const.source_context.begin_position.column_num); + if (Text[pos] == '$') + sb.Append('$'); sb.Append("'"); sb.Append(_string_const.Value.Replace("'","''")); sb.Append("'"); diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs b/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs index 142fecb41..54f8c6a63 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs @@ -2,7 +2,7 @@ // This CSharp output file generated by Gardens Point LEX // Version: 1.1.3.301 // Machine: IVAN-PC -// DateTime: 18.03.2018 11:46:44 +// DateTime: 20.03.2018 20:53:51 // UserName: Ivan // GPLEX input file // GPLEX frame file @@ -124,8 +124,8 @@ namespace GPPGParserScanner enum Result {accept, noMatch, contextFound}; - const int maxAccept = 65; - const int initial = 66; + const int maxAccept = 66; + const int initial = 67; const int eofNum = 0; const int goStart = -1; const int INITIAL = 0; @@ -177,7 +177,7 @@ public PT parsertools; } }; - static int[] startState = new int[] {66, 100, 101, 102, 102, 103, + static int[] startState = new int[] {67, 102, 103, 104, 104, 105, 0}; #region TwoLevelCharacterMap @@ -1177,14 +1177,14 @@ public PT parsertools; return MapC(code); } - static Table[] NxS = new Table[105] { + static Table[] NxS = new Table[107] { /* NxS[ 0] */ new Table(0, 0, 0, null), -/* NxS[ 1] */ new Table(1, 19, -1, new sbyte[] {54, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 55}), +/* NxS[ 1] */ new Table(1, 19, -1, new sbyte[] {55, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 56}), /* NxS[ 2] */ new Table(0, 0, -1, null), -/* NxS[ 3] */ new Table(4, 1, -1, new sbyte[] {99}), -/* NxS[ 4] */ new Table(26, 19, -1, new sbyte[] {52, 52, 52, -1, -1, -1, - -1, -1, -1, -1, -1, 52, -1, -1, -1, -1, 52, 52, 52}), +/* NxS[ 3] */ new Table(4, 1, -1, new sbyte[] {101}), +/* NxS[ 4] */ new Table(26, 20, -1, new sbyte[] {52, 52, 52, -1, -1, -1, + -1, -1, -1, -1, -1, 52, -1, -1, -1, -1, 52, 52, 52, 100}), /* NxS[ 5] */ new Table(8, 1, -1, new sbyte[] {51}), /* NxS[ 6] */ new Table(8, 12, -1, new sbyte[] {49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 50}), @@ -1203,27 +1203,27 @@ public PT parsertools; /* NxS[ 18] */ new Table(19, 1, -1, new sbyte[] {43}), /* NxS[ 19] */ new Table(19, 4, -1, new sbyte[] {41, -1, -1, 42}), /* NxS[ 20] */ new Table(19, 1, -1, new sbyte[] {40}), -/* NxS[ 21] */ new Table(19, 5, -1, new sbyte[] {35, -1, -1, 36, 72}), +/* NxS[ 21] */ new Table(19, 5, -1, new sbyte[] {35, -1, -1, 36, 73}), /* NxS[ 22] */ new Table(0, 0, -1, null), -/* NxS[ 23] */ new Table(26, 1, -1, new sbyte[] {71}), -/* NxS[ 24] */ new Table(13, 32, -1, new sbyte[] {68, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 24, 24, 69, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 24, -1, 69}), +/* NxS[ 23] */ new Table(26, 1, -1, new sbyte[] {72}), +/* NxS[ 24] */ new Table(13, 32, -1, new sbyte[] {69, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 24, 24, 70, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 24, -1, 70}), /* NxS[ 25] */ new Table(26, 19, -1, new sbyte[] {25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, -1, 25, 25, 25, 25}), /* NxS[ 26] */ new Table(0, 0, -1, null), -/* NxS[ 27] */ new Table(45, 4, 67, new sbyte[] {31, 67, 67, -1}), +/* NxS[ 27] */ new Table(45, 4, 68, new sbyte[] {31, 68, 68, -1}), /* NxS[ 28] */ new Table(26, 19, -1, new sbyte[] {29, 29, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, -1, 30, 29, 30, 30}), /* NxS[ 29] */ new Table(26, 17, -1, new sbyte[] {29, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 29}), /* NxS[ 30] */ new Table(26, 19, -1, new sbyte[] {30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, -1, 30, 30, 30, 30}), -/* NxS[ 31] */ new Table(45, 1, -1, new sbyte[] {67}), +/* NxS[ 31] */ new Table(45, 1, -1, new sbyte[] {68}), /* NxS[ 32] */ new Table(26, 17, -1, new sbyte[] {32, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 32}), -/* NxS[ 33] */ new Table(26, 19, -1, new sbyte[] {33, 33, 69, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, 69}), +/* NxS[ 33] */ new Table(26, 19, -1, new sbyte[] {33, 33, 70, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, 70}), /* NxS[ 34] */ new Table(0, 0, -1, null), /* NxS[ 35] */ new Table(0, 0, -1, null), /* NxS[ 36] */ new Table(0, 0, -1, null), @@ -1244,68 +1244,70 @@ public PT parsertools; /* NxS[ 51] */ new Table(0, 0, -1, null), /* NxS[ 52] */ new Table(26, 19, -1, new sbyte[] {52, 52, 52, -1, -1, -1, -1, -1, -1, -1, -1, 52, -1, -1, -1, -1, 52, 52, 52}), -/* NxS[ 53] */ new Table(0, 0, -1, null), -/* NxS[ 54] */ new Table(0, 7, 54, new sbyte[] {-1, 54, 54, 54, 54, 54, +/* NxS[ 53] */ new Table(45, 1, -1, new sbyte[] {100}), +/* NxS[ 54] */ new Table(0, 0, -1, null), +/* NxS[ 55] */ new Table(0, 7, 55, new sbyte[] {-1, 55, 55, 55, 55, 55, -1}), -/* NxS[ 55] */ new Table(0, 0, -1, null), /* NxS[ 56] */ new Table(0, 0, -1, null), /* NxS[ 57] */ new Table(0, 0, -1, null), /* NxS[ 58] */ new Table(0, 0, -1, null), -/* NxS[ 59] */ new Table(9, 1, -1, new sbyte[] {60}), -/* NxS[ 60] */ new Table(0, 0, -1, null), +/* NxS[ 59] */ new Table(0, 0, -1, null), +/* NxS[ 60] */ new Table(9, 1, -1, new sbyte[] {61}), /* NxS[ 61] */ new Table(0, 0, -1, null), -/* NxS[ 62] */ new Table(1, 1, -1, new sbyte[] {65}), -/* NxS[ 63] */ new Table(4, 1, -1, new sbyte[] {104}), -/* NxS[ 64] */ new Table(0, 0, -1, null), -/* NxS[ 65] */ new Table(0, 7, 65, new sbyte[] {-1, 65, 65, 65, 65, 65, +/* NxS[ 62] */ new Table(0, 0, -1, null), +/* NxS[ 63] */ new Table(1, 1, -1, new sbyte[] {66}), +/* NxS[ 64] */ new Table(4, 1, -1, new sbyte[] {106}), +/* NxS[ 65] */ new Table(0, 0, -1, null), +/* NxS[ 66] */ new Table(0, 7, 66, new sbyte[] {-1, 66, 66, 66, 66, 66, -1}), -/* NxS[ 66] */ new Table(40, 36, 25, new sbyte[] {26, 25, 24, 25, 25, 27, +/* NxS[ 67] */ new Table(40, 36, 25, new sbyte[] {26, 25, 24, 25, 25, 27, 28, 2, -1, 1, 2, 3, 4, -1, -1, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 24}), -/* NxS[ 67] */ new Table(45, 4, 67, new sbyte[] {31, 67, 67, -1}), -/* NxS[ 68] */ new Table(26, 17, -1, new sbyte[] {33, 33, -1, -1, -1, -1, +/* NxS[ 68] */ new Table(45, 4, 68, new sbyte[] {31, 68, 68, -1}), +/* NxS[ 69] */ new Table(26, 17, -1, new sbyte[] {33, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33}), -/* NxS[ 69] */ new Table(20, 23, -1, new sbyte[] {70, 70, -1, -1, -1, -1, +/* NxS[ 70] */ new Table(20, 23, -1, new sbyte[] {71, 71, -1, -1, -1, -1, 32, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 32}), -/* NxS[ 70] */ new Table(26, 17, -1, new sbyte[] {32, 32, -1, -1, -1, -1, +/* NxS[ 71] */ new Table(26, 17, -1, new sbyte[] {32, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 32}), -/* NxS[ 71] */ new Table(27, 1, -1, new sbyte[] {34}), -/* NxS[ 72] */ new Table(28, 9, -1, new sbyte[] {73, -1, -1, -1, 74, -1, - -1, -1, 75}), -/* NxS[ 73] */ new Table(29, 1, -1, new sbyte[] {89}), -/* NxS[ 74] */ new Table(36, 1, -1, new sbyte[] {80}), -/* NxS[ 75] */ new Table(39, 1, -1, new sbyte[] {76}), -/* NxS[ 76] */ new Table(30, 1, -1, new sbyte[] {77}), -/* NxS[ 77] */ new Table(28, 1, -1, new sbyte[] {78}), -/* NxS[ 78] */ new Table(22, 1, -1, new sbyte[] {79}), -/* NxS[ 79] */ new Table(22, 1, -1, new sbyte[] {37}), -/* NxS[ 80] */ new Table(37, 1, -1, new sbyte[] {81}), -/* NxS[ 81] */ new Table(36, 1, -1, new sbyte[] {82}), -/* NxS[ 82] */ new Table(28, 1, -1, new sbyte[] {83}), -/* NxS[ 83] */ new Table(38, 1, -1, new sbyte[] {84}), -/* NxS[ 84] */ new Table(28, 1, -1, new sbyte[] {85}), -/* NxS[ 85] */ new Table(35, 1, -1, new sbyte[] {86}), -/* NxS[ 86] */ new Table(36, 1, -1, new sbyte[] {87}), -/* NxS[ 87] */ new Table(22, 1, -1, new sbyte[] {88}), -/* NxS[ 88] */ new Table(22, 1, -1, new sbyte[] {38}), -/* NxS[ 89] */ new Table(30, 1, -1, new sbyte[] {90}), -/* NxS[ 90] */ new Table(31, 1, -1, new sbyte[] {91}), -/* NxS[ 91] */ new Table(28, 1, -1, new sbyte[] {92}), -/* NxS[ 92] */ new Table(32, 1, -1, new sbyte[] {93}), +/* NxS[ 72] */ new Table(27, 1, -1, new sbyte[] {34}), +/* NxS[ 73] */ new Table(28, 9, -1, new sbyte[] {74, -1, -1, -1, 75, -1, + -1, -1, 76}), +/* NxS[ 74] */ new Table(29, 1, -1, new sbyte[] {90}), +/* NxS[ 75] */ new Table(36, 1, -1, new sbyte[] {81}), +/* NxS[ 76] */ new Table(39, 1, -1, new sbyte[] {77}), +/* NxS[ 77] */ new Table(30, 1, -1, new sbyte[] {78}), +/* NxS[ 78] */ new Table(28, 1, -1, new sbyte[] {79}), +/* NxS[ 79] */ new Table(22, 1, -1, new sbyte[] {80}), +/* NxS[ 80] */ new Table(22, 1, -1, new sbyte[] {37}), +/* NxS[ 81] */ new Table(37, 1, -1, new sbyte[] {82}), +/* NxS[ 82] */ new Table(36, 1, -1, new sbyte[] {83}), +/* NxS[ 83] */ new Table(28, 1, -1, new sbyte[] {84}), +/* NxS[ 84] */ new Table(38, 1, -1, new sbyte[] {85}), +/* NxS[ 85] */ new Table(28, 1, -1, new sbyte[] {86}), +/* NxS[ 86] */ new Table(35, 1, -1, new sbyte[] {87}), +/* NxS[ 87] */ new Table(36, 1, -1, new sbyte[] {88}), +/* NxS[ 88] */ new Table(22, 1, -1, new sbyte[] {89}), +/* NxS[ 89] */ new Table(22, 1, -1, new sbyte[] {38}), +/* NxS[ 90] */ new Table(30, 1, -1, new sbyte[] {91}), +/* NxS[ 91] */ new Table(31, 1, -1, new sbyte[] {92}), +/* NxS[ 92] */ new Table(28, 1, -1, new sbyte[] {93}), /* NxS[ 93] */ new Table(32, 1, -1, new sbyte[] {94}), -/* NxS[ 94] */ new Table(33, 1, -1, new sbyte[] {95}), -/* NxS[ 95] */ new Table(34, 1, -1, new sbyte[] {96}), -/* NxS[ 96] */ new Table(35, 1, -1, new sbyte[] {97}), -/* NxS[ 97] */ new Table(22, 1, -1, new sbyte[] {98}), -/* NxS[ 98] */ new Table(22, 1, -1, new sbyte[] {39}), -/* NxS[ 99] */ new Table(0, 7, 99, new sbyte[] {-1, 99, 53, 99, 99, 99, +/* NxS[ 94] */ new Table(32, 1, -1, new sbyte[] {95}), +/* NxS[ 95] */ new Table(33, 1, -1, new sbyte[] {96}), +/* NxS[ 96] */ new Table(34, 1, -1, new sbyte[] {97}), +/* NxS[ 97] */ new Table(35, 1, -1, new sbyte[] {98}), +/* NxS[ 98] */ new Table(22, 1, -1, new sbyte[] {99}), +/* NxS[ 99] */ new Table(22, 1, -1, new sbyte[] {39}), +/* NxS[ 100] */ new Table(45, 4, 100, new sbyte[] {53, 100, 100, -1}), +/* NxS[ 101] */ new Table(0, 7, 101, new sbyte[] {-1, 101, 54, 101, 101, 101, -1}), -/* NxS[ 100] */ new Table(2, 1, 56, new sbyte[] {57}), -/* NxS[ 101] */ new Table(8, 1, 58, new sbyte[] {59}), -/* NxS[ 102] */ new Table(0, 0, -1, null), -/* NxS[ 103] */ new Table(1, 3, 61, new sbyte[] {62, 61, 63}), -/* NxS[ 104] */ new Table(0, 7, 104, new sbyte[] {-1, 104, 64, 104, 104, 104, +/* NxS[ 102] */ new Table(2, 1, 57, new sbyte[] {58}), +/* NxS[ 103] */ new Table(8, 1, 59, new sbyte[] {60}), +/* NxS[ 104] */ new Table(0, 0, -1, null), +/* NxS[ 105] */ new Table(1, 3, 62, new sbyte[] {63, 62, 64}), +/* NxS[ 106] */ new Table(0, 7, 106, new sbyte[] {-1, 106, 65, 106, 106, 106, -1}), }; @@ -2097,6 +2099,12 @@ yylval = new Union(); return (int)Tokens.tkHex; break; case 53: +yylval = new Union(); + currentLexLocation = CurrentLexLocation; + yylval.stn = parsertools.create_format_string_const(yytext,currentLexLocation); + return (int)Tokens.tkFormatStringLiteral; + break; + case 54: if (parsertools.build_tree_for_formatter) break; @@ -2152,36 +2160,36 @@ if (parsertools.build_tree_for_formatter) Defines.Remove(directiveparam); } break; - case 54: + case 55: { } break; - case 55: + case 56: yylval = new Union(); yylval.op = new op_type_node(Operators.AssignmentDivision); return (int)Tokens.tkDivEqual; break; - case 56: + case 57: { } break; - case 57: -BEGIN(INITIAL); - break; case 58: - case 59: -{ -} - break; - case 60: BEGIN(INITIAL); break; - case 61: - case 62: - case 63: + case 59: + case 60: { } break; + case 61: +BEGIN(INITIAL); + break; + case 62: + case 63: case 64: +{ +} + break; + case 65: parsertools.DivideDirectiveOn(yytext,out directivename,out directiveparam); parsertools.CheckDirectiveParams(directivename,directiveparam); // directivename in UPPERCASE! if (directivename == "IFDEF") @@ -2213,7 +2221,7 @@ parsertools.DivideDirectiveOn(yytext,out directivename,out directiveparam); BEGIN(INITIAL); } break; - case 65: + case 66: { } diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascal.lex b/Parsers/PascalABCParserNewSaushkin/ABCPascal.lex index c8e877be9..3ac6dd6bb 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascal.lex +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascal.lex @@ -35,6 +35,7 @@ INTNUM {Digit}+ FLOATNUM {INTNUM}\.{INTNUM} EXPNUM ({INTNUM}\.)?{INTNUM}[eE][+\-]?{INTNUM} STRINGNUM \'([^\'\n]|\'\')*\' +FORMATSTRINGNUM \$\'([^\'\n]|\'\')*\' HEXNUM ${HexDigit}+ SHARPCHARNUM #{Digit}+ OLDDIRECTIVE #{ID} @@ -448,6 +449,13 @@ UNICODEARROW \x890 return (int)Tokens.tkStringLiteral; } +{FORMATSTRINGNUM} { + yylval = new Union(); + currentLexLocation = CurrentLexLocation; + yylval.stn = parsertools.create_format_string_const(yytext,currentLexLocation); + return (int)Tokens.tkFormatStringLiteral; +} + {SHARPCHARNUM} { yylval = new Union(); currentLexLocation = CurrentLexLocation; diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascal.y b/Parsers/PascalABCParserNewSaushkin/ABCPascal.y index 5b93e5225..39f8b761a 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascal.y +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascal.y @@ -47,7 +47,7 @@ %token tkAssign tkPlusEqual tkMinusEqual tkMultEqual tkDivEqual tkMinus tkPlus tkSlash tkStar tkStarStar tkEqual tkGreater tkGreaterEqual tkLower tkLowerEqual %token tkNotEqual tkCSharpStyleOr tkArrow tkOr tkXor tkAnd tkDiv tkMod tkShl tkShr tkNot tkAs tkIn tkIs tkImplicit tkExplicit tkAddressOf tkDeref %token tkDirectiveName tkIdentifier -%token tkStringLiteral tkAsciiChar +%token tkStringLiteral tkFormatStringLiteral tkAsciiChar %token tkAbstract tkForward tkOverload tkReintroduce tkOverride tkVirtual tkExtensionMethod %token tkInteger tkFloat tkHex @@ -3317,6 +3317,17 @@ literal { $$ = NewLiteral($1 as literal_const_line); } + | tkFormatStringLiteral + { + if (parsertools.build_tree_for_formatter) + { + $$ = $1 as string_const; + } + else + { + $$ = NewFormatString($1 as string_const); + } + } ; literal_list diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascalParserTools.cs b/Parsers/PascalABCParserNewSaushkin/ABCPascalParserTools.cs index 1d7ce4894..4b89b768f 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascalParserTools.cs +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascalParserTools.cs @@ -411,7 +411,16 @@ namespace PascalABCSavParser lt.source_context = sc; return lt; } - + + public literal create_format_string_const(string text, SourceContext sc) + { + literal lt; + text = ReplaceSpecialSymbols(text.Substring(2, text.Length - 3)); + lt = new string_const(text); + lt.source_context = sc; + return lt; + } + public procedure_definition lambda(function_lambda_definition _function_lambda_definition) { procedure_definition _func_def = new procedure_definition(); diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs b/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs index 04f58bea2..b980f7573 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs @@ -2,7 +2,7 @@ // GPPG version 1.3.6 // Machine: IVAN-PC -// DateTime: 18.03.2018 11:46:46 +// DateTime: 20.03.2018 20:53:53 // UserName: Ivan // Input file @@ -44,9 +44,9 @@ public enum Tokens { tkNotEqual=115,tkCSharpStyleOr=116,tkArrow=117,tkOr=118,tkXor=119,tkAnd=120, tkDiv=121,tkMod=122,tkShl=123,tkShr=124,tkNot=125,tkAs=126, tkIn=127,tkIs=128,tkImplicit=129,tkExplicit=130,tkAddressOf=131,tkDeref=132, - tkIdentifier=133,tkStringLiteral=134,tkAsciiChar=135,tkAbstract=136,tkForward=137,tkOverload=138, - tkReintroduce=139,tkOverride=140,tkVirtual=141,tkExtensionMethod=142,tkInteger=143,tkFloat=144, - tkHex=145}; + tkIdentifier=133,tkStringLiteral=134,tkFormatStringLiteral=135,tkAsciiChar=136,tkAbstract=137,tkForward=138, + tkOverload=139,tkReintroduce=140,tkOverride=141,tkVirtual=142,tkExtensionMethod=143,tkInteger=144, + tkFloat=145,tkHex=146}; // Abstract base class for GPLEX scanners public abstract class ScanBase : AbstractScanner { @@ -74,8 +74,8 @@ public partial class GPPGParser: ShiftReduceParser aliasses; #pragma warning restore 649 - private static Rule[] rules = new Rule[849]; - private static State[] states = new State[1375]; + private static Rule[] rules = new Rule[850]; + private static State[] states = new State[1376]; private static string[] nonTerms = new string[] { "parse_goal", "unit_key_word", "assignment", "optional_array_initializer", "attribute_declarations", "ot_visibility_specifier", "one_attribute", "attribute_variable", @@ -155,13 +155,13 @@ public partial class GPPGParser: ShiftReduceParser one_literal + case 670: // literal -> tkFormatStringLiteral +{ + if (parsertools.build_tree_for_formatter) + { + CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].stn as string_const; + } + else + { + CurrentSemanticValue.ex = NewFormatString(ValueStack[ValueStack.Depth-1].stn as string_const); + } + } + break; + case 671: // literal_list -> one_literal { CurrentSemanticValue.stn = new literal_const_line(ValueStack[ValueStack.Depth-1].ex as literal, CurrentLocationSpan); } break; - case 671: // literal_list -> literal_list, one_literal + case 672: // literal_list -> literal_list, one_literal { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-2].stn as literal_const_line).Add(ValueStack[ValueStack.Depth-1].ex as literal, CurrentLocationSpan); } break; - case 672: // operator_name_ident -> tkOperator, overload_operator + case 673: // operator_name_ident -> tkOperator, overload_operator { CurrentSemanticValue.ex = new operator_name_ident((ValueStack[ValueStack.Depth-1].op as op_type_node).text, (ValueStack[ValueStack.Depth-1].op as op_type_node).type, CurrentLocationSpan); } break; - case 673: // optional_method_modificators -> tkSemiColon + case 674: // optional_method_modificators -> tkSemiColon { CurrentSemanticValue.stn = new procedure_attributes_list(new List(),CurrentLocationSpan); } break; - case 674: // optional_method_modificators -> tkSemiColon, meth_modificators, tkSemiColon + case 675: // optional_method_modificators -> tkSemiColon, meth_modificators, tkSemiColon { //parsertools.AddModifier((procedure_attributes_list)$2, proc_attribute.attr_overload); CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-2].stn; } break; - case 675: // optional_method_modificators1 -> /* empty */ + case 676: // optional_method_modificators1 -> /* empty */ { CurrentSemanticValue.stn = new procedure_attributes_list(new List(),CurrentLocationSpan); } break; - case 676: // optional_method_modificators1 -> tkSemiColon, meth_modificators + case 677: // optional_method_modificators1 -> tkSemiColon, meth_modificators { //parsertools.AddModifier((procedure_attributes_list)$2, proc_attribute.attr_overload); CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 677: // meth_modificators -> meth_modificator + case 678: // meth_modificators -> meth_modificator { CurrentSemanticValue.stn = new procedure_attributes_list(ValueStack[ValueStack.Depth-1].id as procedure_attribute, CurrentLocationSpan); } break; - case 678: // meth_modificators -> meth_modificators, tkSemiColon, meth_modificator + case 679: // meth_modificators -> meth_modificators, tkSemiColon, meth_modificator { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-3].stn as procedure_attributes_list).Add(ValueStack[ValueStack.Depth-1].id as procedure_attribute, CurrentLocationSpan); } break; - case 679: // identifier -> tkIdentifier + case 680: // identifier -> tkIdentifier { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 680: // identifier -> property_specifier_directives + case 681: // identifier -> property_specifier_directives { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 681: // identifier -> non_reserved + case 682: // identifier -> non_reserved { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 682: // identifier_or_keyword -> identifier + case 683: // identifier_or_keyword -> identifier { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 683: // identifier_or_keyword -> keyword + case 684: // identifier_or_keyword -> keyword { CurrentSemanticValue.id = new ident(ValueStack[ValueStack.Depth-1].ti.text, CurrentLocationSpan); } break; - case 684: // identifier_or_keyword -> reserved_keyword + case 685: // identifier_or_keyword -> reserved_keyword { CurrentSemanticValue.id = new ident(ValueStack[ValueStack.Depth-1].ti.text, CurrentLocationSpan); } break; - case 685: // identifier_keyword_operatorname -> identifier + case 686: // identifier_keyword_operatorname -> identifier { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 686: // identifier_keyword_operatorname -> keyword + case 687: // identifier_keyword_operatorname -> keyword { CurrentSemanticValue.id = new ident(ValueStack[ValueStack.Depth-1].ti.text, CurrentLocationSpan); } break; - case 687: // identifier_keyword_operatorname -> operator_name_ident + case 688: // identifier_keyword_operatorname -> operator_name_ident { CurrentSemanticValue.id = (ident)ValueStack[ValueStack.Depth-1].ex; } break; - case 688: // meth_modificator -> tkAbstract + case 689: // meth_modificator -> tkAbstract { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 689: // meth_modificator -> tkOverload + case 690: // meth_modificator -> tkOverload { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; parsertools.AddWarningFromResource("OVERLOAD_IS_NOT_USED", ValueStack[ValueStack.Depth-1].id.source_context); } break; - case 690: // meth_modificator -> tkReintroduce + case 691: // meth_modificator -> tkReintroduce { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 691: // meth_modificator -> tkOverride + case 692: // meth_modificator -> tkOverride { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 692: // meth_modificator -> tkExtensionMethod + case 693: // meth_modificator -> tkExtensionMethod { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 693: // meth_modificator -> tkVirtual + case 694: // meth_modificator -> tkVirtual { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 694: // property_modificator -> tkVirtual + case 695: // property_modificator -> tkVirtual { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 695: // property_modificator -> tkOverride + case 696: // property_modificator -> tkOverride { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 696: // property_specifier_directives -> tkRead + case 697: // property_specifier_directives -> tkRead { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 697: // property_specifier_directives -> tkWrite + case 698: // property_specifier_directives -> tkWrite { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 698: // non_reserved -> tkName + case 699: // non_reserved -> tkName { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 699: // non_reserved -> tkNew + case 700: // non_reserved -> tkNew { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 700: // visibility_specifier -> tkInternal + case 701: // visibility_specifier -> tkInternal { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 701: // visibility_specifier -> tkPublic + case 702: // visibility_specifier -> tkPublic { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 702: // visibility_specifier -> tkProtected + case 703: // visibility_specifier -> tkProtected { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 703: // visibility_specifier -> tkPrivate + case 704: // visibility_specifier -> tkPrivate { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 704: // keyword -> visibility_specifier + case 705: // keyword -> visibility_specifier { CurrentSemanticValue.ti = new token_info(ValueStack[ValueStack.Depth-1].id.name, CurrentLocationSpan); } break; - case 705: // keyword -> tkSealed + case 706: // keyword -> tkSealed { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 706: // keyword -> tkTemplate + case 707: // keyword -> tkTemplate { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 707: // keyword -> tkOr + case 708: // keyword -> tkOr { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].op; } break; - case 708: // keyword -> tkTypeOf + case 709: // keyword -> tkTypeOf { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 709: // keyword -> tkSizeOf + case 710: // keyword -> tkSizeOf { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 710: // keyword -> tkDefault + case 711: // keyword -> tkDefault { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 711: // keyword -> tkWhere + case 712: // keyword -> tkWhere { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 712: // keyword -> tkXor + case 713: // keyword -> tkXor { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].op; } break; - case 713: // keyword -> tkAnd + case 714: // keyword -> tkAnd { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].op; } break; - case 714: // keyword -> tkDiv + case 715: // keyword -> tkDiv { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].op; } break; - case 715: // keyword -> tkMod + case 716: // keyword -> tkMod { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].op; } break; - case 716: // keyword -> tkShl + case 717: // keyword -> tkShl { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].op; } break; - case 717: // keyword -> tkShr + case 718: // keyword -> tkShr { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].op; } break; - case 718: // keyword -> tkNot + case 719: // keyword -> tkNot { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].op; } break; - case 719: // keyword -> tkAs + case 720: // keyword -> tkAs { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].op; } break; - case 720: // keyword -> tkIn + case 721: // keyword -> tkIn { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].op; } break; - case 721: // keyword -> tkIs + case 722: // keyword -> tkIs { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].op; } break; - case 722: // keyword -> tkArray + case 723: // keyword -> tkArray { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 723: // keyword -> tkSequence + case 724: // keyword -> tkSequence { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 724: // keyword -> tkBegin + case 725: // keyword -> tkBegin { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 725: // keyword -> tkCase + case 726: // keyword -> tkCase { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 726: // keyword -> tkClass + case 727: // keyword -> tkClass { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 727: // keyword -> tkConst + case 728: // keyword -> tkConst { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 728: // keyword -> tkConstructor + case 729: // keyword -> tkConstructor { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 729: // keyword -> tkDestructor + case 730: // keyword -> tkDestructor { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 730: // keyword -> tkDownto + case 731: // keyword -> tkDownto { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 731: // keyword -> tkDo + case 732: // keyword -> tkDo { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 732: // keyword -> tkElse + case 733: // keyword -> tkElse { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 733: // keyword -> tkExcept + case 734: // keyword -> tkExcept { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 734: // keyword -> tkFile + case 735: // keyword -> tkFile { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 735: // keyword -> tkAuto + case 736: // keyword -> tkAuto { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 736: // keyword -> tkFinalization + case 737: // keyword -> tkFinalization { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 737: // keyword -> tkFinally + case 738: // keyword -> tkFinally { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 738: // keyword -> tkFor + case 739: // keyword -> tkFor { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 739: // keyword -> tkForeach + case 740: // keyword -> tkForeach { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 740: // keyword -> tkFunction + case 741: // keyword -> tkFunction { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 741: // keyword -> tkIf + case 742: // keyword -> tkIf { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 742: // keyword -> tkImplementation + case 743: // keyword -> tkImplementation { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 743: // keyword -> tkInherited + case 744: // keyword -> tkInherited { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 744: // keyword -> tkInitialization + case 745: // keyword -> tkInitialization { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 745: // keyword -> tkInterface + case 746: // keyword -> tkInterface { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 746: // keyword -> tkProcedure + case 747: // keyword -> tkProcedure { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 747: // keyword -> tkProperty + case 748: // keyword -> tkProperty { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 748: // keyword -> tkRaise + case 749: // keyword -> tkRaise { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 749: // keyword -> tkRecord + case 750: // keyword -> tkRecord { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 750: // keyword -> tkRepeat + case 751: // keyword -> tkRepeat { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 751: // keyword -> tkSet + case 752: // keyword -> tkSet { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 752: // keyword -> tkTry + case 753: // keyword -> tkTry { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 753: // keyword -> tkType + case 754: // keyword -> tkType { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 754: // keyword -> tkThen + case 755: // keyword -> tkThen { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 755: // keyword -> tkTo + case 756: // keyword -> tkTo { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 756: // keyword -> tkUntil + case 757: // keyword -> tkUntil { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 757: // keyword -> tkUses + case 758: // keyword -> tkUses { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 758: // keyword -> tkVar + case 759: // keyword -> tkVar { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 759: // keyword -> tkWhile + case 760: // keyword -> tkWhile { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 760: // keyword -> tkWith + case 761: // keyword -> tkWith { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 761: // keyword -> tkNil + case 762: // keyword -> tkNil { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 762: // keyword -> tkGoto + case 763: // keyword -> tkGoto { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 763: // keyword -> tkOf + case 764: // keyword -> tkOf { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 764: // keyword -> tkLabel + case 765: // keyword -> tkLabel { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 765: // keyword -> tkProgram + case 766: // keyword -> tkProgram { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 766: // keyword -> tkUnit + case 767: // keyword -> tkUnit { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 767: // keyword -> tkLibrary + case 768: // keyword -> tkLibrary { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 768: // keyword -> tkNamespace + case 769: // keyword -> tkNamespace { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 769: // keyword -> tkExternal + case 770: // keyword -> tkExternal { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 770: // keyword -> tkParams + case 771: // keyword -> tkParams { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 771: // keyword -> tkEvent + case 772: // keyword -> tkEvent { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 772: // keyword -> tkYield + case 773: // keyword -> tkYield { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 773: // reserved_keyword -> tkOperator + case 774: // reserved_keyword -> tkOperator { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 774: // reserved_keyword -> tkEnd + case 775: // reserved_keyword -> tkEnd { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 775: // overload_operator -> tkMinus + case 776: // overload_operator -> tkMinus { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 776: // overload_operator -> tkPlus + case 777: // overload_operator -> tkPlus { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 777: // overload_operator -> tkSlash + case 778: // overload_operator -> tkSlash { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 778: // overload_operator -> tkStar + case 779: // overload_operator -> tkStar { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 779: // overload_operator -> tkEqual + case 780: // overload_operator -> tkEqual { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 780: // overload_operator -> tkGreater + case 781: // overload_operator -> tkGreater { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 781: // overload_operator -> tkGreaterEqual + case 782: // overload_operator -> tkGreaterEqual { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 782: // overload_operator -> tkLower + case 783: // overload_operator -> tkLower { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 783: // overload_operator -> tkLowerEqual + case 784: // overload_operator -> tkLowerEqual { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 784: // overload_operator -> tkNotEqual + case 785: // overload_operator -> tkNotEqual { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 785: // overload_operator -> tkOr + case 786: // overload_operator -> tkOr { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 786: // overload_operator -> tkXor + case 787: // overload_operator -> tkXor { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 787: // overload_operator -> tkAnd + case 788: // overload_operator -> tkAnd { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 788: // overload_operator -> tkDiv + case 789: // overload_operator -> tkDiv { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 789: // overload_operator -> tkMod + case 790: // overload_operator -> tkMod { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 790: // overload_operator -> tkShl + case 791: // overload_operator -> tkShl { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 791: // overload_operator -> tkShr + case 792: // overload_operator -> tkShr { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 792: // overload_operator -> tkNot + case 793: // overload_operator -> tkNot { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 793: // overload_operator -> tkIn + case 794: // overload_operator -> tkIn { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 794: // overload_operator -> tkImplicit + case 795: // overload_operator -> tkImplicit { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 795: // overload_operator -> tkExplicit + case 796: // overload_operator -> tkExplicit { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 796: // overload_operator -> assign_operator + case 797: // overload_operator -> assign_operator { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 797: // overload_operator -> tkStarStar + case 798: // overload_operator -> tkStarStar { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 798: // assign_operator -> tkAssign + case 799: // assign_operator -> tkAssign { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 799: // assign_operator -> tkPlusEqual + case 800: // assign_operator -> tkPlusEqual { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 800: // assign_operator -> tkMinusEqual + case 801: // assign_operator -> tkMinusEqual { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 801: // assign_operator -> tkMultEqual + case 802: // assign_operator -> tkMultEqual { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 802: // assign_operator -> tkDivEqual + case 803: // assign_operator -> tkDivEqual { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 803: // func_decl_lambda -> identifier, tkArrow, lambda_function_body + case 804: // func_decl_lambda -> identifier, tkArrow, lambda_function_body { var idList = new ident_list(ValueStack[ValueStack.Depth-3].id, LocationStack[LocationStack.Depth-3]); var formalPars = new formal_parameters(new typed_parameters(idList, new lambda_inferred_type(new PascalABCCompiler.TreeRealization.lambda_any_type_node(), LocationStack[LocationStack.Depth-3]), parametr_kind.none, null, LocationStack[LocationStack.Depth-3]), LocationStack[LocationStack.Depth-3]); CurrentSemanticValue.ex = new function_lambda_definition(lambdaHelper.CreateLambdaName(), formalPars, new lambda_inferred_type(new PascalABCCompiler.TreeRealization.lambda_any_type_node(), LocationStack[LocationStack.Depth-3]), ValueStack[ValueStack.Depth-1].stn as statement_list, CurrentLocationSpan); } break; - case 804: // func_decl_lambda -> tkRoundOpen, tkRoundClose, lambda_type_ref_noproctype, + case 805: // func_decl_lambda -> tkRoundOpen, tkRoundClose, lambda_type_ref_noproctype, // tkArrow, lambda_function_body { CurrentSemanticValue.ex = new function_lambda_definition(lambdaHelper.CreateLambdaName(), null, ValueStack[ValueStack.Depth-3].td, ValueStack[ValueStack.Depth-1].stn as statement_list, CurrentLocationSpan); } break; - case 805: // func_decl_lambda -> tkRoundOpen, identifier, tkColon, fptype, tkRoundClose, + case 806: // func_decl_lambda -> tkRoundOpen, identifier, tkColon, fptype, tkRoundClose, // lambda_type_ref_noproctype, tkArrow, lambda_function_body { var idList = new ident_list(ValueStack[ValueStack.Depth-7].id, LocationStack[LocationStack.Depth-7]); @@ -5829,7 +5843,7 @@ public partial class GPPGParser: ShiftReduceParser tkRoundOpen, identifier, tkSemiColon, full_lambda_fp_list, + case 807: // func_decl_lambda -> tkRoundOpen, identifier, tkSemiColon, full_lambda_fp_list, // tkRoundClose, lambda_type_ref_noproctype, tkArrow, // lambda_function_body { @@ -5840,7 +5854,7 @@ public partial class GPPGParser: ShiftReduceParser tkRoundOpen, identifier, tkColon, fptype, tkSemiColon, + case 808: // func_decl_lambda -> tkRoundOpen, identifier, tkColon, fptype, tkSemiColon, // full_lambda_fp_list, tkRoundClose, // lambda_type_ref_noproctype, tkArrow, lambda_function_body { @@ -5852,7 +5866,7 @@ public partial class GPPGParser: ShiftReduceParser tkRoundOpen, expr_l1, tkComma, expr_l1_list, + case 809: // func_decl_lambda -> tkRoundOpen, expr_l1, tkComma, expr_l1_list, // lambda_type_ref, optional_full_lambda_fp_list, // tkRoundClose, rem_lambda { @@ -5914,61 +5928,61 @@ public partial class GPPGParser: ShiftReduceParser expl_func_decl_lambda + case 810: // func_decl_lambda -> expl_func_decl_lambda { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 810: // optional_full_lambda_fp_list -> /* empty */ + case 811: // optional_full_lambda_fp_list -> /* empty */ { CurrentSemanticValue.stn = null; } break; - case 811: // optional_full_lambda_fp_list -> tkSemiColon, full_lambda_fp_list + case 812: // optional_full_lambda_fp_list -> tkSemiColon, full_lambda_fp_list { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 812: // rem_lambda -> lambda_type_ref_noproctype, tkArrow, lambda_function_body + case 813: // rem_lambda -> lambda_type_ref_noproctype, tkArrow, lambda_function_body { CurrentSemanticValue.ob = new pair_type_stlist(ValueStack[ValueStack.Depth-3].td,ValueStack[ValueStack.Depth-1].stn as statement_list); } break; - case 813: // expl_func_decl_lambda -> tkFunction, lambda_type_ref, tkArrow, + case 814: // expl_func_decl_lambda -> tkFunction, lambda_type_ref, tkArrow, // lambda_function_body { CurrentSemanticValue.ex = new function_lambda_definition(lambdaHelper.CreateLambdaName(), null, ValueStack[ValueStack.Depth-3].td, ValueStack[ValueStack.Depth-1].stn as statement_list, 1, CurrentLocationSpan); } break; - case 814: // expl_func_decl_lambda -> tkFunction, tkRoundOpen, tkRoundClose, lambda_type_ref, + case 815: // expl_func_decl_lambda -> tkFunction, tkRoundOpen, tkRoundClose, lambda_type_ref, // tkArrow, lambda_function_body { CurrentSemanticValue.ex = new function_lambda_definition(lambdaHelper.CreateLambdaName(), null, ValueStack[ValueStack.Depth-3].td, ValueStack[ValueStack.Depth-1].stn as statement_list, 1, CurrentLocationSpan); } break; - case 815: // expl_func_decl_lambda -> tkFunction, tkRoundOpen, full_lambda_fp_list, + case 816: // expl_func_decl_lambda -> tkFunction, tkRoundOpen, full_lambda_fp_list, // tkRoundClose, lambda_type_ref, tkArrow, // lambda_function_body { CurrentSemanticValue.ex = new function_lambda_definition(lambdaHelper.CreateLambdaName(), ValueStack[ValueStack.Depth-5].stn as formal_parameters, ValueStack[ValueStack.Depth-3].td, ValueStack[ValueStack.Depth-1].stn as statement_list, 1, CurrentLocationSpan); } break; - case 816: // expl_func_decl_lambda -> tkProcedure, tkArrow, lambda_procedure_body + case 817: // expl_func_decl_lambda -> tkProcedure, tkArrow, lambda_procedure_body { CurrentSemanticValue.ex = new function_lambda_definition(lambdaHelper.CreateLambdaName(), null, null, ValueStack[ValueStack.Depth-1].stn as statement_list, 2, CurrentLocationSpan); } break; - case 817: // expl_func_decl_lambda -> tkProcedure, tkRoundOpen, tkRoundClose, tkArrow, + case 818: // expl_func_decl_lambda -> tkProcedure, tkRoundOpen, tkRoundClose, tkArrow, // lambda_procedure_body { CurrentSemanticValue.ex = new function_lambda_definition(lambdaHelper.CreateLambdaName(), null, null, ValueStack[ValueStack.Depth-1].stn as statement_list, 2, CurrentLocationSpan); } break; - case 818: // expl_func_decl_lambda -> tkProcedure, tkRoundOpen, full_lambda_fp_list, + case 819: // expl_func_decl_lambda -> tkProcedure, tkRoundOpen, full_lambda_fp_list, // tkRoundClose, tkArrow, lambda_procedure_body { CurrentSemanticValue.ex = new function_lambda_definition(lambdaHelper.CreateLambdaName(), ValueStack[ValueStack.Depth-4].stn as formal_parameters, null, ValueStack[ValueStack.Depth-1].stn as statement_list, 2, CurrentLocationSpan); } break; - case 819: // full_lambda_fp_list -> lambda_simple_fp_sect + case 820: // full_lambda_fp_list -> lambda_simple_fp_sect { var typed_pars = ValueStack[ValueStack.Depth-1].stn as typed_parameters; if (typed_pars.vars_type is lambda_inferred_type) @@ -5988,147 +6002,147 @@ public partial class GPPGParser: ShiftReduceParser full_lambda_fp_list, tkSemiColon, lambda_simple_fp_sect + case 821: // full_lambda_fp_list -> full_lambda_fp_list, tkSemiColon, lambda_simple_fp_sect { CurrentSemanticValue.stn =(ValueStack[ValueStack.Depth-3].stn as formal_parameters).Add(ValueStack[ValueStack.Depth-1].stn as typed_parameters, CurrentLocationSpan); } break; - case 821: // lambda_simple_fp_sect -> ident_list, lambda_type_ref + case 822: // lambda_simple_fp_sect -> ident_list, lambda_type_ref { CurrentSemanticValue.stn = new typed_parameters(ValueStack[ValueStack.Depth-2].stn as ident_list, ValueStack[ValueStack.Depth-1].td, parametr_kind.none, null, CurrentLocationSpan); } break; - case 822: // lambda_type_ref -> /* empty */ + case 823: // lambda_type_ref -> /* empty */ { CurrentSemanticValue.td = new lambda_inferred_type(new PascalABCCompiler.TreeRealization.lambda_any_type_node(), null); } break; - case 823: // lambda_type_ref -> tkColon, fptype + case 824: // lambda_type_ref -> tkColon, fptype { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 824: // lambda_type_ref_noproctype -> /* empty */ + case 825: // lambda_type_ref_noproctype -> /* empty */ { CurrentSemanticValue.td = new lambda_inferred_type(new PascalABCCompiler.TreeRealization.lambda_any_type_node(), null); } break; - case 825: // lambda_type_ref_noproctype -> tkColon, fptype_noproctype + case 826: // lambda_type_ref_noproctype -> tkColon, fptype_noproctype { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 826: // lambda_function_body -> expr_l1 + case 827: // lambda_function_body -> expr_l1 { CurrentSemanticValue.stn = NewLambdaBody(ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 827: // lambda_function_body -> compound_stmt + case 828: // lambda_function_body -> compound_stmt { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 828: // lambda_function_body -> if_stmt + case 829: // lambda_function_body -> if_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 829: // lambda_function_body -> while_stmt + case 830: // lambda_function_body -> while_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 830: // lambda_function_body -> repeat_stmt + case 831: // lambda_function_body -> repeat_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 831: // lambda_function_body -> for_stmt + case 832: // lambda_function_body -> for_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 832: // lambda_function_body -> foreach_stmt + case 833: // lambda_function_body -> foreach_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 833: // lambda_function_body -> case_stmt + case 834: // lambda_function_body -> case_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 834: // lambda_function_body -> try_stmt + case 835: // lambda_function_body -> try_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 835: // lambda_function_body -> lock_stmt + case 836: // lambda_function_body -> lock_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 836: // lambda_function_body -> yield_stmt + case 837: // lambda_function_body -> yield_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 837: // lambda_procedure_body -> proc_call + case 838: // lambda_procedure_body -> proc_call { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 838: // lambda_procedure_body -> compound_stmt + case 839: // lambda_procedure_body -> compound_stmt { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 839: // lambda_procedure_body -> if_stmt + case 840: // lambda_procedure_body -> if_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 840: // lambda_procedure_body -> while_stmt + case 841: // lambda_procedure_body -> while_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 841: // lambda_procedure_body -> repeat_stmt + case 842: // lambda_procedure_body -> repeat_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 842: // lambda_procedure_body -> for_stmt + case 843: // lambda_procedure_body -> for_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 843: // lambda_procedure_body -> foreach_stmt + case 844: // lambda_procedure_body -> foreach_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 844: // lambda_procedure_body -> case_stmt + case 845: // lambda_procedure_body -> case_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 845: // lambda_procedure_body -> try_stmt + case 846: // lambda_procedure_body -> try_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 846: // lambda_procedure_body -> lock_stmt + case 847: // lambda_procedure_body -> lock_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 847: // lambda_procedure_body -> yield_stmt + case 848: // lambda_procedure_body -> yield_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 848: // lambda_procedure_body -> assignment + case 849: // lambda_procedure_body -> assignment { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } diff --git a/Parsers/PascalABCParserNewSaushkin/Errors1.cs b/Parsers/PascalABCParserNewSaushkin/Errors1.cs index 61a399774..dc480b3a7 100644 --- a/Parsers/PascalABCParserNewSaushkin/Errors1.cs +++ b/Parsers/PascalABCParserNewSaushkin/Errors1.cs @@ -64,6 +64,13 @@ namespace PascalABCCompiler.Errors { } } + public class bad_format_string : SyntaxError + { + public bad_format_string(string _file_name, SourceContext _source_context, syntax_tree_node _node) : + base(PascalABCSavParser.StringResources.Get("BAD_FORMAT_STRING"), _file_name, _source_context, _node) + { + } + } public class PABCNETUnexpectedToken : SyntaxError { private string _message; diff --git a/Parsers/PascalABCParserNewSaushkin/SemanticRules.cs b/Parsers/PascalABCParserNewSaushkin/SemanticRules.cs index 6a0708c0b..8f2066548 100644 --- a/Parsers/PascalABCParserNewSaushkin/SemanticRules.cs +++ b/Parsers/PascalABCParserNewSaushkin/SemanticRules.cs @@ -9,6 +9,7 @@ using PascalABCCompiler.SyntaxTree; using PascalABCSavParser; using PascalABCCompiler.ParserTools; using PascalABCCompiler.Errors; +using System.Text.RegularExpressions; namespace GPPGParserScanner { @@ -380,6 +381,86 @@ namespace GPPGParserScanner return lcl.literals[0]; return lcl; } + + public expression NewFormatString(string_const str) + { + try + { + method_call mc = new method_call(); + mc.dereferencing_value = new dot_node(new ident("string", str.source_context), new ident("Format", str.source_context), str.source_context); + mc.parameters = new expression_list(); + string[] arr = Regex.Split(str.Value, @"\{[\w\d._]+\}"); + Match match = Regex.Match(str.Value, @"\{[\w\d._]+\}"); + List vars = new List(); + Dictionary var_offsets = new Dictionary(); + while (match.Success) + { + string s = match.Value.Replace("{", "").Replace("}", ""); + vars.Add(s); + var_offsets.Add(s, match.Index); + match = match.NextMatch(); + } + if (vars.Count == 0) + { + parsertools.errors.Add(new bad_format_string(parsertools.CurrentFileName, str.source_context, str)); + return str; + } + + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < arr.Length; i++) + { + sb.Append(arr[i]); + if (i < arr.Length - 1) + sb.Append("{" + i + "}"); + } + mc.parameters.Add(new string_const(sb.ToString(), str.source_context), str.source_context); + foreach (string s in vars) + { + SourceContext sc = new SourceContext(str.source_context); + sc.begin_position.column_num += var_offsets[s] + 2; + sc.end_position.column_num = sc.begin_position.column_num + s.Length; + string[] words = s.Split('.'); + dot_node dn = null; + ident id = null; + int offset = 0; + foreach (string word in words) + { + if (string.IsNullOrEmpty(word) || char.IsDigit(word[0])) + { + parsertools.errors.Add(new bad_format_string(parsertools.CurrentFileName, str.source_context, str)); + return str; + } + if (id == null) + { + id = new ident(word, sc); + } + else + { + if (dn == null) + { + dn = new dot_node(id, new ident(word, sc), sc); + } + else + { + dn = new dot_node(dn, new ident(word, sc), sc); + } + } + } + if (dn != null) + mc.parameters.Add(dn, sc); + else + mc.parameters.Add(id, sc); + } + + mc.source_context = str.source_context; + return mc; + } + catch (Exception ex) + { + parsertools.errors.Add(new bad_format_string(parsertools.CurrentFileName, str.source_context, str)); + } + return str; + } public var_def_statement NewVarOrIdentifier(ident identifier, named_type_reference fptype, LexLocation loc) { diff --git a/SyntaxTree/tree/TreeSubsidiary.cs b/SyntaxTree/tree/TreeSubsidiary.cs index f28aa8c30..f58921a16 100644 --- a/SyntaxTree/tree/TreeSubsidiary.cs +++ b/SyntaxTree/tree/TreeSubsidiary.cs @@ -210,6 +210,10 @@ namespace PascalABCCompiler.SyntaxTree { return _line_num; } + set + { + _line_num = value; + } } public int column_num @@ -218,6 +222,10 @@ namespace PascalABCCompiler.SyntaxTree { return _column_num; } + set + { + _column_num = value; + } } } diff --git a/TestSuite/formatstring1.pas b/TestSuite/formatstring1.pas new file mode 100644 index 000000000..70418342f --- /dev/null +++ b/TestSuite/formatstring1.pas @@ -0,0 +1,11 @@ +type + TRec = record + a: integer; + end; + +begin + var x: TRec; + x.a := 2; + var s := $'Hello {x.a}'; + assert(s = 'Hello 2'); +end. \ No newline at end of file diff --git a/TestSuite/formatstring2.pas b/TestSuite/formatstring2.pas new file mode 100644 index 000000000..cf4a35d2a --- /dev/null +++ b/TestSuite/formatstring2.pas @@ -0,0 +1,9 @@ +begin + var a := 2; + var b := 3; + var c := 4; + var s := $'Hello {a}'; + assert(s = 'Hello 2'); + s := $'{a},{b},{c}'; + assert(s = '2,3,4'); +end. \ No newline at end of file diff --git a/TestSuite/formatter_tests/input/formatstring1.pas b/TestSuite/formatter_tests/input/formatstring1.pas new file mode 100644 index 000000000..70418342f --- /dev/null +++ b/TestSuite/formatter_tests/input/formatstring1.pas @@ -0,0 +1,11 @@ +type + TRec = record + a: integer; + end; + +begin + var x: TRec; + x.a := 2; + var s := $'Hello {x.a}'; + assert(s = 'Hello 2'); +end. \ No newline at end of file diff --git a/TestSuite/formatter_tests/input/formatstring2.pas b/TestSuite/formatter_tests/input/formatstring2.pas new file mode 100644 index 000000000..cf4a35d2a --- /dev/null +++ b/TestSuite/formatter_tests/input/formatstring2.pas @@ -0,0 +1,9 @@ +begin + var a := 2; + var b := 3; + var c := 4; + var s := $'Hello {a}'; + assert(s = 'Hello 2'); + s := $'{a},{b},{c}'; + assert(s = '2,3,4'); +end. \ No newline at end of file diff --git a/bin/Lng/Eng/PascalABCParser.dat b/bin/Lng/Eng/PascalABCParser.dat index 78138f419..55ae4a604 100644 --- a/bin/Lng/Eng/PascalABCParser.dat +++ b/bin/Lng/Eng/PascalABCParser.dat @@ -60,3 +60,4 @@ USING_UNLOCAL_FOR_VARIABLE=Cycle counter variable should be declared in for cycl USING_UNLOCAL_FOREACH_VARIABLE=Cycle counter variable should be declared in foreach cycle OVERLOAD_IS_NOT_USED=overload is not used in PascalABC.NET ONLY_BASE_ASSIGNMENT_FOR_TUPLE=Tuple allows only base assignment := +BAD_FORMAT_STRING=Interpolated string has invalid format diff --git a/bin/Lng/Rus/PascalABCParser.dat b/bin/Lng/Rus/PascalABCParser.dat index e7913518d..1273abcca 100644 --- a/bin/Lng/Rus/PascalABCParser.dat +++ b/bin/Lng/Rus/PascalABCParser.dat @@ -59,3 +59,4 @@ USING_UNLOCAL_FOR_VARIABLE=Параметр цикла for в PascalABC.NET до USING_UNLOCAL_FOREACH_VARIABLE=Параметр цикла foreach должен описываться в заголовке цикла OVERLOAD_IS_NOT_USED=overload не используется в PascalABC.NET ONLY_BASE_ASSIGNMENT_FOR_TUPLE=Для кортежа допустимо только обычное присваивание := +BAD_FORMAT_STRING=Встречена неправильная форматная строка