Preprocessor removal (#3113)

* Remove preprocessor

* Delete preprocessor localization files

* Clean up code

* Remove adding directive in EXCLUDETEXT section

* Fix directive adding in EXCLUDETEXT

* Remove preprocessor leftovers

* More clean up

* Rename preprocessor to ifdef_directive

* Fix building tree for formatter variable assigning

* Restore convert4.exe

* Rework adding directive in EXCLUDETEXT

Более логично будет все-таки так.
This commit is contained in:
AlexanderZemlyak 2024-05-09 19:04:31 +03:00 committed by GitHub
parent 8add90aca0
commit a6a25d955d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 312 additions and 2311 deletions

View file

@ -73,7 +73,6 @@
<Compile Include="ParserTools\CommentBinder.cs" />
<Compile Include="ParserTools\DefaultLanguageInformation.cs" />
<Compile Include="ParserTools\Errors.cs" />
<Compile Include="ParserTools\IPreprocessor.cs" />
<Compile Include="ParserTools\KeyWord.cs" />
<Compile Include="ParserTools\ILanguageInformation.cs" />
<Compile Include="ParserTools\ParserTools.cs" />

View file

@ -218,11 +218,6 @@ namespace PascalABCCompiler.Parsers
// если нужно - переопределяйте
}
public virtual IPreprocessor Preprocessor
{
get { return null; }
}
public override string ToString()
{
return Name + " Language Parser v" + Version;

View file

@ -70,10 +70,6 @@ namespace PascalABCCompiler.Parsers
void Reset();
IPreprocessor Preprocessor
{
get;
}
}

View file

@ -1,24 +0,0 @@
// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Text;
using PascalABCCompiler.SyntaxTree;
using PascalABCCompiler.Errors;
namespace PascalABCCompiler.Parsers
{
public interface IPreprocessor
{
List<compiler_directive> CompilerDirectives
{
get;
}
/*SourceFilesProviderDelegate SourceFilesProvider
{
get;
set;
}*/
//string Build(string[] fileNames, List<Error> errors, ParserTools.SourceContextMap sourceContextMap);
}
}

View file

@ -2185,11 +2185,9 @@ if (parserTools.buildTreeForFormatter)
parserTools.ParseDirective(yytext, CurrentLexLocation, out var directiveName, out var directiveParams);
var orgDirectiveName = directiveName;
if (directiveName == null) // Ñ<>лÑ?Ñ?ай пÑ?Ñ<>Ñ?ой диÑ?екÑ?ивÑ?
if (directiveName == "") // сл<D181>?<3F>?ай п<>?с<>?ой ди<D0B4>?ек<D0B5>?ив<D0B8>?
break;
parserTools.CheckDirectiveParams(directiveName, directiveParams, CurrentLexLocation);
directiveName = directiveName.ToUpper();
if (directiveName == "HIDDENIDENTS")
@ -2249,6 +2247,7 @@ if (parserTools.buildTreeForFormatter)
if (Defines.Contains(directiveParams[0]))
Defines.Remove(directiveParams[0]);
}
parserTools.compilerDirectives.Add(new compiler_directive(new token_info(directiveName), new token_info(string.Join(" ", directiveParams)), CurrentLexLocation));
break;
case 64:
{
@ -2283,13 +2282,13 @@ BEGIN(INITIAL);
parserTools.ParseDirective(yytext, CurrentLexLocation, out directiveName, out directiveParams);
orgDirectiveName = directiveName;
if (directiveName == null) // Ñ<>лÑ?Ñ?ай пÑ?Ñ<>Ñ?ой диÑ?екÑ?ивÑ?
if (directiveName == "") // сл<D181>?<3F>?ай п<>?с<>?ой ди<D0B4>?ек<D0B5>?ив<D0B8>?
break;
parserTools.CheckDirectiveParams(directiveName, directiveParams, CurrentLexLocation);
directiveName = directiveName.ToUpper();
bool addDirective = true;
if (directiveName == "IFDEF")
{
IfDefInElseBranch.Push(false);
@ -2322,23 +2321,13 @@ parserTools.ParseDirective(yytext, CurrentLexLocation, out directiveName, out di
parserTools.AddWarningFromResource("DIFF_DEFINE_NAME", CurrentLexLocation, orgDirectiveName, define_name, directiveParams[0]);
IfExclude--;
if (IfExclude == 0)
BEGIN(INITIAL);
}
else if (IfExclude > 0)
{
int ind_to_remove = -1;
for (int i=0; i<parserTools.compilerDirectives.Count; i++)
{
if (parserTools.compilerDirectives[i].source_context.begin_position.line_num == CurrentLexLocation.StartLine &&
parserTools.compilerDirectives[i].source_context.begin_position.column_num - 2 == CurrentLexLocation.StartColumn + 1)
{
ind_to_remove = i;
break;
}
}
if (ind_to_remove != -1)
parserTools.compilerDirectives.RemoveAt(ind_to_remove);
BEGIN(INITIAL);
}
else
addDirective = false;
if (addDirective)
parserTools.compilerDirectives.Add(new compiler_directive(new token_info(directiveName), new token_info(string.Join(" ", directiveParams)), CurrentLexLocation));
break;
case 75:
{

View file

@ -73,11 +73,9 @@ UNICODEARROW \x890
parserTools.ParseDirective(yytext, CurrentLexLocation, out var directiveName, out var directiveParams);
var orgDirectiveName = directiveName;
if (directiveName == null) // случай пустой директивы
if (directiveName == "") // случай пустой директивы
break;
parserTools.CheckDirectiveParams(directiveName, directiveParams, CurrentLexLocation);
directiveName = directiveName.ToUpper();
if (directiveName == "HIDDENIDENTS")
@ -137,6 +135,7 @@ UNICODEARROW \x890
if (Defines.Contains(directiveParams[0]))
Defines.Remove(directiveParams[0]);
}
parserTools.compilerDirectives.Add(new compiler_directive(new token_info(directiveName), new token_info(string.Join(" ", directiveParams)), CurrentLexLocation));
}
<EXCLUDETEXT>{OneLineCmnt} {
@ -148,13 +147,13 @@ UNICODEARROW \x890
parserTools.ParseDirective(yytext, CurrentLexLocation, out directiveName, out directiveParams);
orgDirectiveName = directiveName;
if (directiveName == null) // случай пустой директивы
if (directiveName == "") // случай пустой директивы
break;
parserTools.CheckDirectiveParams(directiveName, directiveParams, CurrentLexLocation);
directiveName = directiveName.ToUpper();
bool addDirective = false;
if (directiveName == "IFDEF")
{
IfDefInElseBranch.Push(false);
@ -175,7 +174,11 @@ UNICODEARROW \x890
parserTools.AddErrorFromResource("UNNECESSARY $else",CurrentLexLocation);
IfDefInElseBranch.Push(true);
if (IfExclude == 1)
BEGIN(INITIAL);
{
BEGIN(INITIAL);
addDirective = true;
}
}
else if (directiveName == "ENDIF")
{
@ -187,24 +190,15 @@ UNICODEARROW \x890
parserTools.AddWarningFromResource("DIFF_DEFINE_NAME", CurrentLexLocation, orgDirectiveName, define_name, directiveParams[0]);
IfExclude--;
if (IfExclude == 0)
BEGIN(INITIAL);
{
BEGIN(INITIAL);
addDirective = true;
}
}
else if (IfExclude > 0)
{
int ind_to_remove = -1;
for (int i=0; i<parserTools.compilerDirectives.Count; i++)
{
if (parserTools.compilerDirectives[i].source_context.begin_position.line_num == CurrentLexLocation.StartLine &&
parserTools.compilerDirectives[i].source_context.begin_position.column_num - 2 == CurrentLexLocation.StartColumn + 1)
{
ind_to_remove = i;
break;
}
}
if (ind_to_remove != -1)
parserTools.compilerDirectives.RemoveAt(ind_to_remove);
}
if (addDirective)
parserTools.compilerDirectives.Add(new compiler_directive(new token_info(directiveName), new token_info(string.Join(" ", directiveParams)), CurrentLexLocation));
}
<EXCLUDETEXT>.|\n {

View file

@ -6,11 +6,8 @@
// Эти объявления добавляются в класс GPPGParser, представляющий собой парсер, генерируемый системой gppg
public syntax_tree_node root; // Корневой узел синтаксического дерева
public List<Error> errors;
public string current_file_name;
public int max_errors = 10;
public PascalParserTools parsertools;
public List<compiler_directive> CompilerDirectives;
public int maxErrors = 10;
public PascalParserTools parserTools;
public ParserLambdaHelper lambdaHelper = new ParserLambdaHelper();
public GPPGParser(AbstractScanner<PascalABCSavParser.Union, LexLocation> scanner) : base(scanner) { }
@ -260,12 +257,12 @@ head_compiler_directives
one_compiler_directive
: tkDirectiveName tkIdentifier
{
parsertools.AddErrorFromResource("UNSUPPORTED_OLD_DIRECTIVES",@$);
parserTools.AddErrorFromResource("UNSUPPORTED_OLD_DIRECTIVES",@$);
$$ = null;
}
| tkDirectiveName tkStringLiteral
{
parsertools.AddErrorFromResource("UNSUPPORTED_OLD_DIRECTIVES",@$);
parserTools.AddErrorFromResource("UNSUPPORTED_OLD_DIRECTIVES",@$);
$$ = null;
}
;
@ -357,7 +354,7 @@ uses_clause_one_or_empty
}
| uses_clause_one
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
$$ = new uses_closure($1 as uses_list,@$);
$$ = $1;
}
@ -370,7 +367,7 @@ uses_clause
}
| uses_clause uses_clause_one
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
{
if ($1 == null)
{
@ -970,7 +967,7 @@ const_factor
}
if (ui64 != null && ui64.val > (UInt64)Int64.MaxValue + 1)
{
parsertools.AddErrorFromResource("BAD_INT2",@$);
parserTools.AddErrorFromResource("BAD_INT2",@$);
break;
}
// можно сделать вычисление константы с вмонтированным минусом
@ -1022,7 +1019,7 @@ const_variable
{ $$ = $1; }
/* | tkRoundOpen const_expr tkRoundClose
{
if (!parsertools.buildTreeForFormatter)
if (!parserTools.buildTreeForFormatter)
{
$2.source_context = @$;
$$ = $2;
@ -1040,7 +1037,7 @@ const_variable
| const_variable tkSquareOpen format_const_expr tkSquareClose
{
var fe = $3 as format_expr;
if (!parsertools.buildTreeForFormatter)
if (!parserTools.buildTreeForFormatter)
{
if (fe.expr == null)
fe.expr = new int32_const(int.MaxValue,@3);
@ -1289,7 +1286,7 @@ type_decl_type
simple_type_question
: simple_type tkQuestion
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
{
$$ = $1;
}
@ -1303,7 +1300,7 @@ simple_type_question
}
| template_type tkQuestion
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
{
$$ = $1;
}
@ -1398,7 +1395,7 @@ template_param
{ $$ = $1; }
| simple_type tkQuestion
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
{
$$ = $1;
}
@ -1421,7 +1418,7 @@ template_param
simple_type
: range_expr
{
$$ = parsertools.ConvertDotNodeOrIdentToNamedTypeReference($1);
$$ = parserTools.ConvertDotNodeOrIdentToNamedTypeReference($1);
}
| range_expr tkDotDot range_expr
{
@ -1454,7 +1451,7 @@ range_term
range_factor
: simple_type_identifier
{
$$ = parsertools.ConvertNamedTypeReferenceToDotNodeOrIdent($1 as named_type_reference);
$$ = parserTools.ConvertNamedTypeReferenceToDotNodeOrIdent($1 as named_type_reference);
}
| unsigned_number
{ $$ = $1; }
@ -1701,7 +1698,7 @@ class_attributes1
| class_attributes1 class_attribute
{
if (((class_attribute)$1 & (class_attribute)$2) == (class_attribute)$2)
parsertools.AddErrorFromResource("ATTRIBUTE_REDECLARED",@2);
parserTools.AddErrorFromResource("ATTRIBUTE_REDECLARED",@2);
$$ = ((class_attribute)$1) | ((class_attribute)$2);
//$$ = $1;
}
@ -2068,7 +2065,7 @@ simple_property_definition
}
| class_or_static tkProperty func_name property_interface property_specifiers tkSemiColon property_modificator tkSemiColon array_defaultproperty
{
parsertools.AddErrorFromResource("STATIC_PROPERTIES_CANNOT_HAVE_ATTRBUTE_{0}",@7,$7.name);
parserTools.AddErrorFromResource("STATIC_PROPERTIES_CANNOT_HAVE_ATTRBUTE_{0}",@7,$7.name);
}
| tkAuto tkProperty func_name property_interface optional_property_initialization tkSemiColon
{
@ -2167,7 +2164,7 @@ property_specifiers
{
var id = NewId("#GetGen", @2);
procedure_definition pr = null;
if (!parsertools.buildTreeForFormatter)
if (!parserTools.buildTreeForFormatter)
pr = CreateAndAddToClassReadFunc($2, id, @2);
$$ = NewPropertySpecifiersRead($1, id, pr, $2, $3 as property_accessors, @$); // $2 передаётся для форматирования
}
@ -2188,9 +2185,9 @@ property_specifiers
{
var id = NewId("#SetGen", @2);
procedure_definition pr = null;
if (!parsertools.buildTreeForFormatter)
if (!parserTools.buildTreeForFormatter)
pr = CreateAndAddToClassWriteProc($2 as statement,id,@2);
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
$$ = NewPropertySpecifiersWrite($1, id, pr, $2 as statement, $3 as property_accessors, @$); // $2 передаётся для форматирования
else $$ = NewPropertySpecifiersWrite($1, id, pr, null, $3 as property_accessors, @$);
}
@ -2213,9 +2210,9 @@ write_property_specifiers
{
var id = NewId("#SetGen", @2);
procedure_definition pr = null;
if (!parsertools.buildTreeForFormatter)
if (!parserTools.buildTreeForFormatter)
pr = CreateAndAddToClassWriteProc($2 as statement,id,@2);
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
$$ = NewPropertySpecifiersWrite($1, id, pr, $2 as statement, null, @$);
else $$ = NewPropertySpecifiersWrite($1, id, pr, null, null, @$);
}
@ -2234,7 +2231,7 @@ read_property_specifiers
{
var id = NewId("#GetGen", @2);
procedure_definition pr = null;
if (!parsertools.buildTreeForFormatter)
if (!parserTools.buildTreeForFormatter)
pr = CreateAndAddToClassReadFunc($2,id,@2);
$$ = NewPropertySpecifiersRead($1, id, pr, $2, null, @$);
}
@ -2290,7 +2287,7 @@ typed_var_init_expression
{ $$ = $1; }
| const_simple_expr tkDotDot const_term // SSM 18/01/20
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
$$ = new diapason_expr($1,$3,@$);
else
$$ = new diapason_expr_new($1,$3,@$);
@ -2318,7 +2315,7 @@ typed_var_init_expression
for (int j = 0; j < cnt; j++)
{
if (!(el.expressions[j] is ident))
parsertools.AddErrorFromResource("ONE_TKIDENTIFIER",el.expressions[j].source_context);
parserTools.AddErrorFromResource("ONE_TKIDENTIFIER",el.expressions[j].source_context);
idList.idents.Add(el.expressions[j] as ident);
}
@ -2346,19 +2343,19 @@ constr_destr_decl
| tkConstructor optional_proc_name fp_list tkAssign unlabelled_stmt tkSemiColon
{
if ($5 is empty_statement)
parsertools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",@6);
parserTools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",@6);
var tmp = new constructor(null,$3 as formal_parameters,new procedure_attributes_list(new List<procedure_attribute>(),@$),$2 as method_name,false,false,null,null,LexLocation.MergeAll(@1,@2,@3));
$$ = new procedure_definition(tmp as procedure_header, new block(null,new statement_list($5 as statement,@5),@5), @1.Merge(@5));
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
$$ = new short_func_definition($$ as procedure_definition);
}
| class_or_static tkConstructor optional_proc_name fp_list tkAssign unlabelled_stmt tkSemiColon
{
if ($6 is empty_statement)
parsertools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",@7);
parserTools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",@7);
var tmp = new constructor(null,$4 as formal_parameters,new procedure_attributes_list(new List<procedure_attribute>(),@$),$3 as method_name,false,true,null,null,LexLocation.MergeAll(@1,@2,@3,@4));
$$ = new procedure_definition(tmp as procedure_header, new block(null,new statement_list($6 as statement,@6),@6), @1.Merge(@6));
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
$$ = new short_func_definition($$ as procedure_definition);
}
;
@ -2371,19 +2368,19 @@ inclass_constr_destr_decl
| tkConstructor optional_proc_name fp_list tkAssign unlabelled_stmt tkSemiColon
{
if ($5 is empty_statement)
parsertools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",@6);
parserTools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",@6);
var tmp = new constructor(null,$3 as formal_parameters,new procedure_attributes_list(new List<procedure_attribute>(),@$),$2 as method_name,false,false,null,null,LexLocation.MergeAll(@1,@2,@3));
$$ = new procedure_definition(tmp as procedure_header, new block(null,new statement_list($5 as statement,@5),@5), @1.Merge(@5));
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
$$ = new short_func_definition($$ as procedure_definition);
}
| class_or_static tkConstructor optional_proc_name fp_list tkAssign unlabelled_stmt tkSemiColon
{
if ($6 is empty_statement)
parsertools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",@7);
parserTools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",@7);
var tmp = new constructor(null,$4 as formal_parameters,new procedure_attributes_list(new List<procedure_attribute>(),@$),$3 as method_name,false,true,null,null,LexLocation.MergeAll(@1,@2,@3,@4));
$$ = new procedure_definition(tmp as procedure_header, new block(null,new statement_list($6 as statement,@6),@6), @1.Merge(@6));
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
$$ = new short_func_definition($$ as procedure_definition);
}
;
@ -2427,7 +2424,7 @@ proc_func_decl_noclass
| tkFunction func_name fp_list optional_method_modificators1 tkAssign expr_l1 tkSemiColon
{
if ($6 is dot_question_node)
parsertools.AddErrorFromResource("DOT_QUECTION_IN_SHORT_FUN",@6);
parserTools.AddErrorFromResource("DOT_QUECTION_IN_SHORT_FUN",@6);
$$ = SyntaxTreeBuilder.BuildShortFuncDefinition($3 as formal_parameters, $4 as procedure_attributes_list, $2 as method_name, null, $6, @1.Merge(@4));
}
@ -2442,7 +2439,7 @@ proc_func_decl_noclass
| tkProcedure proc_name fp_list optional_method_modificators1 tkAssign unlabelled_stmt tkSemiColon
{
if ($6 is empty_statement)
parsertools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",@6);
parserTools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",@6);
$$ = SyntaxTreeBuilder.BuildShortProcDefinition($3 as formal_parameters, $4 as procedure_attributes_list, $2 as method_name, $6 as statement, @1.Merge(@4));
}
| proc_func_header tkForward tkSemiColon
@ -2502,19 +2499,19 @@ inclass_proc_func_decl_noclass
| tkFunction func_name fp_list tkColon fptype optional_method_modificators1 tkAssign expr_l1_func_decl_lambda tkSemiColon
{
$$ = SyntaxTreeBuilder.BuildShortFuncDefinition($3 as formal_parameters, $6 as procedure_attributes_list, $2 as method_name, $5 as type_definition, $8, @1.Merge(@6));
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
$$ = new short_func_definition($$ as procedure_definition);
}
| tkFunction func_name fp_list optional_method_modificators1 tkAssign expr_l1_func_decl_lambda tkSemiColon
{
$$ = SyntaxTreeBuilder.BuildShortFuncDefinition($3 as formal_parameters, $4 as procedure_attributes_list, $2 as method_name, null, $6, @1.Merge(@4));
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
$$ = new short_func_definition($$ as procedure_definition);
}
| tkProcedure proc_name fp_list optional_method_modificators1 tkAssign unlabelled_stmt tkSemiColon
{
$$ = SyntaxTreeBuilder.BuildShortProcDefinition($3 as formal_parameters, $4 as procedure_attributes_list, $2 as method_name, $6 as statement, @1.Merge(@4));
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
$$ = new short_func_definition($$ as procedure_definition);
}
;
@ -2848,13 +2845,13 @@ assignment
: var_reference assign_operator expr_with_func_decl_lambda
{
if (!($1 is addressed_value))
parsertools.AddErrorFromResource("LEFT_SIDE_CANNOT_BE_ASSIGNED_TO",@$);
parserTools.AddErrorFromResource("LEFT_SIDE_CANNOT_BE_ASSIGNED_TO",@$);
$$ = new assign($1 as addressed_value, $3, $2.type, @$);
}
| tkRoundOpen variable tkComma variable_list tkRoundClose assign_operator expr
{
if ($6.type != Operators.Assignment)
parsertools.AddErrorFromResource("ONLY_BASE_ASSIGNMENT_FOR_TUPLE",@6);
parserTools.AddErrorFromResource("ONLY_BASE_ASSIGNMENT_FOR_TUPLE",@6);
($4 as addressed_value_list).Insert(0,$2 as addressed_value);
($4 as syntax_tree_node).source_context = LexLocation.MergeAll(@1,@2,@3,@4,@5);
$$ = new assign_tuple($4 as addressed_value_list, $7, @$);
@ -2862,7 +2859,7 @@ assignment
/* | variable tkQuestionSquareOpen format_expr tkSquareClose assign_operator expr
{
var fe = $3 as format_expr;
if (!parsertools.buildTreeForFormatter)
if (!parserTools.buildTreeForFormatter)
{
if (fe.expr == null)
fe.expr = new int32_const(int.MaxValue,@3);
@ -3113,7 +3110,7 @@ foreach_stmt
{
$$ = new foreach_stmt($2, $3, $5, $8 as statement, $6, @$);
if ($3 == null)
parsertools.AddWarningFromResource("USING_UNLOCAL_FOREACH_VARIABLE", $2.source_context);
parserTools.AddWarningFromResource("USING_UNLOCAL_FOREACH_VARIABLE", $2.source_context);
}
| tkForeach tkVar identifier optional_type_specification tkIn expr_l1 index_or_nothing tkDo unlabelled_stmt
{
@ -3123,7 +3120,7 @@ foreach_stmt
}
| tkForeach tkVar tkRoundOpen ident_list tkRoundClose tkIn expr_l1 index_or_nothing tkDo unlabelled_stmt // сахарное правило
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
{
var il = $4 as ident_list;
il.source_context = LexLocation.MergeAll(@4,@5); // нужно для форматирования
@ -3405,7 +3402,7 @@ question_expr
: expr_l1_for_question_expr tkQuestion expr_l1_for_question_expr tkColon expr_l1_for_question_expr
{
if ($3 is nil_const && $5 is nil_const)
parsertools.AddErrorFromResource("TWO_NILS_IN_QUESTION_EXPR",@3);
parserTools.AddErrorFromResource("TWO_NILS_IN_QUESTION_EXPR",@3);
$$ = new question_colon_expression($1, $3, $5, @$);
}
;
@ -3413,14 +3410,14 @@ question_expr
new_question_expr
: tkIf expr_l1_for_new_question_expr tkThen expr_l1_for_new_question_expr tkElse expr_l1_for_new_question_expr
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
{
$$ = new if_expr_new($2, $4, $6, @$);
}
else
{
if ($4 is nil_const && $6 is nil_const)
parsertools.AddErrorFromResource("TWO_NILS_IN_QUESTION_EXPR",@4);
parserTools.AddErrorFromResource("TWO_NILS_IN_QUESTION_EXPR",@4);
$$ = new question_colon_expression($2, $4, $6, @$);
}
}
@ -3486,7 +3483,7 @@ new_expr
var ac = $6 as array_const;
if (ac != null && ac.elements != null)
cnt = ac.elements.Count;
else parsertools.AddErrorFromResource("WITHOUT_INIT_AND_SIZE",@5);
else parserTools.AddErrorFromResource("WITHOUT_INIT_AND_SIZE",@5);
el = new expression_list(new int32_const(cnt),@1);
}
$$ = new new_expr($2, el, true, $6 as array_const, @$);
@ -3510,7 +3507,7 @@ field_in_unnamed_object
: identifier tkAssign expr_l1
{
if ($3 is nil_const)
parsertools.AddErrorFromResource("NIL_IN_UNNAMED_OBJECT",@$);
parserTools.AddErrorFromResource("NIL_IN_UNNAMED_OBJECT",@$);
$$ = new name_assign_expr($1,$3,@$);
}
| expr_l1
@ -3529,7 +3526,7 @@ field_in_unnamed_object
}
}
if (name == null)
parsertools.errors.Add(new bad_anon_type(parsertools.currentFileName, @1, null));
parserTools.errors.Add(new bad_anon_type(parserTools.currentFileName, @1, null));
$$ = new name_assign_expr(name,$1,@$);
}
;
@ -3545,7 +3542,7 @@ list_fields_in_unnamed_object
var nel = $1 as name_assign_expr_list;
var ss = nel.name_expr.Select(ne=>ne.name.name).FirstOrDefault(x=>string.Compare(x,($3 as name_assign_expr).name.name,true)==0);
if (ss != null)
parsertools.errors.Add(new anon_type_duplicate_name(parsertools.currentFileName, @3, null));
parserTools.errors.Add(new anon_type_duplicate_name(parserTools.currentFileName, @3, null));
nel.Add($3 as name_assign_expr);
$$ = $1;
}
@ -3722,7 +3719,7 @@ tuple_pattern
: tkRoundOpen tuple_pattern_item_list tkRoundClose
{
if (($2 as List<pattern_parameter>).Count>6)
parsertools.AddErrorFromResource("TUPLE_ELEMENTS_COUNT_MUST_BE_LESSEQUAL_7",@$);
parserTools.AddErrorFromResource("TUPLE_ELEMENTS_COUNT_MUST_BE_LESSEQUAL_7",@$);
$$ = new tuple_pattern($2 as List<pattern_parameter>, @$);
}
;
@ -3990,7 +3987,7 @@ relop
{ $$ = $1; }
| tkNot tkIn
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
$$ = $2;
else
{
@ -4005,7 +4002,7 @@ simple_expr
{ $$ = $1; }
| simple_expr tkDotDot term1
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
$$ = new diapason_expr($1,$3,@$);
else
$$ = new diapason_expr_new($1,$3,@$);
@ -4132,17 +4129,17 @@ tuple
: tkRoundOpen expr_l1_or_unpacked tkComma expr_l1_or_unpacked_list lambda_type_ref optional_full_lambda_fp_list tkRoundClose // lambda_type_ref optional_full_lambda_fp_list нужно оставить чтобы не было конфликтов с грамматикой лямбд
{
if ($2 is unpacked_list_of_ident_or_list)
parsertools.AddErrorFromResource("EXPRESSION_EXPECTED",@2);
parserTools.AddErrorFromResource("EXPRESSION_EXPECTED",@2);
foreach (var ex in ($4 as expression_list).expressions)
if (ex is unpacked_list_of_ident_or_list)
parsertools.AddErrorFromResource("EXPRESSION_EXPECTED",ex.source_context);
parserTools.AddErrorFromResource("EXPRESSION_EXPECTED",ex.source_context);
if (!($5 is lambda_inferred_type))
parsertools.AddErrorFromResource("BAD_TUPLE",@5);
parserTools.AddErrorFromResource("BAD_TUPLE",@5);
if ($6 != null)
parsertools.AddErrorFromResource("BAD_TUPLE",@6);
parserTools.AddErrorFromResource("BAD_TUPLE",@6);
if (($4 as expression_list).Count>6)
parsertools.AddErrorFromResource("TUPLE_ELEMENTS_COUNT_MUST_BE_LESSEQUAL_7",@$);
parserTools.AddErrorFromResource("TUPLE_ELEMENTS_COUNT_MUST_BE_LESSEQUAL_7",@$);
($4 as expression_list).Insert(0,$2);
$$ = new tuple_node($4 as expression_list,@$);
}
@ -4191,7 +4188,7 @@ factor
}
if (ui64 != null && ui64.val > (UInt64)Int64.MaxValue + 1)
{
parsertools.AddErrorFromResource("BAD_INT2",@$);
parserTools.AddErrorFromResource("BAD_INT2",@$);
break;
}
// можно сделать вычисление константы с вмонтированным минусом
@ -4271,7 +4268,7 @@ dotted_identifier
| dotted_identifier tkPoint identifier_or_keyword
{
if ($1 is index)
parsertools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}", @1, "^");
parserTools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}", @1, "^");
$$ = new dot_node($1 as addressed_value, $3 as addressed_value, @$);
}
;
@ -4312,7 +4309,7 @@ proc_func_call
: variable tkRoundOpen optional_expr_list_func_param tkRoundClose
{
if ($1 is index)
parsertools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}", @1, "^");
parserTools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}", @1, "^");
$$ = new method_call($1 as addressed_value,$3 as expression_list, @$);
}
;
@ -4328,7 +4325,7 @@ variable
}
| tkRoundOpen expr tkRoundClose
{
if (!parsertools.buildTreeForFormatter)
if (!parserTools.buildTreeForFormatter)
{
$2.source_context = @$;
$$ = $2;
@ -4337,7 +4334,7 @@ variable
}
| tkRoundOpen var_with_init_for_expr_with_let_list expr tkRoundClose
{
if (!parsertools.buildTreeForFormatter)
if (!parserTools.buildTreeForFormatter)
{
$3.source_context = @$;
$$ = $3;
@ -4351,7 +4348,7 @@ variable
| literal_or_number tkPoint identifier_or_keyword
{
if ($1 is index)
parsertools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}", @1, "^");
parserTools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}", @1, "^");
$$ = new dot_node($1 as addressed_value, $3 as addressed_value, @$);
}
| variable_or_literal_or_number tkSquareOpen expr_list tkSquareClose
@ -4360,7 +4357,7 @@ variable
if (el.Count==1 && el.expressions[0] is format_expr)
{
var fe = el.expressions[0] as format_expr;
if (!parsertools.buildTreeForFormatter)
if (!parserTools.buildTreeForFormatter)
{
if (fe.expr == null)
fe.expr = new int32_const(int.MaxValue,@3);
@ -4373,7 +4370,7 @@ variable
else if (el.expressions.Any(e => e is format_expr))
{
if (el.expressions.Count > 4)
parsertools.AddErrorFromResource("SLICES_OF MULTIDIMENSIONAL_ARRAYS_ALLOW_ONLY_FOR_RANK_LT_5",@$); // Срезы многомерных массивов разрешены только для массивов размерности < 5
parserTools.AddErrorFromResource("SLICES_OF MULTIDIMENSIONAL_ARRAYS_ALLOW_ONLY_FOR_RANK_LT_5",@$); // Срезы многомерных массивов разрешены только для массивов размерности < 5
var ll = new List<Tuple<expression, expression, expression>>();
foreach (var ex in el.expressions)
{
@ -4401,7 +4398,7 @@ variable
| variable_or_literal_or_number tkQuestionSquareOpen format_expr tkSquareClose
{
var fe = $3 as format_expr; // SSM 9/01/17
if (!parsertools.buildTreeForFormatter)
if (!parserTools.buildTreeForFormatter)
{
if (fe.expr == null)
fe.expr = new int32_const(int.MaxValue,@3);
@ -4419,7 +4416,7 @@ variable
| variable tkPoint identifier_keyword_operatorname
{
if ($1 is index)
parsertools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}", @1, "^");
parserTools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}", @1, "^");
$$ = new dot_node($1 as addressed_value, $3 as addressed_value, @$);
}
| tuple tkPoint identifier_keyword_operatorname
@ -4493,7 +4490,7 @@ literal
}
| tkFormatStringLiteral
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
{
$$ = $1 as string_const;
}
@ -4504,7 +4501,7 @@ literal
}
| tkMultilineStringLiteral
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
{
var sc = $1 as string_const;
sc.IsMultiline = true;
@ -4526,7 +4523,7 @@ literal_list
{
var line = $1 as literal_const_line;
if (line.literals.Last() is string_const && $2 is string_const)
parsertools.AddErrorFromResource("TWO_STRING_LITERALS_IN_SUCCESSION",@2);
parserTools.AddErrorFromResource("TWO_STRING_LITERALS_IN_SUCCESSION",@2);
$$ = line.Add($2 as literal, @$);
}
;
@ -4545,7 +4542,7 @@ optional_method_modificators
}
| tkSemiColon meth_modificators tkSemiColon
{
//parsertools.AddModifier((procedure_attributes_list)$2, proc_attribute.attr_overload);
//parserTools.AddModifier((procedure_attributes_list)$2, proc_attribute.attr_overload);
$$ = $2;
}
;
@ -4557,7 +4554,7 @@ optional_method_modificators1
}
| tkSemiColon meth_modificators
{
//parsertools.AddModifier((procedure_attributes_list)$2, proc_attribute.attr_overload);
//parserTools.AddModifier((procedure_attributes_list)$2, proc_attribute.attr_overload);
$$ = $2;
}
;
@ -4610,7 +4607,7 @@ meth_modificator
| tkOverload
{
$$ = $1;
parsertools.AddWarningFromResource("OVERLOAD_IS_NOT_USED", $1.source_context);
parserTools.AddWarningFromResource("OVERLOAD_IS_NOT_USED", $1.source_context);
}
| tkReintroduce
{ $$ = $1; }
@ -5035,7 +5032,7 @@ func_decl_lambda
{
if ($6 != null)
{
parsertools.AddErrorFromResource("SEMICOLON_IN_PARAMS",@6);
parserTools.AddErrorFromResource("SEMICOLON_IN_PARAMS",@6);
}
var lst_ex = new List<expression>();
@ -5059,7 +5056,7 @@ func_decl_lambda
var formal_pars = new formal_parameters();
var idd = $2 as ident;
if (idd==null)
parsertools.AddErrorFromResource("ONE_TKIDENTIFIER",@2);
parserTools.AddErrorFromResource("ONE_TKIDENTIFIER",@2);
var lambda_inf_type = new lambda_inferred_type(new lambda_any_type_node_syntax(), null);
var new_typed_pars = new typed_parameters(new ident_list(idd, idd.source_context), lambda_inf_type, parametr_kind.none, null, idd.source_context);
formal_pars.Add(new_typed_pars);
@ -5067,7 +5064,7 @@ func_decl_lambda
{
var idd1 = id as ident;
if (idd1==null)
parsertools.AddErrorFromResource("ONE_TKIDENTIFIER",id.source_context);
parserTools.AddErrorFromResource("ONE_TKIDENTIFIER",id.source_context);
lambda_inf_type = new lambda_inferred_type(new lambda_any_type_node_syntax(), null);
new_typed_pars = new typed_parameters(new ident_list(idd1, idd1.source_context), lambda_inf_type, parametr_kind.none, null, idd1.source_context);
@ -5090,7 +5087,7 @@ func_decl_lambda
var loc = LexLocation.MergeAll(@2,@3,@4);
var idd = $2 as ident;
if (idd==null)
parsertools.AddErrorFromResource("ONE_TKIDENTIFIER",@2);
parserTools.AddErrorFromResource("ONE_TKIDENTIFIER",@2);
var idList = new ident_list(idd, loc);
@ -5100,7 +5097,7 @@ func_decl_lambda
{
var idd2 = iddlist[j] as ident;
if (idd2==null)
parsertools.AddErrorFromResource("ONE_TKIDENTIFIER",idd2.source_context);
parserTools.AddErrorFromResource("ONE_TKIDENTIFIER",idd2.source_context);
idList.Add(idd2);
}
var parsType = $5;
@ -5277,7 +5274,7 @@ common_lambda_body
}
| yield_stmt
{
parsertools.AddErrorFromResource("YIELD_STATEMENT_CANNOT_BE_USED_IN_LAMBDA_BODY", @$);
parserTools.AddErrorFromResource("YIELD_STATEMENT_CANNOT_BE_USED_IN_LAMBDA_BODY", @$);
}
| tkRoundOpen assignment tkRoundClose
{
@ -5292,7 +5289,7 @@ lambda_function_body
var id = SyntaxVisitors.HasNameVisitor.HasName($1, "Result");
if (id != null)
{
parsertools.AddErrorFromResource("RESULT_IDENT_NOT_EXPECTED_IN_THIS_CONTEXT", id.source_context);
parserTools.AddErrorFromResource("RESULT_IDENT_NOT_EXPECTED_IN_THIS_CONTEXT", id.source_context);
}
var sl = new statement_list(new assign("result",$1,@$),@$); // надо помечать ещё и assign как автосгенерированный для лямбды - чтобы запретить явный Result
sl.expr_lambda_body = true;

View file

@ -5,9 +5,7 @@ using PascalABCCompiler.SyntaxTree;
using System;
using System.Linq;
using PascalABCCompiler.ParserTools;
using PascalABCCompiler.PascalABCNewParser;
using PascalABCCompiler.Parsers;
using System.Text.RegularExpressions;
namespace PascalABCSavParser
{
@ -137,6 +135,8 @@ namespace PascalABCSavParser
{
directiveParams = SplitDirectiveParamsOrdinary(paramsString);
}
CheckDirectiveParams(directiveName, directiveParams, location);
}
protected override string GetFromStringResources(string res)

View file

@ -60,19 +60,16 @@ public abstract class ScanBase : AbstractScanner<PascalABCSavParser.Union,LexLoc
public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, LexLocation>
{
// Verbatim content from D:\PABC_Git\Parsers\PascalABCParserNewSaushkin\ABCPascal.y
// Verbatim content from ABCPascal.y
// Э<>?и об<D0BE>?явления добавля<D0BB>?<3F>?ся в класс GPPGParser, п<>?едс<D0B4>?авля<D0BB>?<3F>?ий собой па<D0BF>?се<D181>?, гене<D0BD>?и<>?<3F>?ем<D0B5>?й сис<D0B8>?емой gppg
public syntax_tree_node root; // <20>?о<>?невой <20>?зел син<D0B8>?акси<D181>?еского де<D0B4>?ева
public List<Error> errors;
public string current_file_name;
public int max_errors = 10;
public PascalParserTools parsertools;
public List<compiler_directive> CompilerDirectives;
public int maxErrors = 10;
public PascalParserTools parserTools;
public ParserLambdaHelper lambdaHelper = new ParserLambdaHelper();
public GPPGParser(AbstractScanner<PascalABCSavParser.Union, LexLocation> scanner) : base(scanner) { }
// End verbatim content from D:\PABC_Git\Parsers\PascalABCParserNewSaushkin\ABCPascal.y
// End verbatim content from ABCPascal.y
#pragma warning disable 649
private static Dictionary<int, string> aliasses;
@ -2991,13 +2988,13 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
break;
case 18: // one_compiler_directive -> tkDirectiveName, tkIdentifier
{
parsertools.AddErrorFromResource("UNSUPPORTED_OLD_DIRECTIVES",CurrentLocationSpan);
parserTools.AddErrorFromResource("UNSUPPORTED_OLD_DIRECTIVES",CurrentLocationSpan);
CurrentSemanticValue.ob = null;
}
break;
case 19: // one_compiler_directive -> tkDirectiveName, tkStringLiteral
{
parsertools.AddErrorFromResource("UNSUPPORTED_OLD_DIRECTIVES",CurrentLocationSpan);
parserTools.AddErrorFromResource("UNSUPPORTED_OLD_DIRECTIVES",CurrentLocationSpan);
CurrentSemanticValue.ob = null;
}
break;
@ -3075,7 +3072,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
break;
case 40: // uses_clause_one_or_empty -> uses_clause_one
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
CurrentSemanticValue.stn = new uses_closure(ValueStack[ValueStack.Depth-1].stn as uses_list,CurrentLocationSpan);
CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn;
}
@ -3087,7 +3084,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
break;
case 42: // uses_clause -> uses_clause, uses_clause_one
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
{
if (ValueStack[ValueStack.Depth-2].stn == null)
{
@ -3649,7 +3646,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
}
if (ui64 != null && ui64.val > (UInt64)Int64.MaxValue + 1)
{
parsertools.AddErrorFromResource("BAD_INT2",CurrentLocationSpan);
parserTools.AddErrorFromResource("BAD_INT2",CurrentLocationSpan);
break;
}
// можно сдела<D0BB>?<3F>? в<>?<3F>?исление конс<D0BD>?ан<D0B0>?<3F>? с вмон<D0BE>?и<>?ованн<D0BD>?м мин<D0B8>?сом
@ -3713,7 +3710,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
// tkSquareClose
{
var fe = ValueStack[ValueStack.Depth-2].ex as format_expr;
if (!parsertools.buildTreeForFormatter)
if (!parserTools.buildTreeForFormatter)
{
if (fe.expr == null)
fe.expr = new int32_const(int.MaxValue,LocationStack[LocationStack.Depth-2]);
@ -3917,7 +3914,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
break;
case 224: // simple_type_question -> simple_type, tkQuestion
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
{
CurrentSemanticValue.td = ValueStack[ValueStack.Depth-2].td;
}
@ -3932,7 +3929,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
break;
case 225: // simple_type_question -> template_type, tkQuestion
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
{
CurrentSemanticValue.td = ValueStack[ValueStack.Depth-2].td;
}
@ -4022,7 +4019,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
break;
case 243: // template_param -> simple_type, tkQuestion
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
{
CurrentSemanticValue.td = ValueStack[ValueStack.Depth-2].td;
}
@ -4046,7 +4043,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
break;
case 247: // simple_type -> range_expr
{
CurrentSemanticValue.td = parsertools.ConvertDotNodeOrIdentToNamedTypeReference(ValueStack[ValueStack.Depth-1].ex);
CurrentSemanticValue.td = parserTools.ConvertDotNodeOrIdentToNamedTypeReference(ValueStack[ValueStack.Depth-1].ex);
}
break;
case 248: // simple_type -> range_expr, tkDotDot, range_expr
@ -4077,7 +4074,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
break;
case 254: // range_factor -> simple_type_identifier
{
CurrentSemanticValue.ex = parsertools.ConvertNamedTypeReferenceToDotNodeOrIdent(ValueStack[ValueStack.Depth-1].td as named_type_reference);
CurrentSemanticValue.ex = parserTools.ConvertNamedTypeReferenceToDotNodeOrIdent(ValueStack[ValueStack.Depth-1].td as named_type_reference);
}
break;
case 255: // range_factor -> unsigned_number
@ -4315,7 +4312,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
case 305: // class_attributes1 -> class_attributes1, class_attribute
{
if (((class_attribute)ValueStack[ValueStack.Depth-2].ob & (class_attribute)ValueStack[ValueStack.Depth-1].ob) == (class_attribute)ValueStack[ValueStack.Depth-1].ob)
parsertools.AddErrorFromResource("ATTRIBUTE_REDECLARED",LocationStack[LocationStack.Depth-1]);
parserTools.AddErrorFromResource("ATTRIBUTE_REDECLARED",LocationStack[LocationStack.Depth-1]);
CurrentSemanticValue.ob = ((class_attribute)ValueStack[ValueStack.Depth-2].ob) | ((class_attribute)ValueStack[ValueStack.Depth-1].ob);
//$$ = $1;
}
@ -4678,7 +4675,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
// tkSemiColon, property_modificator, tkSemiColon,
// array_defaultproperty
{
parsertools.AddErrorFromResource("STATIC_PROPERTIES_CANNOT_HAVE_ATTRBUTE_{0}",LocationStack[LocationStack.Depth-3],ValueStack[ValueStack.Depth-3].id.name);
parserTools.AddErrorFromResource("STATIC_PROPERTIES_CANNOT_HAVE_ATTRBUTE_{0}",LocationStack[LocationStack.Depth-3],ValueStack[ValueStack.Depth-3].id.name);
}
break;
case 382: // simple_property_definition -> tkAuto, tkProperty, func_name, property_interface,
@ -4756,7 +4753,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
{
var id = NewId("#GetGen", LocationStack[LocationStack.Depth-2]);
procedure_definition pr = null;
if (!parsertools.buildTreeForFormatter)
if (!parserTools.buildTreeForFormatter)
pr = CreateAndAddToClassReadFunc(ValueStack[ValueStack.Depth-2].ex, id, LocationStack[LocationStack.Depth-2]);
CurrentSemanticValue.stn = NewPropertySpecifiersRead(ValueStack[ValueStack.Depth-3].id, id, pr, ValueStack[ValueStack.Depth-2].ex, ValueStack[ValueStack.Depth-1].stn as property_accessors, CurrentLocationSpan); // $2 пе<D0BF>?еда<D0B4>?<3F>?ся для <20>?о<>?ма<D0BC>?и<>?ования
}
@ -4778,9 +4775,9 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
{
var id = NewId("#SetGen", LocationStack[LocationStack.Depth-2]);
procedure_definition pr = null;
if (!parsertools.buildTreeForFormatter)
if (!parserTools.buildTreeForFormatter)
pr = CreateAndAddToClassWriteProc(ValueStack[ValueStack.Depth-2].stn as statement,id,LocationStack[LocationStack.Depth-2]);
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
CurrentSemanticValue.stn = NewPropertySpecifiersWrite(ValueStack[ValueStack.Depth-3].id, id, pr, ValueStack[ValueStack.Depth-2].stn as statement, ValueStack[ValueStack.Depth-1].stn as property_accessors, CurrentLocationSpan); // $2 пе<D0BF>?еда<D0B4>?<3F>?ся для <20>?о<>?ма<D0BC>?и<>?ования
else CurrentSemanticValue.stn = NewPropertySpecifiersWrite(ValueStack[ValueStack.Depth-3].id, id, pr, null, ValueStack[ValueStack.Depth-1].stn as property_accessors, CurrentLocationSpan);
}
@ -4801,9 +4798,9 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
{
var id = NewId("#SetGen", LocationStack[LocationStack.Depth-1]);
procedure_definition pr = null;
if (!parsertools.buildTreeForFormatter)
if (!parserTools.buildTreeForFormatter)
pr = CreateAndAddToClassWriteProc(ValueStack[ValueStack.Depth-1].stn as statement,id,LocationStack[LocationStack.Depth-1]);
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
CurrentSemanticValue.stn = NewPropertySpecifiersWrite(ValueStack[ValueStack.Depth-2].id, id, pr, ValueStack[ValueStack.Depth-1].stn as statement, null, CurrentLocationSpan);
else CurrentSemanticValue.stn = NewPropertySpecifiersWrite(ValueStack[ValueStack.Depth-2].id, id, pr, null, null, CurrentLocationSpan);
}
@ -4819,7 +4816,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
{
var id = NewId("#GetGen", LocationStack[LocationStack.Depth-1]);
procedure_definition pr = null;
if (!parsertools.buildTreeForFormatter)
if (!parserTools.buildTreeForFormatter)
pr = CreateAndAddToClassReadFunc(ValueStack[ValueStack.Depth-1].ex,id,LocationStack[LocationStack.Depth-1]);
CurrentSemanticValue.stn = NewPropertySpecifiersRead(ValueStack[ValueStack.Depth-2].id, id, pr, ValueStack[ValueStack.Depth-1].ex, null, CurrentLocationSpan);
}
@ -4849,7 +4846,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
break;
case 410: // typed_var_init_expression -> const_simple_expr, tkDotDot, const_term
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
CurrentSemanticValue.ex = new diapason_expr(ValueStack[ValueStack.Depth-3].ex,ValueStack[ValueStack.Depth-1].ex,CurrentLocationSpan);
else
CurrentSemanticValue.ex = new diapason_expr_new(ValueStack[ValueStack.Depth-3].ex,ValueStack[ValueStack.Depth-1].ex,CurrentLocationSpan);
@ -4883,7 +4880,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
for (int j = 0; j < cnt; j++)
{
if (!(el.expressions[j] is ident))
parsertools.AddErrorFromResource("ONE_TKIDENTIFIER",el.expressions[j].source_context);
parserTools.AddErrorFromResource("ONE_TKIDENTIFIER",el.expressions[j].source_context);
idList.idents.Add(el.expressions[j] as ident);
}
@ -4908,10 +4905,10 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
// unlabelled_stmt, tkSemiColon
{
if (ValueStack[ValueStack.Depth-2].stn is empty_statement)
parsertools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",LocationStack[LocationStack.Depth-1]);
parserTools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",LocationStack[LocationStack.Depth-1]);
var tmp = new constructor(null,ValueStack[ValueStack.Depth-4].stn as formal_parameters,new procedure_attributes_list(new List<procedure_attribute>(),CurrentLocationSpan),ValueStack[ValueStack.Depth-5].stn as method_name,false,false,null,null,LexLocation.MergeAll(LocationStack[LocationStack.Depth-6],LocationStack[LocationStack.Depth-5],LocationStack[LocationStack.Depth-4]));
CurrentSemanticValue.stn = new procedure_definition(tmp as procedure_header, new block(null,new statement_list(ValueStack[ValueStack.Depth-2].stn as statement,LocationStack[LocationStack.Depth-2]),LocationStack[LocationStack.Depth-2]), LocationStack[LocationStack.Depth-6].Merge(LocationStack[LocationStack.Depth-2]));
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
CurrentSemanticValue.stn = new short_func_definition(CurrentSemanticValue.stn as procedure_definition);
}
break;
@ -4919,10 +4916,10 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
// fp_list, tkAssign, unlabelled_stmt, tkSemiColon
{
if (ValueStack[ValueStack.Depth-2].stn is empty_statement)
parsertools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",LocationStack[LocationStack.Depth-1]);
parserTools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",LocationStack[LocationStack.Depth-1]);
var tmp = new constructor(null,ValueStack[ValueStack.Depth-4].stn as formal_parameters,new procedure_attributes_list(new List<procedure_attribute>(),CurrentLocationSpan),ValueStack[ValueStack.Depth-5].stn as method_name,false,true,null,null,LexLocation.MergeAll(LocationStack[LocationStack.Depth-7],LocationStack[LocationStack.Depth-6],LocationStack[LocationStack.Depth-5],LocationStack[LocationStack.Depth-4]));
CurrentSemanticValue.stn = new procedure_definition(tmp as procedure_header, new block(null,new statement_list(ValueStack[ValueStack.Depth-2].stn as statement,LocationStack[LocationStack.Depth-2]),LocationStack[LocationStack.Depth-2]), LocationStack[LocationStack.Depth-7].Merge(LocationStack[LocationStack.Depth-2]));
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
CurrentSemanticValue.stn = new short_func_definition(CurrentSemanticValue.stn as procedure_definition);
}
break;
@ -4935,10 +4932,10 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
// tkAssign, unlabelled_stmt, tkSemiColon
{
if (ValueStack[ValueStack.Depth-2].stn is empty_statement)
parsertools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",LocationStack[LocationStack.Depth-1]);
parserTools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",LocationStack[LocationStack.Depth-1]);
var tmp = new constructor(null,ValueStack[ValueStack.Depth-4].stn as formal_parameters,new procedure_attributes_list(new List<procedure_attribute>(),CurrentLocationSpan),ValueStack[ValueStack.Depth-5].stn as method_name,false,false,null,null,LexLocation.MergeAll(LocationStack[LocationStack.Depth-6],LocationStack[LocationStack.Depth-5],LocationStack[LocationStack.Depth-4]));
CurrentSemanticValue.stn = new procedure_definition(tmp as procedure_header, new block(null,new statement_list(ValueStack[ValueStack.Depth-2].stn as statement,LocationStack[LocationStack.Depth-2]),LocationStack[LocationStack.Depth-2]), LocationStack[LocationStack.Depth-6].Merge(LocationStack[LocationStack.Depth-2]));
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
CurrentSemanticValue.stn = new short_func_definition(CurrentSemanticValue.stn as procedure_definition);
}
break;
@ -4946,10 +4943,10 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
// fp_list, tkAssign, unlabelled_stmt, tkSemiColon
{
if (ValueStack[ValueStack.Depth-2].stn is empty_statement)
parsertools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",LocationStack[LocationStack.Depth-1]);
parserTools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",LocationStack[LocationStack.Depth-1]);
var tmp = new constructor(null,ValueStack[ValueStack.Depth-4].stn as formal_parameters,new procedure_attributes_list(new List<procedure_attribute>(),CurrentLocationSpan),ValueStack[ValueStack.Depth-5].stn as method_name,false,true,null,null,LexLocation.MergeAll(LocationStack[LocationStack.Depth-7],LocationStack[LocationStack.Depth-6],LocationStack[LocationStack.Depth-5],LocationStack[LocationStack.Depth-4]));
CurrentSemanticValue.stn = new procedure_definition(tmp as procedure_header, new block(null,new statement_list(ValueStack[ValueStack.Depth-2].stn as statement,LocationStack[LocationStack.Depth-2]),LocationStack[LocationStack.Depth-2]), LocationStack[LocationStack.Depth-7].Merge(LocationStack[LocationStack.Depth-2]));
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
CurrentSemanticValue.stn = new short_func_definition(CurrentSemanticValue.stn as procedure_definition);
}
break;
@ -4999,7 +4996,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
// tkSemiColon
{
if (ValueStack[ValueStack.Depth-2].ex is dot_question_node)
parsertools.AddErrorFromResource("DOT_QUECTION_IN_SHORT_FUN",LocationStack[LocationStack.Depth-2]);
parserTools.AddErrorFromResource("DOT_QUECTION_IN_SHORT_FUN",LocationStack[LocationStack.Depth-2]);
CurrentSemanticValue.stn = SyntaxTreeBuilder.BuildShortFuncDefinition(ValueStack[ValueStack.Depth-5].stn as formal_parameters, ValueStack[ValueStack.Depth-4].stn as procedure_attributes_list, ValueStack[ValueStack.Depth-6].stn as method_name, null, ValueStack[ValueStack.Depth-2].ex, LocationStack[LocationStack.Depth-7].Merge(LocationStack[LocationStack.Depth-4]));
}
@ -5023,7 +5020,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
// unlabelled_stmt, tkSemiColon
{
if (ValueStack[ValueStack.Depth-2].stn is empty_statement)
parsertools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",LocationStack[LocationStack.Depth-2]);
parserTools.AddErrorFromResource("EMPTY_STATEMENT_IN_SHORT_PROC_DEFINITION",LocationStack[LocationStack.Depth-2]);
CurrentSemanticValue.stn = SyntaxTreeBuilder.BuildShortProcDefinition(ValueStack[ValueStack.Depth-5].stn as formal_parameters, ValueStack[ValueStack.Depth-4].stn as procedure_attributes_list, ValueStack[ValueStack.Depth-6].stn as method_name, ValueStack[ValueStack.Depth-2].stn as statement, LocationStack[LocationStack.Depth-7].Merge(LocationStack[LocationStack.Depth-4]));
}
break;
@ -5086,7 +5083,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
// tkSemiColon
{
CurrentSemanticValue.stn = SyntaxTreeBuilder.BuildShortFuncDefinition(ValueStack[ValueStack.Depth-7].stn as formal_parameters, ValueStack[ValueStack.Depth-4].stn as procedure_attributes_list, ValueStack[ValueStack.Depth-8].stn as method_name, ValueStack[ValueStack.Depth-5].td as type_definition, ValueStack[ValueStack.Depth-2].ex, LocationStack[LocationStack.Depth-9].Merge(LocationStack[LocationStack.Depth-4]));
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
CurrentSemanticValue.stn = new short_func_definition(CurrentSemanticValue.stn as procedure_definition);
}
break;
@ -5095,7 +5092,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
// expr_l1_func_decl_lambda, tkSemiColon
{
CurrentSemanticValue.stn = SyntaxTreeBuilder.BuildShortFuncDefinition(ValueStack[ValueStack.Depth-5].stn as formal_parameters, ValueStack[ValueStack.Depth-4].stn as procedure_attributes_list, ValueStack[ValueStack.Depth-6].stn as method_name, null, ValueStack[ValueStack.Depth-2].ex, LocationStack[LocationStack.Depth-7].Merge(LocationStack[LocationStack.Depth-4]));
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
CurrentSemanticValue.stn = new short_func_definition(CurrentSemanticValue.stn as procedure_definition);
}
break;
@ -5104,7 +5101,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
// unlabelled_stmt, tkSemiColon
{
CurrentSemanticValue.stn = SyntaxTreeBuilder.BuildShortProcDefinition(ValueStack[ValueStack.Depth-5].stn as formal_parameters, ValueStack[ValueStack.Depth-4].stn as procedure_attributes_list, ValueStack[ValueStack.Depth-6].stn as method_name, ValueStack[ValueStack.Depth-2].stn as statement, LocationStack[LocationStack.Depth-7].Merge(LocationStack[LocationStack.Depth-4]));
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
CurrentSemanticValue.stn = new short_func_definition(CurrentSemanticValue.stn as procedure_definition);
}
break;
@ -5434,7 +5431,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
case 521: // assignment -> var_reference, assign_operator, expr_with_func_decl_lambda
{
if (!(ValueStack[ValueStack.Depth-3].ex is addressed_value))
parsertools.AddErrorFromResource("LEFT_SIDE_CANNOT_BE_ASSIGNED_TO",CurrentLocationSpan);
parserTools.AddErrorFromResource("LEFT_SIDE_CANNOT_BE_ASSIGNED_TO",CurrentLocationSpan);
CurrentSemanticValue.stn = new assign(ValueStack[ValueStack.Depth-3].ex as addressed_value, ValueStack[ValueStack.Depth-1].ex, ValueStack[ValueStack.Depth-2].op.type, CurrentLocationSpan);
}
break;
@ -5442,7 +5439,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
// assign_operator, expr
{
if (ValueStack[ValueStack.Depth-2].op.type != Operators.Assignment)
parsertools.AddErrorFromResource("ONLY_BASE_ASSIGNMENT_FOR_TUPLE",LocationStack[LocationStack.Depth-2]);
parserTools.AddErrorFromResource("ONLY_BASE_ASSIGNMENT_FOR_TUPLE",LocationStack[LocationStack.Depth-2]);
(ValueStack[ValueStack.Depth-4].ob as addressed_value_list).Insert(0,ValueStack[ValueStack.Depth-6].ex as addressed_value);
(ValueStack[ValueStack.Depth-4].ob as syntax_tree_node).source_context = LexLocation.MergeAll(LocationStack[LocationStack.Depth-7],LocationStack[LocationStack.Depth-6],LocationStack[LocationStack.Depth-5],LocationStack[LocationStack.Depth-4],LocationStack[LocationStack.Depth-3]);
CurrentSemanticValue.stn = new assign_tuple(ValueStack[ValueStack.Depth-4].ob as addressed_value_list, ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan);
@ -5660,7 +5657,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
{
CurrentSemanticValue.stn = new foreach_stmt(ValueStack[ValueStack.Depth-7].id, ValueStack[ValueStack.Depth-6].td, ValueStack[ValueStack.Depth-4].ex, ValueStack[ValueStack.Depth-1].stn as statement, ValueStack[ValueStack.Depth-3].id, CurrentLocationSpan);
if (ValueStack[ValueStack.Depth-6].td == null)
parsertools.AddWarningFromResource("USING_UNLOCAL_FOREACH_VARIABLE", ValueStack[ValueStack.Depth-7].id.source_context);
parserTools.AddWarningFromResource("USING_UNLOCAL_FOREACH_VARIABLE", ValueStack[ValueStack.Depth-7].id.source_context);
}
break;
case 568: // foreach_stmt -> tkForeach, tkVar, identifier, optional_type_specification, tkIn,
@ -5674,7 +5671,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
case 569: // foreach_stmt -> tkForeach, tkVar, tkRoundOpen, ident_list, tkRoundClose, tkIn,
// expr_l1, index_or_nothing, tkDo, unlabelled_stmt
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
{
var il = ValueStack[ValueStack.Depth-7].stn as ident_list;
il.source_context = LexLocation.MergeAll(LocationStack[LocationStack.Depth-7],LocationStack[LocationStack.Depth-6]); // н<>?жно для <20>?о<>?ма<D0BC>?и<>?ования
@ -5934,7 +5931,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
// expr_l1_for_question_expr
{
if (ValueStack[ValueStack.Depth-3].ex is nil_const && ValueStack[ValueStack.Depth-1].ex is nil_const)
parsertools.AddErrorFromResource("TWO_NILS_IN_QUESTION_EXPR",LocationStack[LocationStack.Depth-3]);
parserTools.AddErrorFromResource("TWO_NILS_IN_QUESTION_EXPR",LocationStack[LocationStack.Depth-3]);
CurrentSemanticValue.ex = new question_colon_expression(ValueStack[ValueStack.Depth-5].ex, ValueStack[ValueStack.Depth-3].ex, ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan);
}
break;
@ -5942,14 +5939,14 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
// expr_l1_for_new_question_expr, tkElse,
// expr_l1_for_new_question_expr
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
{
CurrentSemanticValue.ex = new if_expr_new(ValueStack[ValueStack.Depth-5].ex, ValueStack[ValueStack.Depth-3].ex, ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan);
}
else
{
if (ValueStack[ValueStack.Depth-3].ex is nil_const && ValueStack[ValueStack.Depth-1].ex is nil_const)
parsertools.AddErrorFromResource("TWO_NILS_IN_QUESTION_EXPR",LocationStack[LocationStack.Depth-3]);
parserTools.AddErrorFromResource("TWO_NILS_IN_QUESTION_EXPR",LocationStack[LocationStack.Depth-3]);
CurrentSemanticValue.ex = new question_colon_expression(ValueStack[ValueStack.Depth-5].ex, ValueStack[ValueStack.Depth-3].ex, ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan);
}
}
@ -6015,7 +6012,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
var ac = ValueStack[ValueStack.Depth-1].stn as array_const;
if (ac != null && ac.elements != null)
cnt = ac.elements.Count;
else parsertools.AddErrorFromResource("WITHOUT_INIT_AND_SIZE",LocationStack[LocationStack.Depth-2]);
else parserTools.AddErrorFromResource("WITHOUT_INIT_AND_SIZE",LocationStack[LocationStack.Depth-2]);
el = new expression_list(new int32_const(cnt),LocationStack[LocationStack.Depth-6]);
}
CurrentSemanticValue.ex = new new_expr(ValueStack[ValueStack.Depth-5].td, el, true, ValueStack[ValueStack.Depth-1].stn as array_const, CurrentLocationSpan);
@ -6039,7 +6036,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
case 638: // field_in_unnamed_object -> identifier, tkAssign, expr_l1
{
if (ValueStack[ValueStack.Depth-1].ex is nil_const)
parsertools.AddErrorFromResource("NIL_IN_UNNAMED_OBJECT",CurrentLocationSpan);
parserTools.AddErrorFromResource("NIL_IN_UNNAMED_OBJECT",CurrentLocationSpan);
CurrentSemanticValue.ob = new name_assign_expr(ValueStack[ValueStack.Depth-3].id,ValueStack[ValueStack.Depth-1].ex,CurrentLocationSpan);
}
break;
@ -6059,7 +6056,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
}
}
if (name == null)
parsertools.errors.Add(new bad_anon_type(parsertools.currentFileName, LocationStack[LocationStack.Depth-1], null));
parserTools.errors.Add(new bad_anon_type(parserTools.currentFileName, LocationStack[LocationStack.Depth-1], null));
CurrentSemanticValue.ob = new name_assign_expr(name,ValueStack[ValueStack.Depth-1].ex,CurrentLocationSpan);
}
break;
@ -6075,7 +6072,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
var nel = ValueStack[ValueStack.Depth-3].ob as name_assign_expr_list;
var ss = nel.name_expr.Select(ne=>ne.name.name).FirstOrDefault(x=>string.Compare(x,(ValueStack[ValueStack.Depth-1].ob as name_assign_expr).name.name,true)==0);
if (ss != null)
parsertools.errors.Add(new anon_type_duplicate_name(parsertools.currentFileName, LocationStack[LocationStack.Depth-1], null));
parserTools.errors.Add(new anon_type_duplicate_name(parserTools.currentFileName, LocationStack[LocationStack.Depth-1], null));
nel.Add(ValueStack[ValueStack.Depth-1].ob as name_assign_expr);
CurrentSemanticValue.ob = ValueStack[ValueStack.Depth-3].ob;
}
@ -6232,7 +6229,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
case 670: // tuple_pattern -> tkRoundOpen, tuple_pattern_item_list, tkRoundClose
{
if ((ValueStack[ValueStack.Depth-2].ob as List<pattern_parameter>).Count>6)
parsertools.AddErrorFromResource("TUPLE_ELEMENTS_COUNT_MUST_BE_LESSEQUAL_7",CurrentLocationSpan);
parserTools.AddErrorFromResource("TUPLE_ELEMENTS_COUNT_MUST_BE_LESSEQUAL_7",CurrentLocationSpan);
CurrentSemanticValue.stn = new tuple_pattern(ValueStack[ValueStack.Depth-2].ob as List<pattern_parameter>, CurrentLocationSpan);
}
break;
@ -6499,7 +6496,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
break;
case 722: // relop -> tkNot, tkIn
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op;
else
{
@ -6513,7 +6510,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
break;
case 724: // simple_expr -> simple_expr, tkDotDot, term1
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
CurrentSemanticValue.ex = new diapason_expr(ValueStack[ValueStack.Depth-3].ex,ValueStack[ValueStack.Depth-1].ex,CurrentLocationSpan);
else
CurrentSemanticValue.ex = new diapason_expr_new(ValueStack[ValueStack.Depth-3].ex,ValueStack[ValueStack.Depth-1].ex,CurrentLocationSpan);
@ -6644,17 +6641,17 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
// lambda_type_ref, optional_full_lambda_fp_list, tkRoundClose
{
if (ValueStack[ValueStack.Depth-6].ex is unpacked_list_of_ident_or_list)
parsertools.AddErrorFromResource("EXPRESSION_EXPECTED",LocationStack[LocationStack.Depth-6]);
parserTools.AddErrorFromResource("EXPRESSION_EXPECTED",LocationStack[LocationStack.Depth-6]);
foreach (var ex in (ValueStack[ValueStack.Depth-4].stn as expression_list).expressions)
if (ex is unpacked_list_of_ident_or_list)
parsertools.AddErrorFromResource("EXPRESSION_EXPECTED",ex.source_context);
parserTools.AddErrorFromResource("EXPRESSION_EXPECTED",ex.source_context);
if (!(ValueStack[ValueStack.Depth-3].td is lambda_inferred_type))
parsertools.AddErrorFromResource("BAD_TUPLE",LocationStack[LocationStack.Depth-3]);
parserTools.AddErrorFromResource("BAD_TUPLE",LocationStack[LocationStack.Depth-3]);
if (ValueStack[ValueStack.Depth-2].stn != null)
parsertools.AddErrorFromResource("BAD_TUPLE",LocationStack[LocationStack.Depth-2]);
parserTools.AddErrorFromResource("BAD_TUPLE",LocationStack[LocationStack.Depth-2]);
if ((ValueStack[ValueStack.Depth-4].stn as expression_list).Count>6)
parsertools.AddErrorFromResource("TUPLE_ELEMENTS_COUNT_MUST_BE_LESSEQUAL_7",CurrentLocationSpan);
parserTools.AddErrorFromResource("TUPLE_ELEMENTS_COUNT_MUST_BE_LESSEQUAL_7",CurrentLocationSpan);
(ValueStack[ValueStack.Depth-4].stn as expression_list).Insert(0,ValueStack[ValueStack.Depth-6].ex);
CurrentSemanticValue.ex = new tuple_node(ValueStack[ValueStack.Depth-4].stn as expression_list,CurrentLocationSpan);
}
@ -6705,7 +6702,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
}
if (ui64 != null && ui64.val > (UInt64)Int64.MaxValue + 1)
{
parsertools.AddErrorFromResource("BAD_INT2",CurrentLocationSpan);
parserTools.AddErrorFromResource("BAD_INT2",CurrentLocationSpan);
break;
}
// можно сдела<D0BB>?<3F>? в<>?<3F>?исление конс<D0BD>?ан<D0B0>?<3F>? с вмон<D0BE>?и<>?ованн<D0BD>?м мин<D0B8>?сом
@ -6781,7 +6778,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
case 784: // dotted_identifier -> dotted_identifier, tkPoint, identifier_or_keyword
{
if (ValueStack[ValueStack.Depth-3].ex is index)
parsertools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}", LocationStack[LocationStack.Depth-3], "^");
parserTools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}", LocationStack[LocationStack.Depth-3], "^");
CurrentSemanticValue.ex = new dot_node(ValueStack[ValueStack.Depth-3].ex as addressed_value, ValueStack[ValueStack.Depth-1].id as addressed_value, CurrentLocationSpan);
}
break;
@ -6819,7 +6816,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
// tkRoundClose
{
if (ValueStack[ValueStack.Depth-4].ex is index)
parsertools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}", LocationStack[LocationStack.Depth-4], "^");
parserTools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}", LocationStack[LocationStack.Depth-4], "^");
CurrentSemanticValue.ex = new method_call(ValueStack[ValueStack.Depth-4].ex as addressed_value,ValueStack[ValueStack.Depth-2].stn as expression_list, CurrentLocationSpan);
}
break;
@ -6836,7 +6833,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
break;
case 796: // variable -> tkRoundOpen, expr, tkRoundClose
{
if (!parsertools.buildTreeForFormatter)
if (!parserTools.buildTreeForFormatter)
{
ValueStack[ValueStack.Depth-2].ex.source_context = CurrentLocationSpan;
CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-2].ex;
@ -6847,7 +6844,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
case 797: // variable -> tkRoundOpen, var_with_init_for_expr_with_let_list, expr,
// tkRoundClose
{
if (!parsertools.buildTreeForFormatter)
if (!parserTools.buildTreeForFormatter)
{
ValueStack[ValueStack.Depth-2].ex.source_context = CurrentLocationSpan;
CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-2].ex;
@ -6864,7 +6861,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
case 800: // variable -> literal_or_number, tkPoint, identifier_or_keyword
{
if (ValueStack[ValueStack.Depth-3].ex is index)
parsertools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}", LocationStack[LocationStack.Depth-3], "^");
parserTools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}", LocationStack[LocationStack.Depth-3], "^");
CurrentSemanticValue.ex = new dot_node(ValueStack[ValueStack.Depth-3].ex as addressed_value, ValueStack[ValueStack.Depth-1].id as addressed_value, CurrentLocationSpan);
}
break;
@ -6875,7 +6872,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
if (el.Count==1 && el.expressions[0] is format_expr)
{
var fe = el.expressions[0] as format_expr;
if (!parsertools.buildTreeForFormatter)
if (!parserTools.buildTreeForFormatter)
{
if (fe.expr == null)
fe.expr = new int32_const(int.MaxValue,LocationStack[LocationStack.Depth-2]);
@ -6888,7 +6885,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
else if (el.expressions.Any(e => e is format_expr))
{
if (el.expressions.Count > 4)
parsertools.AddErrorFromResource("SLICES_OF MULTIDIMENSIONAL_ARRAYS_ALLOW_ONLY_FOR_RANK_LT_5",CurrentLocationSpan); // С<>?ез<D0B5>? многоме<D0BC>?н<>?<3F>? массивов <20>?аз<D0B0>?е<>?ен<D0B5>? <20>?ол<D0BE>?ко для массивов <20>?азме<D0BC>?нос<D0BE>?и < 5
parserTools.AddErrorFromResource("SLICES_OF MULTIDIMENSIONAL_ARRAYS_ALLOW_ONLY_FOR_RANK_LT_5",CurrentLocationSpan); // С<>?ез<D0B5>? многоме<D0BC>?н<>?<3F>? массивов <20>?аз<D0B0>?е<>?ен<D0B5>? <20>?ол<D0BE>?ко для массивов <20>?азме<D0BC>?нос<D0BE>?и < 5
var ll = new List<Tuple<expression, expression, expression>>();
foreach (var ex in el.expressions)
{
@ -6918,7 +6915,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
// tkSquareClose
{
var fe = ValueStack[ValueStack.Depth-2].ex as format_expr; // SSM 9/01/17
if (!parsertools.buildTreeForFormatter)
if (!parserTools.buildTreeForFormatter)
{
if (fe.expr == null)
fe.expr = new int32_const(int.MaxValue,LocationStack[LocationStack.Depth-2]);
@ -6939,7 +6936,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
case 805: // variable -> variable, tkPoint, identifier_keyword_operatorname
{
if (ValueStack[ValueStack.Depth-3].ex is index)
parsertools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}", LocationStack[LocationStack.Depth-3], "^");
parserTools.AddErrorFromResource("UNEXPECTED_SYMBOL{0}", LocationStack[LocationStack.Depth-3], "^");
CurrentSemanticValue.ex = new dot_node(ValueStack[ValueStack.Depth-3].ex as addressed_value, ValueStack[ValueStack.Depth-1].id as addressed_value, CurrentLocationSpan);
}
break;
@ -7005,7 +7002,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
break;
case 822: // literal -> tkFormatStringLiteral
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
{
CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].stn as string_const;
}
@ -7017,7 +7014,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
break;
case 823: // literal -> tkMultilineStringLiteral
{
if (parsertools.buildTreeForFormatter)
if (parserTools.buildTreeForFormatter)
{
var sc = ValueStack[ValueStack.Depth-1].stn as string_const;
sc.IsMultiline = true;
@ -7038,7 +7035,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
{
var line = ValueStack[ValueStack.Depth-2].stn as literal_const_line;
if (line.literals.Last() is string_const && ValueStack[ValueStack.Depth-1].ex is string_const)
parsertools.AddErrorFromResource("TWO_STRING_LITERALS_IN_SUCCESSION",LocationStack[LocationStack.Depth-1]);
parserTools.AddErrorFromResource("TWO_STRING_LITERALS_IN_SUCCESSION",LocationStack[LocationStack.Depth-1]);
CurrentSemanticValue.stn = line.Add(ValueStack[ValueStack.Depth-1].ex as literal, CurrentLocationSpan);
}
break;
@ -7054,7 +7051,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
break;
case 828: // optional_method_modificators -> tkSemiColon, meth_modificators, tkSemiColon
{
//parsertools.AddModifier((procedure_attributes_list)$2, proc_attribute.attr_overload);
//parserTools.AddModifier((procedure_attributes_list)$2, proc_attribute.attr_overload);
CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-2].stn;
}
break;
@ -7065,7 +7062,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
break;
case 830: // optional_method_modificators1 -> tkSemiColon, meth_modificators
{
//parsertools.AddModifier((procedure_attributes_list)$2, proc_attribute.attr_overload);
//parserTools.AddModifier((procedure_attributes_list)$2, proc_attribute.attr_overload);
CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn;
}
break;
@ -7118,7 +7115,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
case 845: // meth_modificator -> tkOverload
{
CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id;
parsertools.AddWarningFromResource("OVERLOAD_IS_NOT_USED", ValueStack[ValueStack.Depth-1].id.source_context);
parserTools.AddWarningFromResource("OVERLOAD_IS_NOT_USED", ValueStack[ValueStack.Depth-1].id.source_context);
}
break;
case 846: // meth_modificator -> tkReintroduce
@ -7657,7 +7654,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
{
if (ValueStack[ValueStack.Depth-3].stn != null)
{
parsertools.AddErrorFromResource("SEMICOLON_IN_PARAMS",LocationStack[LocationStack.Depth-3]);
parserTools.AddErrorFromResource("SEMICOLON_IN_PARAMS",LocationStack[LocationStack.Depth-3]);
}
var lst_ex = new List<expression>();
@ -7681,7 +7678,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
var formal_pars = new formal_parameters();
var idd = ValueStack[ValueStack.Depth-7].ex as ident;
if (idd==null)
parsertools.AddErrorFromResource("ONE_TKIDENTIFIER",LocationStack[LocationStack.Depth-7]);
parserTools.AddErrorFromResource("ONE_TKIDENTIFIER",LocationStack[LocationStack.Depth-7]);
var lambda_inf_type = new lambda_inferred_type(new lambda_any_type_node_syntax(), null);
var new_typed_pars = new typed_parameters(new ident_list(idd, idd.source_context), lambda_inf_type, parametr_kind.none, null, idd.source_context);
formal_pars.Add(new_typed_pars);
@ -7689,7 +7686,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
{
var idd1 = id as ident;
if (idd1==null)
parsertools.AddErrorFromResource("ONE_TKIDENTIFIER",id.source_context);
parserTools.AddErrorFromResource("ONE_TKIDENTIFIER",id.source_context);
lambda_inf_type = new lambda_inferred_type(new lambda_any_type_node_syntax(), null);
new_typed_pars = new typed_parameters(new ident_list(idd1, idd1.source_context), lambda_inf_type, parametr_kind.none, null, idd1.source_context);
@ -7712,7 +7709,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
var loc = LexLocation.MergeAll(LocationStack[LocationStack.Depth-7],LocationStack[LocationStack.Depth-6],LocationStack[LocationStack.Depth-5]);
var idd = ValueStack[ValueStack.Depth-7].ex as ident;
if (idd==null)
parsertools.AddErrorFromResource("ONE_TKIDENTIFIER",LocationStack[LocationStack.Depth-7]);
parserTools.AddErrorFromResource("ONE_TKIDENTIFIER",LocationStack[LocationStack.Depth-7]);
var idList = new ident_list(idd, loc);
@ -7722,7 +7719,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
{
var idd2 = iddlist[j] as ident;
if (idd2==null)
parsertools.AddErrorFromResource("ONE_TKIDENTIFIER",idd2.source_context);
parserTools.AddErrorFromResource("ONE_TKIDENTIFIER",idd2.source_context);
idList.Add(idd2);
}
var parsType = ValueStack[ValueStack.Depth-4].td;
@ -7913,7 +7910,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
break;
case 1021: // common_lambda_body -> yield_stmt
{
parsertools.AddErrorFromResource("YIELD_STATEMENT_CANNOT_BE_USED_IN_LAMBDA_BODY", CurrentLocationSpan);
parserTools.AddErrorFromResource("YIELD_STATEMENT_CANNOT_BE_USED_IN_LAMBDA_BODY", CurrentLocationSpan);
}
break;
case 1022: // common_lambda_body -> tkRoundOpen, assignment, tkRoundClose
@ -7926,7 +7923,7 @@ public partial class GPPGParser: ShiftReduceParser<PascalABCSavParser.Union, Lex
var id = SyntaxVisitors.HasNameVisitor.HasName(ValueStack[ValueStack.Depth-1].ex, "Result");
if (id != null)
{
parsertools.AddErrorFromResource("RESULT_IDENT_NOT_EXPECTED_IN_THIS_CONTEXT", id.source_context);
parserTools.AddErrorFromResource("RESULT_IDENT_NOT_EXPECTED_IN_THIS_CONTEXT", id.source_context);
}
var sl = new statement_list(new assign("result",ValueStack[ValueStack.Depth-1].ex,CurrentLocationSpan),CurrentLocationSpan); // надо поме<D0BC>?а<>?<3F>? е<>?<3F>? и assign как ав<D0B0>?осгене<D0BD>?и<>?ованн<D0BD>?й для лямбд<D0B1>? - <20>?<3F>?об<D0BE>? зап<D0B0>?е<>?и<>?<3F>? явн<D0B2>?й Result
sl.expr_lambda_body = true;

View file

@ -1,12 +1,7 @@
// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.IO;
using PascalABCCompiler.ParserTools;
using PascalABCCompiler.SyntaxTree;
using PascalABCCompiler.Parsers;
using System.Resources;
using System.Reflection;
using PascalABCCompiler.Errors;
using System.Collections.Generic;
using System.Text.RegularExpressions;
@ -15,7 +10,7 @@ using System.Text.RegularExpressions;
namespace PascalABCCompiler.DocTagsParser
{
public class DocTagsLanguageParser:IParser
public class DocTagsLanguageParser : IParser
{
List<string> sectionNames = new List<string>();
@ -201,13 +196,6 @@ namespace PascalABCCompiler.DocTagsParser
{
return "Documentation Comments Tag Parser v" + Version;
}
public IPreprocessor Preprocessor
{
get
{
return null;
}
}
List<CompilerWarning> warnings = new List<CompilerWarning>();

View file

@ -4,66 +4,33 @@ using System;
using System.IO;
using System.Collections.Generic;
using PascalABCCompiler.SyntaxTree;
using PascalABCSavParser;
using PascalABCCompiler.Parsers;
using GPPGParserScanner;
using GPPGPreprocessor3;
using PascalABCCompiler.ParserTools.Directives;
using static PascalABCCompiler.ParserTools.Directives.DirectiveHelper;
using System.Text.RegularExpressions;
using PascalABCSavParser;
namespace PascalABCCompiler.PascalABCNewParser
{
// SSM: класс, являющийся обёрткой над парсером препроцессора
public class PreprocessorParserHelper
// SSM: класс, являющийся обёрткой над GPPG парсером
/*public class GPPGParserHelper
{
private List<Errors.Error> Errs;
private List<Errors.CompilerWarning> Warnings;
private string FileName;
public bool build_tree_for_formatter = false;
public List<string> DefinesList = null;
public List<compiler_directive> compilerDirectives;
public PreprocessorParserHelper(List<Errors.Error> Errs, string FileName)
public GPPGParserHelper(List<Errors.Error> Errs, List<Errors.CompilerWarning> Warnings, string FileName)
{
this.Errs = Errs;
this.Warnings = Warnings;
this.FileName = FileName;
}
public bool Parse(string Text)
public syntax_tree_node Parse(string Text, List<compiler_directive> compilerDirectives = null)
{
compilerDirectives = new List<compiler_directive>();
PascalParserTools parsertools = new PascalParserTools(); // контекст сканера и парсера
parsertools.errors = Errs;
parsertools.currentFileName = Path.GetFullPath(FileName);
var scanner = new PreprocessorScanner();
scanner.SetSource(Text, 0);
//scanner.parsertools = parsertools;// передали parsertools в объект сканера
var parser = new PreprocessorParser(scanner);
parser.compilerDirectives = compilerDirectives;
parsertools.compilerDirectives = compilerDirectives;
//parser.parsertools = parsertools; // передали parsertools в объект парсера
if (!parser.Parse())
{
parsertools.AddError("Неопознанная синтаксическая ошибка препроцессора!", null);
return false;
}
return true;
}
}
// SSM: Наш основной парсер + препроцессор (реализует НАШ интерфейс IParser)
public class PascalABCNewLanguageParser : BaseParser, IParser
{
public class GPPGParserHelper : BaseGPPGParserHelper
{
public GPPGParserHelper(List<Errors.Error> errors, List<Errors.CompilerWarning> warnings, string fileName) : base(errors, warnings, fileName) { }
public override syntax_tree_node Parse(string Text, List<compiler_directive> compilerDirectives = null)
{
#if DEBUG
#if _ERR
FileInfo f = new FileInfo(FileName);
@ -72,35 +39,39 @@ namespace PascalABCCompiler.PascalABCNewParser
Console.SetError(sw);
#endif
#endif
PascalParserTools parsertools = new PascalParserTools(); // контекст сканера и парсера
parsertools.errors = errors;
parsertools.warnings = warnings;
parsertools.compilerDirectives = compilerDirectives;
parsertools.currentFileName = Path.GetFullPath(fileName);
this.compilerDirectives = compilerDirectives;
PT parsertools = new PT(); // контекст сканера и парсера
parsertools.errors = Errs;
parsertools.warnings = Warnings;
parsertools.compilerDirectives = compilerDirectives;
parsertools.CurrentFileName = Path.GetFullPath(FileName);
Scanner scanner = new Scanner();
scanner.SetSource(Text, 0);
scanner.parserTools = parsertools;// передали parsertools в объект сканера
if (definesList != null)
scanner.Defines.AddRange(definesList);
GPPGParser parser = new GPPGParser(scanner);
parsertools.buildTreeForFormatter = buildTreeForFormatter;
parser.parsertools = parsertools; // передали parsertools в объект парсера
if (!parser.Parse())
if (errors.Count == 0)
parsertools.AddError("Неопознанная синтаксическая ошибка!", null);
Scanner scanner = new Scanner();
scanner.SetSource(Text, 0);
scanner.parsertools = parsertools;// передали parsertools в объект сканера
if (DefinesList != null)
scanner.Defines.AddRange(DefinesList);
GPPGParser parser = new GPPGParser(scanner);
parsertools.build_tree_for_formatter = build_tree_for_formatter;
parser.parsertools = parsertools; // передали parsertools в объект парсера
if (!parser.Parse())
if (Errs.Count == 0)
parsertools.AddError("Неопознанная синтаксическая ошибка!", null);
#if DEBUG
#if _ERR
sw.Close();
#endif
#endif
return parser.root;
}
return parser.root;
}
}*/
private GPPGParserHelper localparserhelper;
public class PascalABCNewLanguageParser : BaseParser, IParser
{
public PascalABCNewLanguageParser()
: base(
@ -184,7 +155,7 @@ namespace PascalABCCompiler.PascalABCNewParser
CompilerDirectives = new List<compiler_directive>();
}
public override PascalABCCompiler.SyntaxTree.syntax_tree_node BuildTree(string FileName, string Text, ParseMode ParseMode, List<string> DefinesList = null)
public override syntax_tree_node BuildTree(string FileName, string Text, ParseMode ParseMode, List<string> DefinesList = null)
{
syntax_tree_node root = null;
@ -213,50 +184,67 @@ namespace PascalABCCompiler.PascalABCNewParser
break;
}
if (root != null && root is compilation_unit)
if (root != null && root is compilation_unit compilationUnit)
{
(root as compilation_unit).file_name = FileName;
(root as compilation_unit).compiler_directives = CompilerDirectives;
if (root is unit_module)
if ((root as unit_module).unit_name.HeaderKeyword == UnitHeaderKeyword.Library)
(root as compilation_unit).compiler_directives.Add(new compiler_directive(new token_info("apptype"), new token_info("dll")));
compilationUnit.file_name = FileName;
compilationUnit.compiler_directives = CompilerDirectives;
if (root is unit_module unitModule)
if (unitModule.unit_name.HeaderKeyword == UnitHeaderKeyword.Library)
unitModule.compiler_directives.Add(new compiler_directive(new token_info("apptype"), new token_info("dll")));
}
return root;
}
private syntax_tree_node Parse(string Text, string fileName, bool buildTreeForFormatter = false, List<string> definesList = null)
{
#if DEBUG
#if _ERR
FileInfo f = new FileInfo(FileName);
var sv = Path.ChangeExtension(FileName,".grmtrack1");
var sw = new StreamWriter(sv);
Console.SetError(sw);
#endif
#endif
PascalParserTools parserTools = new PascalParserTools(); // контекст сканера и парсера
parserTools.errors = Errors;
parserTools.warnings = Warnings;
parserTools.compilerDirectives = CompilerDirectives;
parserTools.currentFileName = Path.GetFullPath(fileName);
Scanner scanner = new Scanner();
scanner.SetSource(Text, 0);
scanner.parserTools = parserTools; // передали parserTools в объект сканера
if (definesList != null)
scanner.Defines.AddRange(definesList);
GPPGParser parser = new GPPGParser(scanner);
parserTools.buildTreeForFormatter = buildTreeForFormatter;
parser.parserTools = parserTools; // передали parserTools в объект парсера
if (!parser.Parse())
if (Errors.Count == 0)
parserTools.AddError("Неопознанная синтаксическая ошибка!", null);
#if DEBUG
#if _ERR
sw.Close();
#endif
#endif
return parser.root;
}
public override syntax_tree_node BuildTreeInNormalMode(string FileName, string Text, List<string> DefinesList = null)
{
Errors.Clear();
Warnings.Clear();
/*string[] file_names = new string[1];
file_names[0] = file_name;
preprocessor2.Build(file_names, Errors, null);*/
PreprocessorParserHelper preprocessor3 = new PreprocessorParserHelper(Errors, FileName);
var b = preprocessor3.Parse(Text);
syntax_tree_node root = Parse(Text, FileName, false, DefinesList);
if (Errors.Count > 0)
return null;
localparserhelper = new GPPGParserHelper(Errors, Warnings, FileName);
localparserhelper.definesList = DefinesList;
syntax_tree_node root = localparserhelper.Parse(Text, preprocessor3.compilerDirectives);
if (Errors.Count > 0)
return null;
if (root != null && root is compilation_unit)
(root as compilation_unit).file_name = FileName;
/*if (preprocessor2.CompilerDirectives != null && preprocessor2.CompilerDirectives.Count != 0)
CompilerDirectives.AddRange(preprocessor2.CompilerDirectives);*/
if (preprocessor3.compilerDirectives != null && preprocessor3.compilerDirectives.Count != 0)
CompilerDirectives.AddRange(preprocessor3.compilerDirectives);
return root;
}
@ -267,13 +255,13 @@ namespace PascalABCCompiler.PascalABCNewParser
// LineCorrection = -1 не забыть
string origText = Text;
Text = String.Concat("<<expression>>", Environment.NewLine, Text);
localparserhelper = new GPPGParserHelper(Errors, Warnings, FileName);
// localparser.parsertools.LineCorrection = -1;
syntax_tree_node root = localparserhelper.Parse(Text);
syntax_tree_node root = Parse(Text, FileName);
if (root == null && origText != null && origText.Contains("<"))
{
Errors.Clear();
root = localparserhelper.Parse(String.Concat("<<expression>>", Environment.NewLine, origText.Replace("<", "&<")));
root = Parse(String.Concat("<<expression>>", Environment.NewLine, origText.Replace("<", "&<")), FileName);
}
return root as expression;
}
@ -282,45 +270,32 @@ namespace PascalABCCompiler.PascalABCNewParser
{
// LineCorrection = -1 не забыть
Text = String.Concat("<<type>>", Environment.NewLine, Text);
localparserhelper = new GPPGParserHelper(Errors, Warnings, FileName);
// localparser.parsertools.LineCorrection = -1;
syntax_tree_node root = localparserhelper.Parse(Text);
syntax_tree_node root = Parse(Text, FileName);
return root as expression;
}
public override syntax_tree_node BuildTreeInStatementMode(string FileName, string Text)
{
Text = String.Concat("<<statement>>", Environment.NewLine, Text);
localparserhelper = new GPPGParserHelper(Errors, Warnings, FileName);
// localparser.parsertools.LineCorrection = -1;
syntax_tree_node root = localparserhelper.Parse(Text);
syntax_tree_node root = Parse(Text, FileName);
return root as statement;
}
public override syntax_tree_node BuildTreeInSpecialMode(string FileName, string Text)
{
Errors.Clear();
localparserhelper = new GPPGParserHelper(Errors, Warnings, FileName);
syntax_tree_node root = localparserhelper.Parse(Text);
syntax_tree_node root = Parse(Text, FileName);
return root;
}
public override syntax_tree_node BuildTreeInFormatterMode(string FileName, string Text)
{
Errors.Clear();
localparserhelper = new GPPGParserHelper(Errors, Warnings, FileName);
localparserhelper.buildTreeForFormatter = true;
syntax_tree_node root = localparserhelper.Parse(Text);
syntax_tree_node root = Parse(Text, FileName, true);
return root;
}
// SSM: Зачем это - не знаю. Я бы убрал
public override IPreprocessor Preprocessor
{
get
{
return null;
}
}
}
}

View file

@ -1,9 +1,6 @@
// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PascalABCCompiler.SyntaxTree;
namespace PascalABCSavParser

View file

@ -107,9 +107,6 @@
<Compile Include="Keywords.cs" />
<Compile Include="Parser.cs" />
<Compile Include="ParserLambdaHelper.cs" />
<Compile Include="Preprocessor3.cs" />
<Compile Include="Preprocessor3Yacc.cs" />
<Compile Include="PreprocessorTools.cs" />
<Compile Include="SemanticRules.cs" />
</ItemGroup>
<ItemGroup>

File diff suppressed because it is too large Load diff

View file

@ -1,89 +0,0 @@
%{
%}
%scannertype PreprocessorScanner
%namespace GPPGPreprocessor3
%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);
}
<INSIDEDIRECTIVE> "}" {
BEGIN(INITIAL);
}
<INSIDEDIRECTIVE> {DIRECTIVE} {
//if (yytext.Contains("\n"))
// Console.WriteLine("({0},{1}) {2}",tokLin,tokCol,"error: LF into directive");
//else Console.WriteLine("({0},{1}) {2}",tokLin,tokCol,yytext);
yylval = new Directive(yytext, new LexLocation(tokLin, tokCol, tokELin, tokECol));
var t1 = yylloc;
return (int)Tokens.DIRECTIVE;
}
{NODIRECTIVE} {
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);
%}
%%
/*public override void yyerror(string format, params object[] args)
{
string errorMsg = parsertools.CreateErrorString(yytext,args);
parsertools.AddError(errorMsg,new LexLocation(tokLin, tokCol, tokELin, tokECol));
}*/

View file

@ -1,99 +0,0 @@
// This code was generated by the Gardens Point Parser Generator
// Copyright (c) Wayne Kelly, QUT 2005-2010
// (see accompanying GPPGcopyright.rtf)
// GPPG version 1.3.6
// Machine: DESKTOP-G8V08V4
// DateTime: 27.03.2019 21:35:18
// UserName: ?????????
// Input file <Preprocessor3Yacc.y>
// options: no-lines gplex
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using QUT.Gppg;
using PascalABCCompiler.SyntaxTree;
namespace GPPGPreprocessor3
{
public enum Tokens {
error=1,EOF=2,DIRECTIVE=3,NODIRECTIVE=4};
// Abstract base class for GPLEX scanners
public abstract class ScanBase : AbstractScanner<Directive,LexLocation> {
private LexLocation __yylloc = new LexLocation();
public override LexLocation yylloc { get { return __yylloc; } set { __yylloc = value; } }
protected virtual bool yywrap() { return true; }
}
public partial class PreprocessorParser: ShiftReduceParser<Directive, LexLocation>
{
// Verbatim content from Preprocessor3Yacc.y
public List<compiler_directive> compilerDirectives;
public PreprocessorParser(PreprocessorScanner scanner) : base(scanner) { }
// End verbatim content from Preprocessor3Yacc.y
#pragma warning disable 649
private static Dictionary<int, string> aliasses;
#pragma warning restore 649
private static Rule[] rules = new Rule[5];
private static State[] states = new State[5];
private static string[] nonTerms = new string[] {
"directives", "$accept", };
static PreprocessorParser() {
states[0] = new State(-2,new int[]{-1,1});
states[1] = new State(new int[]{2,2,3,3,4,4});
states[2] = new State(-1);
states[3] = new State(-3);
states[4] = new State(-4);
rules[1] = new Rule(-2, new int[]{-1,2});
rules[2] = new Rule(-1, new int[]{});
rules[3] = new Rule(-1, new int[]{-1,3});
rules[4] = new Rule(-1, new int[]{-1,4});
}
protected override void Initialize() {
this.InitSpecialTokens((int)Tokens.error, (int)Tokens.EOF);
this.InitStates(states);
this.InitRules(rules);
this.InitNonTerminals(nonTerms);
}
protected override void DoAction(int action)
{
switch (action)
{
case 2: // directives -> /* empty */
{
Directive.dirs.Clear();
}
break;
case 3: // directives -> directives, DIRECTIVE
{
compilerDirectives.Add(PreprocessorTools.MakeDirective(ValueStack[ValueStack.Depth-1].text, ValueStack[ValueStack.Depth-1].loc));
}
break;
case 4: // directives -> directives, NODIRECTIVE
{ }
break;
}
}
protected override string TerminalToString(int terminal)
{
if (aliasses != null && aliasses.ContainsKey(terminal))
return aliasses[terminal];
else if (((Tokens)terminal).ToString() != terminal.ToString(CultureInfo.InvariantCulture))
return ((Tokens)terminal).ToString();
else
return CharToString((char)terminal);
}
}
}

View file

@ -1,35 +0,0 @@
%{
public List<compiler_directive> compilerDirectives;
public PreprocessorParser(PreprocessorScanner scanner) : base(scanner) { }
%}
%output=Preprocessor3Yacc.cs
%partial
%parsertype PreprocessorParser
%namespace GPPGPreprocessor3
%using PascalABCCompiler.SyntaxTree;
%YYSTYPE Directive
%start directives
%token DIRECTIVE NODIRECTIVE
%%
directives
:
{
Directive.dirs.Clear();
}
| directives DIRECTIVE
{
compilerDirectives.Add(PreprocessorTools.MakeDirective($2.text, $2.loc));
}
| directives NODIRECTIVE
{ }
;
%%

View file

@ -1,55 +0,0 @@
// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PascalABCCompiler.SyntaxTree;
using QUT.Gppg;
namespace GPPGPreprocessor3
{
public class Directive
{
public string text;
public QUT.Gppg.LexLocation loc;
public static List<Directive> dirs = new List<Directive>();
public Directive(string text, QUT.Gppg.LexLocation loc)
{
this.text = text;
this.loc = loc;
dirs.Add(this);
}
public override string ToString()
{
return String.Format("({0},{1})-({2},{3}) {4}",loc.StartLine,loc.StartColumn,loc.EndLine,loc.EndColumn,text);
}
}
public static class PreprocessorTools
{
public static compiler_directive MakeDirective(string text, LexLocation loc)
{
string name = "";
string directive = "";
if (text != null)
{
var ind = text.IndexOf(' ');
if (ind == -1)
name = text;
else
{
name = text.Substring(0, ind);
directive = text.Substring(ind+1);
if (directive.StartsWith("'"))
directive = directive.Remove(0,1);
if (directive.EndsWith("'"))
directive = directive.Substring(0, directive.Length - 1);
}
}
return new compiler_directive(new token_info(name), new token_info(directive), loc);
}
}
}

View file

@ -51,7 +51,7 @@ namespace GPPGParserScanner
var err_stn = progBlock;
if ((progBlock is block) && (progBlock as block).program_code != null && (progBlock as block).program_code.subnodes != null && (progBlock as block).program_code.subnodes.Count > 0)
err_stn = (progBlock as block).program_code.subnodes[(progBlock as block).program_code.subnodes.Count - 1];
parsertools.errors.Add(new PABCNETUnexpectedToken(parsertools.currentFileName, StringResources.Get("TKPOINT"), new SourceContext(fp.line_num, fp.column_num + 1, fp.line_num, fp.column_num + 1, 0, 0), err_stn));
parserTools.errors.Add(new PABCNETUnexpectedToken(parserTools.currentFileName, StringResources.Get("TKPOINT"), new SourceContext(fp.line_num, fp.column_num + 1, fp.line_num, fp.column_num + 1, 0, 0), err_stn));
}
return progModule;
}
@ -93,7 +93,7 @@ namespace GPPGParserScanner
{
var naic = new typecast_node(constterm as addressed_value, tdef, typecastop, loc);
if (!(constterm is addressed_value))
parsertools.errors.Add(new bad_operand_type(parsertools.currentFileName, constterm.source_context, naic));
parserTools.errors.Add(new bad_operand_type(parserTools.currentFileName, constterm.source_context, naic));
return naic;
}
@ -299,7 +299,7 @@ namespace GPPGParserScanner
syntax_tree_node err_stn = stmt;
if (err_stn == null)
err_stn = expr;
parsertools.errors.Add(new PABCNETUnexpectedToken(parsertools.currentFileName, StringResources.Get("TKDO"), new SourceContext(fp.line_num, fp.column_num + 1, fp.line_num, fp.column_num + 1, 0, 0), err_stn));
parserTools.errors.Add(new PABCNETUnexpectedToken(parserTools.currentFileName, StringResources.Get("TKDO"), new SourceContext(fp.line_num, fp.column_num + 1, fp.line_num, fp.column_num + 1, 0, 0), err_stn));
}
return nws;
}
@ -313,17 +313,17 @@ namespace GPPGParserScanner
syntax_tree_node err_stn = stmt;
if (err_stn == null)
err_stn = expr2;
parsertools.errors.Add(new PABCNETUnexpectedToken(parsertools.currentFileName, StringResources.Get("TKDO"), new SourceContext(fp.line_num, fp.column_num + 1, fp.line_num, fp.column_num + 1, 0, 0), err_stn));
parserTools.errors.Add(new PABCNETUnexpectedToken(parserTools.currentFileName, StringResources.Get("TKDO"), new SourceContext(fp.line_num, fp.column_num + 1, fp.line_num, fp.column_num + 1, 0, 0), err_stn));
}
if (!opt_var && for_stmt_decl_or_assign == null)
parsertools.AddWarningFromResource("USING_UNLOCAL_FOR_VARIABLE", identifier.source_context);
parserTools.AddWarningFromResource("USING_UNLOCAL_FOR_VARIABLE", identifier.source_context);
return nfs;
}
public typecast_node NewAsIsExpr(syntax_tree_node term, op_typecast typecast_op, type_definition simple_or_template_type_reference, LexLocation loc)
{
if (!(term is addressed_value))
parsertools.errors.Add(new bad_operand_type(parsertools.currentFileName, term.source_context, term));
parserTools.errors.Add(new bad_operand_type(parserTools.currentFileName, term.source_context, term));
var naie = new typecast_node((addressed_value)term, simple_or_template_type_reference, typecast_op, loc);
return naie;
@ -331,7 +331,7 @@ namespace GPPGParserScanner
public function_lambda_call NewFactor(ident func_decl_lambda, expression_list expr_list, LexLocation loc)
{
var fld = parsertools.find_pascalABC_lambda_name(func_decl_lambda.name);
var fld = parserTools.find_pascalABC_lambda_name(func_decl_lambda.name);
var _expression_list = expr_list;
var _lambda_definition = fld;
var _lambda_call = new function_lambda_call(_lambda_definition, _expression_list, loc);
@ -342,15 +342,15 @@ namespace GPPGParserScanner
public addressed_value NewVarReference(get_address var_address, addressed_value variable, LexLocation loc)
{
var_address.address_of = variable;
parsertools.create_source_context(parsertools.NodesStack.Peek(),parsertools.NodesStack.Peek(), variable);
return (addressed_value)parsertools.NodesStack.Pop();
parserTools.create_source_context(parserTools.NodesStack.Peek(),parserTools.NodesStack.Peek(), variable);
return (addressed_value)parserTools.NodesStack.Pop();
}
public get_address NewVarAddress(LexLocation loc)
{
var nva = new get_address();
nva.source_context = loc;
parsertools.NodesStack.Push(nva);
parserTools.NodesStack.Push(nva);
return nva;
}
@ -373,7 +373,7 @@ namespace GPPGParserScanner
{
var tpl = (template_param_list)var_specifiers;
((dot_node)tpl.dereferencing_value).left = variable;
parsertools.create_source_context(tpl.dereferencing_value, variable, tpl.dereferencing_value);
parserTools.create_source_context(tpl.dereferencing_value, variable, tpl.dereferencing_value);
}
else if (var_specifiers is dereference)
{
@ -397,24 +397,24 @@ namespace GPPGParserScanner
public expression ParseExpression(string Text, int line, int col)
{
PascalParserTools parsertools = new PascalParserTools(); // контекст сканера и парсера
parsertools.errors = new List<Error>();
parsertools.warnings = new List<CompilerWarning>();
parsertools.currentFileName = System.IO.Path.GetFullPath(this.parsertools.currentFileName);
parsertools.buildTreeForFormatterStrings = true;
PascalParserTools parserTools = new PascalParserTools(); // контекст сканера и парсера
parserTools.errors = new List<Error>();
parserTools.warnings = new List<CompilerWarning>();
parserTools.currentFileName = System.IO.Path.GetFullPath(this.parserTools.currentFileName);
parserTools.buildTreeForFormatterStrings = true;
Scanner scanner = new Scanner();
scanner.SetSource("<<expression>>"+Text, 0);
scanner.parserTools = parsertools;// передали parsertools в объект сканера
scanner.parserTools = parserTools;// передали parserTools в объект сканера
GPPGParser parser = new GPPGParser(scanner);
parsertools.buildTreeForFormatter = false;
parserTools.buildTreeForFormatter = false;
parser.lambdaHelper = this.lambdaHelper;
parser.parsertools = parsertools;
parser.parserTools = parserTools;
if (!parser.Parse())
if (parsertools.errors.Count == 0)
parsertools.AddError("Неопознанная синтаксическая ошибка!", null);
foreach (Error err in parsertools.errors)
if (parserTools.errors.Count == 0)
parserTools.AddError("Неопознанная синтаксическая ошибка!", null);
foreach (Error err in parserTools.errors)
{
this.parsertools.errors.Add(err);
this.parserTools.errors.Add(err);
}
return parser.root as expression;
}
@ -454,7 +454,7 @@ namespace GPPGParserScanner
}
if (s.IndexOf("&]!") != -1 || s.IndexOf("![&") != -1)
{
parsertools.errors.Add(new bad_format_string(parsertools.currentFileName, str.source_context, str));
parserTools.errors.Add(new bad_format_string(parserTools.currentFileName, str.source_context, str));
return str;
}
vars.Add(s);
@ -464,7 +464,7 @@ namespace GPPGParserScanner
}
if (vars.Count == 0 && val.IndexOf("![&") == -1 && val.IndexOf("{") != -1)
{
parsertools.errors.Add(new bad_format_string(parsertools.currentFileName, str.source_context, str));
parserTools.errors.Add(new bad_format_string(parserTools.currentFileName, str.source_context, str));
return str;
}
@ -473,7 +473,7 @@ namespace GPPGParserScanner
{
if (arr[i].IndexOf("{") != -1 || arr[i].IndexOf("}") != -1)
{
parsertools.errors.Add(new bad_format_string(parsertools.currentFileName, str.source_context, str));
parserTools.errors.Add(new bad_format_string(parserTools.currentFileName, str.source_context, str));
return str;
}
sb.Append(arr[i].Replace("![&", "{{").Replace("&]!", "}}"));
@ -500,7 +500,7 @@ namespace GPPGParserScanner
cnt++;
if (cnt % 2 == 1)
{
parsertools.errors.Add(new bad_format_string(parsertools.currentFileName, str.source_context, str));
parserTools.errors.Add(new bad_format_string(parserTools.currentFileName, str.source_context, str));
return str;
}
@ -512,7 +512,7 @@ namespace GPPGParserScanner
var expr = ParseExpression(new string('\n', str.source_context.begin_position.line_num - 1) + new string(' ', str.source_context.begin_position.column_num + var_offsets[i] + 2) + s, str.source_context.begin_position.line_num, str.source_context.begin_position.column_num + var_offsets[i] + 2);
if (expr == null)
{
var err = parsertools.errors[0] as LocatedError;
var err = parserTools.errors[0] as LocatedError;
err.SourceContext.begin_position.line_num = str.source_context.begin_position.line_num;
err.SourceContext.begin_position.column_num = str.source_context.begin_position.column_num + var_offsets[i] + vars[i].Length + 3;
return str;
@ -527,7 +527,7 @@ namespace GPPGParserScanner
}
catch (Exception ex)
{
parsertools.errors.Add(new bad_format_string(parsertools.currentFileName, str.source_context, str));
parserTools.errors.Add(new bad_format_string(parserTools.currentFileName, str.source_context, str));
}
return str;
}
@ -551,7 +551,7 @@ namespace GPPGParserScanner
var id = new ident("result");
var op = new op_type_node(Operators.Assignment);
var ass = new assign(id, expr_l1, op.type);
parsertools.create_source_context(ass, id, expr_l1); // дурацкая функция - если хотя бы у одного sc=null, то возвращает null
parserTools.create_source_context(ass, id, expr_l1); // дурацкая функция - если хотя бы у одного sc=null, то возвращает null
if (ass.source_context == null)
if (expr_l1.source_context != null)
ass.source_context = expr_l1.source_context;

View file

@ -1,3 +0,0 @@
cls
GPLex_GPPG\gplex.exe /unicode Preprocessor3.lex
GPLex_GPPG\gppg.exe /no-lines /gplex Preprocessor3Yacc.y

View file

@ -198,14 +198,6 @@ namespace PascalABCCompiler.VBNETParser
{
return "Documentation Comments Tag Parser v" + Version;
}
public IPreprocessor Preprocessor
{
get
{
return null;
}
}
List<CompilerWarning> warnings = new List<CompilerWarning>();

View file

@ -181,11 +181,6 @@ namespace PascalABCCompiler.VBNETParser
}
}
public IPreprocessor Preprocessor {
get {
return null;
}
}
public List<CompilerWarning> Warnings
{

View file

@ -1,27 +0,0 @@
%PREFIX%=PABCPreprocessor2_
EXPECTED{0}=Expected '{0}'
EXPECTED_{0}_BUT_FOUND_{1}=Expexted '{0}' but found '{1}'
EOF=(End of file)
_directive=Directive
INCLUDE_FILE_{0}_NOTFOUND=File '{0}' not found
CIRCULAR_INCLUDE_{0}=Circular include '{0}'
ERROR_IN_DEFINE_SYNTAX=Error in $define syntax
ERROR_IN_INCLUDE_SYNTAX=Error in $include syntax
NAME_IS_DEFINED_{0}=Name is defined '{0}'
NAME_WAS_NOT_DEFINED_{0}=Name was not defined '{0}'
INVALID_INTEGER_EXPRESSION=Invalid integer expression
UNEXPEXTED_ENDIF_DIRECTIVE=Unexpected $endif directive
UNEXPEXTED_ELSE_DIRECTIVE=Unexpected $else directive
ENDIF_DIRECTIVE_EXPEXTED=Expected $endif
SYNTAX_ERROR_IN_DIRECTIVE_{0}=Error in directive '{0}'
UNKNOWN_DIRECTIVE_{0}=Unknown directive '{0}'
UNEXPECTED_SPACES_IN_DIRECTIVE_{0}=Unexpected spaces in directive '{0}'
UNEXPECTED_ASPDATA_DIRECTIVE_{0}=Unexpected directive '{0}'
DOUBLE_ASPDATA_DIRECTIVE_{0}=Aspect already defined '{0}'
ERROR_ASPDATA_DIRECTIVE_{0}=Error in directive '{0}' params
ASPBEGINEND_ERROR_IN_DIRECTIVE_{0}=Error in matches ASP and ENDASP in '{0}'
ONE_DIRECTIVE=Directive
ONE__DIRECTIVE=Directive

View file

@ -1,27 +0,0 @@
%PREFIX%=PABCPreprocessor2_
EXPECTED{0}=Ожидалось '{0}'
EXPECTED_{0}_BUT_FOUND_{1}=Ожидалось '{0}', а встречено '{1}'
EOF=(конец файла)
_DIRECTIVE=Директива
INCLUDE_FILE_{0}_NOTFOUND=Файл '{0}' не найден
CIRCULAR_INCLUDE_{0}=Циклическое включение файла '{0}'
ERROR_IN_DEFINE_SYNTAX=Ошибка в ситаксисе $define
ERROR_IN_INCLUDE_SYNTAX=Ошибка в ситаксисе $include
NAME_IS_DEFINED_{0}=Попытка повторного определения имени '{0}'
NAME_WAS_NOT_DEFINED_{0}=Попытка исключения неопределенного имени '{0}'
INVALID_INTEGER_EXPRESSION=Неверное целочисленное выражение
UNEXPEXTED_ENDIF_DIRECTIVE=Неожиданная директива $endif
UNEXPEXTED_ELSE_DIRECTIVE=Неожиданная директива $else
ENDIF_DIRECTIVE_EXPEXTED=Ожидалась директива $endif
SYNTAX_ERROR_IN_DIRECTIVE_{0}=Ошибка в директиве '{0}'
UNKNOWN_DIRECTIVE_{0}=Неизвестная директива '{0}'
UNEXPECTED_SPACES_IN_DIRECTIVE_{0}=Лишние пробелы в директиве '{0}'
UNEXPECTED_ASPDATA_DIRECTIVE_{0}=Директива '{0}' вне аспекта
DOUBLE_ASPDATA_DIRECTIVE_{0}=Попытка повторно задать параметры аспекта '{0}'
ERROR_ASPDATA_DIRECTIVE_{0}=Недопустимые параметры в директиве '{0}'
ASPBEGINEND_ERROR_IN_DIRECTIVE_{0}=Недопустимый уровень вложенности аспектов '{0}'
ONE_DIRECTIVE=Директива
ONE__DIRECTIVE=Директива

View file

@ -1,27 +0,0 @@
%PREFIX%=PABCPreprocessor2_
EXPECTED{0}=Очікувалося '{0}'
EXPECTED_{0}_BUT_FOUND_{1}=Очікувалося '{0}', а отримано '{1}'
EOF=(кінець файлу)
_DIRECTIVE=Директива
INCLUDE_FILE_{0}_NOTFOUND=Файл '{0}' не знайдено
CIRCULAR_INCLUDE_{0}=Циклічне включення файлу '{0}'
ERROR_IN_DEFINE_SYNTAX=Помилка в синтаксисі $define
ERROR_IN_INCLUDE_SYNTAX=Помилка в синтаксисі $include
NAME_IS_DEFINED_{0}=Спроба повторного визначення імені '{0}'
NAME_WAS_NOT_DEFINED_{0}=Спроба виключення невизначеного імені '{0}'
INVALID_INTEGER_EXPRESSION=Невірний цілочисельний вираз
UNEXPEXTED_ENDIF_DIRECTIVE=Несподівана директива $endif
UNEXPEXTED_ELSE_DIRECTIVE=Несподівана директива $else
ENDIF_DIRECTIVE_EXPEXTED=Очікувалася директива $endif
SYNTAX_ERROR_IN_DIRECTIVE_{0}=Помилка в директиві '{0}'
UNKNOWN_DIRECTIVE_{0}=Невідома директива '{0}'
UNEXPECTED_SPACES_IN_DIRECTIVE_{0}=Зайві пропуски в директиві '{0}'
UNEXPECTED_ASPDATA_DIRECTIVE_{0}=Директива '{0}' поза аспектом
DOUBLE_ASPDATA_DIRECTIVE_{0}=Спроба повторно задати параметри аспекту '{0}'
ERROR_ASPDATA_DIRECTIVE_{0}=Недопустимі параметри в директиві '{0}'
ASPBEGINEND_ERROR_IN_DIRECTIVE_{0}=Неприпустимий рівень вкладеності аспектів '{0}'
ONE_DIRECTIVE=Директива
ONE__DIRECTIVE=Директива

View file

@ -1,27 +0,0 @@
%PREFIX%=PABCPreprocessor2_
EXPECTED{0}=预期的 '{0}'
EXPECTED_{0}_BUT_FOUND_{1}=预期的 '{0}' 但找到 '{1}'
EOF=(文件末尾)
_directive=指令
INCLUDE_FILE_{0}_NOTFOUND=文件 '{0}' 未找到
CIRCULAR_INCLUDE_{0}=循环包含 '{0}'
ERROR_IN_DEFINE_SYNTAX=$define 语法错误
ERROR_IN_INCLUDE_SYNTAX=$include 语法错误
NAME_IS_DEFINED_{0}=名称已定义 '{0}'
NAME_WAS_NOT_DEFINED_{0}=名称未定义 '{0}'
INVALID_INTEGER_EXPRESSION=无效的整数表达式
UNEXPEXTED_ENDIF_DIRECTIVE=意外的 $endif 指令
UNEXPEXTED_ELSE_DIRECTIVE=意外的 $else 指令
ENDIF_DIRECTIVE_EXPEXTED=预期的 $endif
SYNTAX_ERROR_IN_DIRECTIVE_{0}=指令 '{0}' 中的错误
UNKNOWN_DIRECTIVE_{0}=未知指令 '{0}'
UNEXPECTED_SPACES_IN_DIRECTIVE_{0}=指令 '{0}' 中的意外空格
UNEXPECTED_ASPDATA_DIRECTIVE_{0}=意外指令 '{0}'
DOUBLE_ASPDATA_DIRECTIVE_{0}=特性已定义 '{0}'
ERROR_ASPDATA_DIRECTIVE_{0}=指令 '{0}' 参数错误
ASPBEGINEND_ERROR_IN_DIRECTIVE_{0}=匹配 '{0}' 中的 ASP 和 ENDASP 时出错
ONE_DIRECTIVE=指令
ONE__DIRECTIVE=指令