From 950ca1c7114ebfd761dea748df4ccae42eba4a65 Mon Sep 17 00:00:00 2001 From: Voloshin Bogdan Date: Mon, 14 May 2018 06:37:23 +0300 Subject: [PATCH] Add typeclass deriving translation --- .../SimpleTypeclassesImplementation.pas | 99 +- .../TypeclassHybridInheritanceTranslation.pas | 18 +- .../PascalABCParserNewSaushkin/ABCPascal.cs | 6 +- .../PascalABCParserNewSaushkin/ABCPascal.y | 5 + .../ABCPascalYacc.cs | 4000 +++++++++-------- SyntaxTree/tree/AbstractVisitor.cs | 5 + SyntaxTree/tree/HierarchyVisitor.cs | 16 + SyntaxTree/tree/SyntaxTreeStreamReader.cs | 14 + SyntaxTree/tree/SyntaxTreeStreamWriter.cs | 21 + SyntaxTree/tree/Tree.cs | 236 +- SyntaxTree/tree/Visitor.cs | 6 + SyntaxTree/tree/tree.xml | 23 +- .../StandardSyntaxConverter.cs | 2 + ...dInstancesAndRestrictedFunctionsVisitor.cs | 6 +- .../FindTypeclassesVisitor.cs | 4 +- .../ReplaceTypeclassVisitor.cs | 290 +- 16 files changed, 2695 insertions(+), 2056 deletions(-) diff --git a/CodeExamples/SimpleTypeclassesImplementation.pas b/CodeExamples/SimpleTypeclassesImplementation.pas index 34199062f..49a40b1e1 100644 --- a/CodeExamples/SimpleTypeclassesImplementation.pas +++ b/CodeExamples/SimpleTypeclassesImplementation.pas @@ -4,7 +4,7 @@ type TMonthType = (January, February, March, April, May, June, July, August, September, October, November, December); - Ordering = (_EQ, _LT, _GL); + Ordering = (_EQ, _LT, _GT); type @@ -17,10 +17,56 @@ type Result := not notEqual(x, y); end; - function notEqual(x, y: T) := not equal(x, y); + function notEqual(x, y: T): boolean; + begin + Result := not equal(x, y); + end; end; + Ord[T] = typeclass(Eq[T]) + function compare(x, y: T): Ordering; + begin + if equal(x, y) then + Result := _EQ + else if less(x, y) then + Result := _LT + else + Result := _GT; + end; + + function less(x, y: T): boolean; + begin + Result := compare(x, y) = _LT; + end; + + function lessEqual(x, y: T): boolean; + begin + Result := compare(x, y) <> _GT; + end; + + function greater(x, y: T): boolean; + begin + Result := compare(x, y) = _GT; + end; + + function greaterEqual(x, y: T): boolean; + begin + Result := compare(x, y) <> _LT; + end; + + function min(x, y: T): T; + begin + Result := lessEqual(x, y) ? x : y; + end; + + function max(x, y: T): T; + begin + Result := lessEqual(x, y) ? y : x; + end; + end; + + Show[T] = typeclass function show(x: T): string; end; @@ -44,6 +90,20 @@ type function equal(x, y: integer):boolean := x = y; end; +(* + Ord[integer] = instance + function compare(x, y: integer): Ordering; + begin + if equal(x, y) then + Result := _EQ + else if x < y then + Result := _LT + else + Result := _GT; + end; + end; +*) + Show[boolean] = instance function show(x: boolean): string := x ? 'Правда': 'Ложь'; @@ -96,6 +156,26 @@ begin end; end; +(* +procedure MySort(var a: array of T); where Ord[T]; +begin + for var i := 1 to a.Length - 1 do + begin + var sorted := true; + for var j := 0 to a.Length - 1 - i do + begin + if Ord&[T].greater(a[i - 1], a[i]) then + begin + swap(a[i - 1], a[i]); + sorted := false; + end; + end; + + if sorted then + break; + end; +end; +*) // ---Test Functions--- @@ -147,11 +227,26 @@ begin writeln(isCorrect); end; +(* +procedure TestOrd(); +begin + var a := Arr(3, 1, 4, 2, 5, 0); + var res := Arr(a); + + Sort(res); + MySort&[integer](a); + + var isCorrect := a.SequenceEqual(res); + writeln(isCorrect); + +end; +*) begin TestEq(); TestShow(); TestRead(); + // TestOrd(); end. \ No newline at end of file diff --git a/CodeExamples/TypeclassHybridInheritanceTranslation.pas b/CodeExamples/TypeclassHybridInheritanceTranslation.pas index d1f885e31..6dd762198 100644 --- a/CodeExamples/TypeclassHybridInheritanceTranslation.pas +++ b/CodeExamples/TypeclassHybridInheritanceTranslation.pas @@ -39,8 +39,7 @@ function compare(x, y: T): Ordering; virtual; begin - var eqInst := __ConceptSingleton&.&Instance; - if eqInst.eequal(x, y) then + if eequal(x, y) then Result := _EQ else if less(x, y) then Result := _LT @@ -108,7 +107,7 @@ function compare(x, y: integer): Ordering; override; begin - if self.eequal(x, y) then + if eequal(x, y) then Result := _EQ else if x < y then Result := _LT @@ -118,6 +117,19 @@ end; +function ArrayEq(l1, l2: array of T): boolean; where EqT: IEq, constructor; +begin + var eqtinstance := __ConceptSingleton&.&Instance; + Result := true; + for var i :=0 to l1.Length - 1 do + if eqtinstance.notEqual(l1[i], l2[i]) then + begin + Result := false; + break; + end; +end; + + function Max3(v1, v2, v3: T): T; where OrdT: IOrd, constructor; begin diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs b/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs index f77034002..53c9df4bb 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs @@ -1,9 +1,9 @@ // // This CSharp output file generated by Gardens Point LEX // Version: 1.1.3.301 -// Machine: OBERON -// DateTime: 4/18/2018 6:59:00 PM -// UserName: voganesyan +// Machine: DESKTOP-7B4K9VB +// DateTime: 08.05.2018 15:03:52 +// UserName: Bogdan // GPLEX input file // GPLEX frame file // diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascal.y b/Parsers/PascalABCParserNewSaushkin/ABCPascal.y index c735c5cdd..2d4bcb5e9 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascal.y +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascal.y @@ -1561,6 +1561,11 @@ base_class_name { $$ = $1; } | template_type { $$ = $1; } + | typeclass_restriction + { + var names = new List(); + names.Add(($1 as typeclass_restriction).name); + $$ = new typeclass_reference(null, names, ($1 as typeclass_restriction).restriction_args); } ; template_arguments diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs b/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs index d872f7bca..8f3c4db9c 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs @@ -1,9 +1,9 @@ // (see accompanying GPPGcopyright.rtf) // GPPG version 1.3.6 -// Machine: OBERON -// DateTime: 4/18/2018 6:59:00 PM -// UserName: voganesyan +// Machine: DESKTOP-7B4K9VB +// DateTime: 08.05.2018 15:03:53 +// UserName: Bogdan // Input file // options: no-lines gplex @@ -74,8 +74,8 @@ public partial class GPPGParser: ShiftReduceParser aliasses; #pragma warning restore 649 - private static Rule[] rules = new Rule[858]; - private static State[] states = new State[1397]; + private static Rule[] rules = new Rule[859]; + private static State[] states = new State[1398]; private static string[] nonTerms = new string[] { "parse_goal", "unit_key_word", "assignment", "optional_array_initializer", "attribute_declarations", "ot_visibility_specifier", "one_attribute", "attribute_variable", @@ -156,13 +156,13 @@ public partial class GPPGParser: ShiftReduceParser template_type { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].td; } break; - case 309: // template_arguments -> tkLower, ident_list, tkGreater + case 309: // base_class_name -> typeclass_restriction +{ + var names = new List(); + names.Add((ValueStack[ValueStack.Depth-1].id as typeclass_restriction).name); + CurrentSemanticValue.stn = new typeclass_reference(null, names, (ValueStack[ValueStack.Depth-1].id as typeclass_restriction).restriction_args); } + break; + case 310: // template_arguments -> tkLower, ident_list, tkGreater { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-2].stn; CurrentSemanticValue.stn.source_context = CurrentLocationSpan; } break; - case 310: // optional_where_section -> /* empty */ + case 311: // optional_where_section -> /* empty */ { CurrentSemanticValue.stn = null; } break; - case 311: // optional_where_section -> where_part_list + case 312: // optional_where_section -> where_part_list { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 312: // where_part_list -> where_part + case 313: // where_part_list -> where_part { CurrentSemanticValue.stn = new where_definition_list(ValueStack[ValueStack.Depth-1].stn as where_definition, CurrentLocationSpan); } break; - case 313: // where_part_list -> where_part_list, where_part + case 314: // where_part_list -> where_part_list, where_part { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-2].stn as where_definition_list).Add(ValueStack[ValueStack.Depth-1].stn as where_definition, CurrentLocationSpan); } break; - case 314: // where_part -> tkWhere, ident_list, tkColon, type_ref_and_secific_list, + case 315: // where_part -> tkWhere, ident_list, tkColon, type_ref_and_secific_list, // tkSemiColon { CurrentSemanticValue.stn = new where_definition(ValueStack[ValueStack.Depth-4].stn as ident_list, ValueStack[ValueStack.Depth-2].stn as where_type_specificator_list, CurrentLocationSpan); } break; - case 315: // where_part -> tkWhere, typeclass_restriction, tkSemiColon + case 316: // where_part -> tkWhere, typeclass_restriction, tkSemiColon { CurrentSemanticValue.stn = new where_typeclass_constraint(ValueStack[ValueStack.Depth-2].id as typeclass_restriction); } break; - case 316: // type_ref_and_secific_list -> type_ref_or_secific + case 317: // type_ref_and_secific_list -> type_ref_or_secific { CurrentSemanticValue.stn = new where_type_specificator_list(ValueStack[ValueStack.Depth-1].td, CurrentLocationSpan); } break; - case 317: // type_ref_and_secific_list -> type_ref_and_secific_list, tkComma, + case 318: // type_ref_and_secific_list -> type_ref_and_secific_list, tkComma, // type_ref_or_secific { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-3].stn as where_type_specificator_list).Add(ValueStack[ValueStack.Depth-1].td, CurrentLocationSpan); } break; - case 318: // type_ref_or_secific -> type_ref + case 319: // type_ref_or_secific -> type_ref { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 319: // type_ref_or_secific -> tkClass + case 320: // type_ref_or_secific -> tkClass { CurrentSemanticValue.td = new declaration_specificator(DeclarationSpecificator.WhereDefClass, ValueStack[ValueStack.Depth-1].ti.text, CurrentLocationSpan); } break; - case 320: // type_ref_or_secific -> tkRecord + case 321: // type_ref_or_secific -> tkRecord { CurrentSemanticValue.td = new declaration_specificator(DeclarationSpecificator.WhereDefValueType, ValueStack[ValueStack.Depth-1].ti.text, CurrentLocationSpan); } break; - case 321: // type_ref_or_secific -> tkConstructor + case 322: // type_ref_or_secific -> tkConstructor { CurrentSemanticValue.td = new declaration_specificator(DeclarationSpecificator.WhereDefConstructor, ValueStack[ValueStack.Depth-1].ti.text, CurrentLocationSpan); } break; - case 322: // member_list_section -> member_list + case 323: // member_list_section -> member_list { CurrentSemanticValue.stn = new class_body_list(ValueStack[ValueStack.Depth-1].stn as class_members, CurrentLocationSpan); } break; - case 323: // member_list_section -> member_list_section, ot_visibility_specifier, + case 324: // member_list_section -> member_list_section, ot_visibility_specifier, // member_list { (ValueStack[ValueStack.Depth-1].stn as class_members).access_mod = ValueStack[ValueStack.Depth-2].stn as access_modifer_node; @@ -3826,115 +3834,115 @@ public partial class GPPGParser: ShiftReduceParser tkInternal + case 325: // ot_visibility_specifier -> tkInternal { CurrentSemanticValue.stn = new access_modifer_node(access_modifer.internal_modifer, CurrentLocationSpan); } break; - case 325: // ot_visibility_specifier -> tkPublic + case 326: // ot_visibility_specifier -> tkPublic { CurrentSemanticValue.stn = new access_modifer_node(access_modifer.public_modifer, CurrentLocationSpan); } break; - case 326: // ot_visibility_specifier -> tkProtected + case 327: // ot_visibility_specifier -> tkProtected { CurrentSemanticValue.stn = new access_modifer_node(access_modifer.protected_modifer, CurrentLocationSpan); } break; - case 327: // ot_visibility_specifier -> tkPrivate + case 328: // ot_visibility_specifier -> tkPrivate { CurrentSemanticValue.stn = new access_modifer_node(access_modifer.private_modifer, CurrentLocationSpan); } break; - case 328: // member_list -> /* empty */ + case 329: // member_list -> /* empty */ { CurrentSemanticValue.stn = new class_members(); } break; - case 329: // member_list -> field_or_const_definition_list, optional_semicolon + case 330: // member_list -> field_or_const_definition_list, optional_semicolon { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-2].stn; } break; - case 330: // member_list -> method_decl_list + case 331: // member_list -> method_decl_list { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 331: // member_list -> field_or_const_definition_list, tkSemiColon, method_decl_list + case 332: // member_list -> field_or_const_definition_list, tkSemiColon, method_decl_list { (ValueStack[ValueStack.Depth-3].stn as class_members).members.AddRange((ValueStack[ValueStack.Depth-1].stn as class_members).members); (ValueStack[ValueStack.Depth-3].stn as class_members).source_context = CurrentLocationSpan; CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-3].stn; } break; - case 332: // ident_list -> identifier + case 333: // ident_list -> identifier { CurrentSemanticValue.stn = new ident_list(ValueStack[ValueStack.Depth-1].id, CurrentLocationSpan); } break; - case 333: // ident_list -> ident_list, tkComma, identifier + case 334: // ident_list -> ident_list, tkComma, identifier { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-3].stn as ident_list).Add(ValueStack[ValueStack.Depth-1].id, CurrentLocationSpan); } break; - case 334: // optional_semicolon -> /* empty */ + case 335: // optional_semicolon -> /* empty */ { CurrentSemanticValue.ob = null; } break; - case 335: // optional_semicolon -> tkSemiColon + case 336: // optional_semicolon -> tkSemiColon { CurrentSemanticValue.ob = ValueStack[ValueStack.Depth-1].ti; } break; - case 336: // field_or_const_definition_list -> field_or_const_definition + case 337: // field_or_const_definition_list -> field_or_const_definition { CurrentSemanticValue.stn = new class_members(ValueStack[ValueStack.Depth-1].stn as declaration, CurrentLocationSpan); } break; - case 337: // field_or_const_definition_list -> field_or_const_definition_list, tkSemiColon, + case 338: // field_or_const_definition_list -> field_or_const_definition_list, tkSemiColon, // field_or_const_definition { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-3].stn as class_members).Add(ValueStack[ValueStack.Depth-1].stn as declaration, CurrentLocationSpan); } break; - case 338: // field_or_const_definition -> attribute_declarations, + case 339: // field_or_const_definition -> attribute_declarations, // simple_field_or_const_definition { (ValueStack[ValueStack.Depth-1].stn as declaration).attributes = ValueStack[ValueStack.Depth-2].stn as attribute_list; CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 339: // method_decl_list -> method_or_property_decl + case 340: // method_decl_list -> method_or_property_decl { CurrentSemanticValue.stn = new class_members(ValueStack[ValueStack.Depth-1].stn as declaration, CurrentLocationSpan); } break; - case 340: // method_decl_list -> method_decl_list, method_or_property_decl + case 341: // method_decl_list -> method_decl_list, method_or_property_decl { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-2].stn as class_members).Add(ValueStack[ValueStack.Depth-1].stn as declaration, CurrentLocationSpan); } break; - case 341: // method_or_property_decl -> method_decl_withattr + case 342: // method_or_property_decl -> method_decl_withattr { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 342: // method_or_property_decl -> property_definition + case 343: // method_or_property_decl -> property_definition { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 343: // simple_field_or_const_definition -> tkConst, only_const_decl + case 344: // simple_field_or_const_definition -> tkConst, only_const_decl { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; CurrentSemanticValue.stn.source_context = CurrentLocationSpan; } break; - case 344: // simple_field_or_const_definition -> field_definition + case 345: // simple_field_or_const_definition -> field_definition { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 345: // simple_field_or_const_definition -> tkClass, field_definition + case 346: // simple_field_or_const_definition -> tkClass, field_definition { (ValueStack[ValueStack.Depth-1].stn as var_def_statement).var_attr = definition_attribute.Static; (ValueStack[ValueStack.Depth-1].stn as var_def_statement).source_context = CurrentLocationSpan; CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 346: // field_definition -> var_decl_part + case 347: // field_definition -> var_decl_part { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 347: // field_definition -> tkEvent, ident_list, tkColon, type_ref + case 348: // field_definition -> tkEvent, ident_list, tkColon, type_ref { CurrentSemanticValue.stn = new var_def_statement(ValueStack[ValueStack.Depth-3].stn as ident_list, ValueStack[ValueStack.Depth-1].td, null, definition_attribute.None, true, CurrentLocationSpan); } break; - case 348: // method_decl_withattr -> attribute_declarations, method_header + case 349: // method_decl_withattr -> attribute_declarations, method_header { (ValueStack[ValueStack.Depth-1].td as declaration).attributes = ValueStack[ValueStack.Depth-2].stn as attribute_list; CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].td; } break; - case 349: // method_decl_withattr -> attribute_declarations, method_decl + case 350: // method_decl_withattr -> attribute_declarations, method_decl { (ValueStack[ValueStack.Depth-1].stn as declaration).attributes = ValueStack[ValueStack.Depth-2].stn as attribute_list; if (ValueStack[ValueStack.Depth-1].stn is procedure_definition && (ValueStack[ValueStack.Depth-1].stn as procedure_definition).proc_header != null) @@ -3942,96 +3950,96 @@ public partial class GPPGParser: ShiftReduceParser inclass_proc_func_decl + case 351: // method_decl -> inclass_proc_func_decl { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 351: // method_decl -> inclass_constr_destr_decl + case 352: // method_decl -> inclass_constr_destr_decl { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 352: // method_header -> tkClass, method_procfunc_header + case 353: // method_header -> tkClass, method_procfunc_header { (ValueStack[ValueStack.Depth-1].td as procedure_header).class_keyword = true; CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 353: // method_header -> method_procfunc_header + case 354: // method_header -> method_procfunc_header { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 354: // method_header -> constr_destr_header + case 355: // method_header -> constr_destr_header { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 355: // method_procfunc_header -> proc_func_header + case 356: // method_procfunc_header -> proc_func_header { CurrentSemanticValue.td = NewProcfuncHeading(ValueStack[ValueStack.Depth-1].td as procedure_header); } break; - case 356: // proc_func_header -> proc_header + case 357: // proc_func_header -> proc_header { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 357: // proc_func_header -> func_header + case 358: // proc_func_header -> func_header { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 358: // constr_destr_header -> tkConstructor, optional_proc_name, fp_list, + case 359: // constr_destr_header -> tkConstructor, optional_proc_name, fp_list, // optional_method_modificators { CurrentSemanticValue.td = new constructor(null,ValueStack[ValueStack.Depth-2].stn as formal_parameters,ValueStack[ValueStack.Depth-1].stn as procedure_attributes_list,ValueStack[ValueStack.Depth-3].stn as method_name,false,false,null,null,CurrentLocationSpan); } break; - case 359: // constr_destr_header -> tkClass, tkConstructor, optional_proc_name, fp_list, + case 360: // constr_destr_header -> tkClass, tkConstructor, optional_proc_name, fp_list, // optional_method_modificators { CurrentSemanticValue.td = new constructor(null,ValueStack[ValueStack.Depth-2].stn as formal_parameters,ValueStack[ValueStack.Depth-1].stn as procedure_attributes_list,ValueStack[ValueStack.Depth-3].stn as method_name,false,true,null,null,CurrentLocationSpan); } break; - case 360: // constr_destr_header -> tkDestructor, optional_proc_name, fp_list, + case 361: // constr_destr_header -> tkDestructor, optional_proc_name, fp_list, // optional_method_modificators { CurrentSemanticValue.td = new destructor(null,ValueStack[ValueStack.Depth-2].stn as formal_parameters,ValueStack[ValueStack.Depth-1].stn as procedure_attributes_list,ValueStack[ValueStack.Depth-3].stn as method_name, false,false,null,null,CurrentLocationSpan); } break; - case 361: // optional_proc_name -> proc_name + case 362: // optional_proc_name -> proc_name { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 362: // optional_proc_name -> /* empty */ + case 363: // optional_proc_name -> /* empty */ { CurrentSemanticValue.stn = null; } break; - case 363: // qualified_identifier -> identifier + case 364: // qualified_identifier -> identifier { CurrentSemanticValue.stn = new method_name(null,null,ValueStack[ValueStack.Depth-1].id,null,CurrentLocationSpan); } break; - case 364: // qualified_identifier -> visibility_specifier + case 365: // qualified_identifier -> visibility_specifier { CurrentSemanticValue.stn = new method_name(null,null,ValueStack[ValueStack.Depth-1].id,null,CurrentLocationSpan); } break; - case 365: // qualified_identifier -> qualified_identifier, tkPoint, identifier + case 366: // qualified_identifier -> qualified_identifier, tkPoint, identifier { CurrentSemanticValue.stn = NewQualifiedIdentifier(ValueStack[ValueStack.Depth-3].stn as method_name, ValueStack[ValueStack.Depth-1].id, CurrentLocationSpan); } break; - case 366: // qualified_identifier -> qualified_identifier, tkPoint, visibility_specifier + case 367: // qualified_identifier -> qualified_identifier, tkPoint, visibility_specifier { CurrentSemanticValue.stn = NewQualifiedIdentifier(ValueStack[ValueStack.Depth-3].stn as method_name, ValueStack[ValueStack.Depth-1].id, CurrentLocationSpan); } break; - case 367: // property_definition -> attribute_declarations, simple_prim_property_definition + case 368: // property_definition -> attribute_declarations, simple_prim_property_definition { CurrentSemanticValue.stn = NewPropertyDefinition(ValueStack[ValueStack.Depth-2].stn as attribute_list, ValueStack[ValueStack.Depth-1].stn as declaration, LocationStack[LocationStack.Depth-1]); } break; - case 368: // simple_prim_property_definition -> simple_property_definition + case 369: // simple_prim_property_definition -> simple_property_definition { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 369: // simple_prim_property_definition -> tkClass, simple_property_definition + case 370: // simple_prim_property_definition -> tkClass, simple_property_definition { CurrentSemanticValue.stn = NewSimplePrimPropertyDefinition(ValueStack[ValueStack.Depth-1].stn as simple_property, CurrentLocationSpan); } break; - case 370: // simple_property_definition -> tkProperty, qualified_identifier, + case 371: // simple_property_definition -> tkProperty, qualified_identifier, // property_interface, property_specifiers, // tkSemiColon, array_defaultproperty { CurrentSemanticValue.stn = NewSimplePropertyDefinition(ValueStack[ValueStack.Depth-5].stn as method_name, ValueStack[ValueStack.Depth-4].stn as property_interface, ValueStack[ValueStack.Depth-3].stn as property_accessors, proc_attribute.attr_none, ValueStack[ValueStack.Depth-1].stn as property_array_default, CurrentLocationSpan); } break; - case 371: // simple_property_definition -> tkProperty, qualified_identifier, + case 372: // simple_property_definition -> tkProperty, qualified_identifier, // property_interface, property_specifiers, // tkSemiColon, property_modificator, tkSemiColon, // array_defaultproperty @@ -4044,109 +4052,109 @@ public partial class GPPGParser: ShiftReduceParser /* empty */ + case 373: // array_defaultproperty -> /* empty */ { CurrentSemanticValue.stn = null; } break; - case 373: // array_defaultproperty -> tkDefault, tkSemiColon + case 374: // array_defaultproperty -> tkDefault, tkSemiColon { CurrentSemanticValue.stn = new property_array_default(); CurrentSemanticValue.stn.source_context = CurrentLocationSpan; } break; - case 374: // property_interface -> /* empty */ + case 375: // property_interface -> /* empty */ { CurrentSemanticValue.stn = null; } break; - case 375: // property_interface -> property_parameter_list, tkColon, fptype + case 376: // property_interface -> property_parameter_list, tkColon, fptype { CurrentSemanticValue.stn = new property_interface(ValueStack[ValueStack.Depth-3].stn as property_parameter_list, ValueStack[ValueStack.Depth-1].td, null, CurrentLocationSpan); } break; - case 376: // property_parameter_list -> /* empty */ + case 377: // property_parameter_list -> /* empty */ { CurrentSemanticValue.stn = null; } break; - case 377: // property_parameter_list -> tkSquareOpen, parameter_decl_list, tkSquareClose + case 378: // property_parameter_list -> tkSquareOpen, parameter_decl_list, tkSquareClose { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-2].stn; } break; - case 378: // parameter_decl_list -> parameter_decl + case 379: // parameter_decl_list -> parameter_decl { CurrentSemanticValue.stn = new property_parameter_list(ValueStack[ValueStack.Depth-1].stn as property_parameter, CurrentLocationSpan); } break; - case 379: // parameter_decl_list -> parameter_decl_list, tkSemiColon, parameter_decl + case 380: // parameter_decl_list -> parameter_decl_list, tkSemiColon, parameter_decl { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-3].stn as property_parameter_list).Add(ValueStack[ValueStack.Depth-1].stn as property_parameter, CurrentLocationSpan); } break; - case 380: // parameter_decl -> ident_list, tkColon, fptype + case 381: // parameter_decl -> ident_list, tkColon, fptype { CurrentSemanticValue.stn = new property_parameter(ValueStack[ValueStack.Depth-3].stn as ident_list, ValueStack[ValueStack.Depth-1].td, CurrentLocationSpan); } break; - case 381: // optional_identifier -> identifier + case 382: // optional_identifier -> identifier { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 382: // optional_identifier -> /* empty */ + case 383: // optional_identifier -> /* empty */ { CurrentSemanticValue.id = null; } break; - case 384: // property_specifiers -> tkRead, optional_identifier, write_property_specifiers + case 385: // property_specifiers -> tkRead, optional_identifier, write_property_specifiers { CurrentSemanticValue.stn = NewPropertySpecifiersRead(ValueStack[ValueStack.Depth-3].id, ValueStack[ValueStack.Depth-2].id, ValueStack[ValueStack.Depth-1].stn as property_accessors, CurrentLocationSpan); } break; - case 385: // property_specifiers -> tkWrite, optional_identifier, read_property_specifiers + case 386: // property_specifiers -> tkWrite, optional_identifier, read_property_specifiers { CurrentSemanticValue.stn = NewPropertySpecifiersWrite(ValueStack[ValueStack.Depth-3].id, ValueStack[ValueStack.Depth-2].id, ValueStack[ValueStack.Depth-1].stn as property_accessors, CurrentLocationSpan); } break; - case 387: // write_property_specifiers -> tkWrite, optional_identifier + case 388: // write_property_specifiers -> tkWrite, optional_identifier { CurrentSemanticValue.stn = NewPropertySpecifiersWrite(ValueStack[ValueStack.Depth-2].id, ValueStack[ValueStack.Depth-1].id, null, CurrentLocationSpan); } break; - case 389: // read_property_specifiers -> tkRead, optional_identifier + case 390: // read_property_specifiers -> tkRead, optional_identifier { CurrentSemanticValue.stn = NewPropertySpecifiersRead(ValueStack[ValueStack.Depth-2].id, ValueStack[ValueStack.Depth-1].id, null, CurrentLocationSpan); } break; - case 390: // var_decl -> var_decl_part, tkSemiColon + case 391: // var_decl -> var_decl_part, tkSemiColon { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-2].stn; } break; - case 393: // var_decl_part -> ident_list, tkColon, type_ref + case 394: // var_decl_part -> ident_list, tkColon, type_ref { CurrentSemanticValue.stn = new var_def_statement(ValueStack[ValueStack.Depth-3].stn as ident_list, ValueStack[ValueStack.Depth-1].td, null, definition_attribute.None, false, CurrentLocationSpan); } break; - case 394: // var_decl_part -> ident_list, tkAssign, expr + case 395: // var_decl_part -> ident_list, tkAssign, expr { CurrentSemanticValue.stn = new var_def_statement(ValueStack[ValueStack.Depth-3].stn as ident_list, null, ValueStack[ValueStack.Depth-1].ex, definition_attribute.None, false, CurrentLocationSpan); } break; - case 395: // var_decl_part -> ident_list, tkColon, type_ref, tkAssignOrEqual, + case 396: // var_decl_part -> ident_list, tkColon, type_ref, tkAssignOrEqual, // typed_var_init_expression { CurrentSemanticValue.stn = new var_def_statement(ValueStack[ValueStack.Depth-5].stn as ident_list, ValueStack[ValueStack.Depth-3].td, ValueStack[ValueStack.Depth-1].ex, definition_attribute.None, false, CurrentLocationSpan); } break; - case 396: // typed_var_init_expression -> typed_const_plus + case 397: // typed_var_init_expression -> typed_const_plus { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 397: // typed_var_init_expression -> expl_func_decl_lambda + case 398: // typed_var_init_expression -> expl_func_decl_lambda { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 398: // typed_var_init_expression -> identifier, tkArrow, lambda_function_body + case 399: // typed_var_init_expression -> identifier, tkArrow, lambda_function_body { var idList = new ident_list(ValueStack[ValueStack.Depth-3].id, LocationStack[LocationStack.Depth-3]); var formalPars = new formal_parameters(new typed_parameters(idList, new lambda_inferred_type(new PascalABCCompiler.TreeRealization.lambda_any_type_node(), LocationStack[LocationStack.Depth-3]), parametr_kind.none, null, LocationStack[LocationStack.Depth-3]), LocationStack[LocationStack.Depth-3]); CurrentSemanticValue.ex = new function_lambda_definition(lambdaHelper.CreateLambdaName(), formalPars, new lambda_inferred_type(new PascalABCCompiler.TreeRealization.lambda_any_type_node(), LocationStack[LocationStack.Depth-3]), ValueStack[ValueStack.Depth-1].stn as statement_list, CurrentLocationSpan); } break; - case 399: // typed_var_init_expression -> tkRoundOpen, tkRoundClose, lambda_type_ref, + case 400: // typed_var_init_expression -> tkRoundOpen, tkRoundClose, lambda_type_ref, // tkArrow, lambda_function_body { CurrentSemanticValue.ex = new function_lambda_definition(lambdaHelper.CreateLambdaName(), null, ValueStack[ValueStack.Depth-3].td, ValueStack[ValueStack.Depth-1].stn as statement_list, CurrentLocationSpan); } break; - case 400: // typed_var_init_expression -> tkRoundOpen, typed_const_list, tkRoundClose, + case 401: // typed_var_init_expression -> tkRoundOpen, typed_const_list, tkRoundClose, // tkArrow, lambda_function_body { var el = ValueStack[ValueStack.Depth-4].stn as expression_list; @@ -4168,18 +4176,18 @@ public partial class GPPGParser: ShiftReduceParser typed_const + case 402: // typed_const_plus -> typed_const { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 402: // typed_const_plus -> default_expr + case 403: // typed_const_plus -> default_expr { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 403: // constr_destr_decl -> constr_destr_header, block + case 404: // constr_destr_decl -> constr_destr_header, block { CurrentSemanticValue.stn = new procedure_definition(ValueStack[ValueStack.Depth-2].td as procedure_header, ValueStack[ValueStack.Depth-1].stn as block, CurrentLocationSpan); } break; - case 404: // constr_destr_decl -> tkConstructor, optional_proc_name, fp_list, tkAssign, + case 405: // constr_destr_decl -> tkConstructor, optional_proc_name, fp_list, tkAssign, // unlabelled_stmt, tkSemiColon { if (ValueStack[ValueStack.Depth-2].stn is empty_statement) @@ -4190,12 +4198,12 @@ public partial class GPPGParser: ShiftReduceParser constr_destr_header, inclass_block + case 406: // inclass_constr_destr_decl -> constr_destr_header, inclass_block { CurrentSemanticValue.stn = new procedure_definition(ValueStack[ValueStack.Depth-2].td as procedure_header, ValueStack[ValueStack.Depth-1].stn as block, CurrentLocationSpan); } break; - case 406: // inclass_constr_destr_decl -> tkConstructor, optional_proc_name, fp_list, + case 407: // inclass_constr_destr_decl -> tkConstructor, optional_proc_name, fp_list, // tkAssign, unlabelled_stmt, tkSemiColon { if (ValueStack[ValueStack.Depth-2].stn is empty_statement) @@ -4206,49 +4214,49 @@ public partial class GPPGParser: ShiftReduceParser proc_func_decl_noclass + case 408: // proc_func_decl -> proc_func_decl_noclass { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 408: // proc_func_decl -> tkClass, proc_func_decl_noclass + case 409: // proc_func_decl -> tkClass, proc_func_decl_noclass { (ValueStack[ValueStack.Depth-1].stn as procedure_definition).proc_header.class_keyword = true; CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 409: // proc_func_decl_noclass -> proc_func_header, proc_func_external_block + case 410: // proc_func_decl_noclass -> proc_func_header, proc_func_external_block { CurrentSemanticValue.stn = new procedure_definition(ValueStack[ValueStack.Depth-2].td as procedure_header, ValueStack[ValueStack.Depth-1].stn as proc_block, CurrentLocationSpan); } break; - case 410: // proc_func_decl_noclass -> tkFunction, func_name, fp_list, tkColon, fptype, + case 411: // proc_func_decl_noclass -> tkFunction, func_name, fp_list, tkColon, fptype, // optional_method_modificators1, tkAssign, expr_l1, // 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])); } break; - case 411: // proc_func_decl_noclass -> tkFunction, func_name, fp_list, + case 412: // proc_func_decl_noclass -> tkFunction, func_name, fp_list, // optional_method_modificators1, tkAssign, expr_l1, // 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])); } break; - case 412: // proc_func_decl_noclass -> tkFunction, func_name, fp_list, tkColon, fptype, + case 413: // proc_func_decl_noclass -> tkFunction, func_name, fp_list, tkColon, fptype, // optional_method_modificators1, tkAssign, // func_decl_lambda, 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])); } break; - case 413: // proc_func_decl_noclass -> tkFunction, func_name, fp_list, + case 414: // proc_func_decl_noclass -> tkFunction, func_name, fp_list, // optional_method_modificators1, tkAssign, // 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])); } break; - case 414: // proc_func_decl_noclass -> tkProcedure, proc_name, fp_list, + case 415: // proc_func_decl_noclass -> tkProcedure, proc_name, fp_list, // optional_method_modificators1, tkAssign, // unlabelled_stmt, tkSemiColon { @@ -4257,30 +4265,30 @@ public partial class GPPGParser: ShiftReduceParser proc_func_header, tkForward, tkSemiColon + case 416: // proc_func_decl_noclass -> proc_func_header, tkForward, tkSemiColon { CurrentSemanticValue.stn = new procedure_definition(ValueStack[ValueStack.Depth-3].td as procedure_header, null, CurrentLocationSpan); (CurrentSemanticValue.stn as procedure_definition).proc_header.proc_attributes.Add((procedure_attribute)ValueStack[ValueStack.Depth-2].id, ValueStack[ValueStack.Depth-2].id.source_context); } break; - case 416: // inclass_proc_func_decl -> inclass_proc_func_decl_noclass + case 417: // inclass_proc_func_decl -> inclass_proc_func_decl_noclass { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 417: // inclass_proc_func_decl -> tkClass, inclass_proc_func_decl_noclass + case 418: // inclass_proc_func_decl -> tkClass, inclass_proc_func_decl_noclass { if ((ValueStack[ValueStack.Depth-1].stn as procedure_definition).proc_header != null) (ValueStack[ValueStack.Depth-1].stn as procedure_definition).proc_header.class_keyword = true; CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 418: // inclass_proc_func_decl_noclass -> proc_func_header, inclass_block + case 419: // inclass_proc_func_decl_noclass -> proc_func_header, inclass_block { CurrentSemanticValue.stn = new procedure_definition(ValueStack[ValueStack.Depth-2].td as procedure_header, ValueStack[ValueStack.Depth-1].stn as proc_block, CurrentLocationSpan); } break; - case 419: // inclass_proc_func_decl_noclass -> tkFunction, func_name, fp_list, tkColon, + case 420: // inclass_proc_func_decl_noclass -> tkFunction, func_name, fp_list, tkColon, // fptype, optional_method_modificators1, // tkAssign, expr_l1, tkSemiColon { @@ -4289,7 +4297,7 @@ public partial class GPPGParser: ShiftReduceParser tkFunction, func_name, fp_list, + case 421: // inclass_proc_func_decl_noclass -> tkFunction, func_name, fp_list, // optional_method_modificators1, tkAssign, // expr_l1, tkSemiColon { @@ -4298,7 +4306,7 @@ public partial class GPPGParser: ShiftReduceParser tkProcedure, proc_name, fp_list, + case 422: // inclass_proc_func_decl_noclass -> tkProcedure, proc_name, fp_list, // optional_method_modificators1, tkAssign, // unlabelled_stmt, tkSemiColon { @@ -4307,21 +4315,21 @@ public partial class GPPGParser: ShiftReduceParser block + case 423: // proc_func_external_block -> block { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 423: // proc_func_external_block -> external_block + case 424: // proc_func_external_block -> external_block { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 424: // proc_name -> func_name + case 425: // proc_name -> func_name { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 425: // func_name -> func_meth_name_ident + case 426: // func_name -> func_meth_name_ident { CurrentSemanticValue.stn = new method_name(null,null, ValueStack[ValueStack.Depth-1].id, null, CurrentLocationSpan); } break; - case 426: // func_name -> func_class_name_ident_list, tkPoint, func_meth_name_ident + case 427: // func_name -> func_class_name_ident_list, tkPoint, func_meth_name_ident { var ln = ValueStack[ValueStack.Depth-3].ob as List; var cnt = ln.Count; @@ -4331,288 +4339,288 @@ public partial class GPPGParser: ShiftReduceParser func_name_with_template_args + case 428: // func_class_name_ident -> func_name_with_template_args { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 428: // func_class_name_ident_list -> func_class_name_ident + case 429: // func_class_name_ident_list -> func_class_name_ident { CurrentSemanticValue.ob = new List(); (CurrentSemanticValue.ob as List).Add(ValueStack[ValueStack.Depth-1].id); } break; - case 429: // func_class_name_ident_list -> func_class_name_ident_list, tkPoint, + case 430: // func_class_name_ident_list -> func_class_name_ident_list, tkPoint, // func_class_name_ident { (ValueStack[ValueStack.Depth-3].ob as List).Add(ValueStack[ValueStack.Depth-1].id); CurrentSemanticValue.ob = ValueStack[ValueStack.Depth-3].ob; } break; - case 430: // func_meth_name_ident -> func_name_with_template_args + case 431: // func_meth_name_ident -> func_name_with_template_args { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 431: // func_meth_name_ident -> operator_name_ident + case 432: // func_meth_name_ident -> operator_name_ident { CurrentSemanticValue.id = (ident)ValueStack[ValueStack.Depth-1].ex; } break; - case 432: // func_meth_name_ident -> operator_name_ident, template_arguments + case 433: // func_meth_name_ident -> operator_name_ident, template_arguments { CurrentSemanticValue.id = new template_operator_name(null, ValueStack[ValueStack.Depth-1].stn as ident_list, ValueStack[ValueStack.Depth-2].ex as operator_name_ident, CurrentLocationSpan); } break; - case 433: // func_name_with_template_args -> func_name_ident + case 434: // func_name_with_template_args -> func_name_ident { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 434: // func_name_with_template_args -> func_name_ident, template_arguments + case 435: // func_name_with_template_args -> func_name_ident, template_arguments { CurrentSemanticValue.id = new template_type_name(ValueStack[ValueStack.Depth-2].id.name, ValueStack[ValueStack.Depth-1].stn as ident_list, CurrentLocationSpan); } break; - case 435: // func_name_ident -> identifier + case 436: // func_name_ident -> identifier { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 436: // proc_header -> tkProcedure, proc_name, fp_list, optional_method_modificators, + case 437: // proc_header -> tkProcedure, proc_name, fp_list, optional_method_modificators, // optional_where_section { CurrentSemanticValue.td = new procedure_header(ValueStack[ValueStack.Depth-3].stn as formal_parameters, ValueStack[ValueStack.Depth-2].stn as procedure_attributes_list, ValueStack[ValueStack.Depth-4].stn as method_name, ValueStack[ValueStack.Depth-1].stn as where_definition_list, CurrentLocationSpan); } break; - case 437: // func_header -> tkFunction, func_name, fp_list, optional_method_modificators, + case 438: // func_header -> tkFunction, func_name, fp_list, optional_method_modificators, // optional_where_section { CurrentSemanticValue.td = new function_header(ValueStack[ValueStack.Depth-3].stn as formal_parameters, ValueStack[ValueStack.Depth-2].stn as procedure_attributes_list, ValueStack[ValueStack.Depth-4].stn as method_name, ValueStack[ValueStack.Depth-1].stn as where_definition_list, null, CurrentLocationSpan); } break; - case 438: // func_header -> tkFunction, func_name, fp_list, tkColon, fptype, + case 439: // func_header -> tkFunction, func_name, fp_list, tkColon, fptype, // optional_method_modificators, optional_where_section { CurrentSemanticValue.td = new function_header(ValueStack[ValueStack.Depth-5].stn as formal_parameters, ValueStack[ValueStack.Depth-2].stn as procedure_attributes_list, ValueStack[ValueStack.Depth-6].stn as method_name, ValueStack[ValueStack.Depth-1].stn as where_definition_list, ValueStack[ValueStack.Depth-3].td as type_definition, CurrentLocationSpan); } break; - case 439: // external_block -> tkExternal, external_directive_ident, tkName, + case 440: // external_block -> tkExternal, external_directive_ident, tkName, // external_directive_ident, tkSemiColon { CurrentSemanticValue.stn = new external_directive(ValueStack[ValueStack.Depth-4].ex, ValueStack[ValueStack.Depth-2].ex, CurrentLocationSpan); } break; - case 440: // external_block -> tkExternal, external_directive_ident, tkSemiColon + case 441: // external_block -> tkExternal, external_directive_ident, tkSemiColon { CurrentSemanticValue.stn = new external_directive(ValueStack[ValueStack.Depth-2].ex, null, CurrentLocationSpan); } break; - case 441: // external_block -> tkExternal, tkSemiColon + case 442: // external_block -> tkExternal, tkSemiColon { CurrentSemanticValue.stn = new external_directive(null, null, CurrentLocationSpan); } break; - case 442: // external_directive_ident -> identifier + case 443: // external_directive_ident -> identifier { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].id; } break; - case 443: // external_directive_ident -> literal + case 444: // external_directive_ident -> literal { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 444: // block -> decl_sect_list, compound_stmt, tkSemiColon + case 445: // block -> decl_sect_list, compound_stmt, tkSemiColon { CurrentSemanticValue.stn = new block(ValueStack[ValueStack.Depth-3].stn as declarations, ValueStack[ValueStack.Depth-2].stn as statement_list, CurrentLocationSpan); } break; - case 445: // inclass_block -> inclass_decl_sect_list, compound_stmt, tkSemiColon + case 446: // inclass_block -> inclass_decl_sect_list, compound_stmt, tkSemiColon { CurrentSemanticValue.stn = new block(ValueStack[ValueStack.Depth-3].stn as declarations, ValueStack[ValueStack.Depth-2].stn as statement_list, CurrentLocationSpan); } break; - case 446: // inclass_block -> external_block + case 447: // inclass_block -> external_block { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 447: // fp_list -> /* empty */ + case 448: // fp_list -> /* empty */ { CurrentSemanticValue.stn = null; } break; - case 448: // fp_list -> tkRoundOpen, tkRoundClose + case 449: // fp_list -> tkRoundOpen, tkRoundClose { CurrentSemanticValue.stn = null; } break; - case 449: // fp_list -> tkRoundOpen, fp_sect_list, tkRoundClose + case 450: // fp_list -> tkRoundOpen, fp_sect_list, tkRoundClose { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-2].stn; if (CurrentSemanticValue.stn != null) CurrentSemanticValue.stn.source_context = CurrentLocationSpan; } break; - case 450: // fp_sect_list -> fp_sect + case 451: // fp_sect_list -> fp_sect { CurrentSemanticValue.stn = new formal_parameters(ValueStack[ValueStack.Depth-1].stn as typed_parameters, CurrentLocationSpan); } break; - case 451: // fp_sect_list -> fp_sect_list, tkSemiColon, fp_sect + case 452: // fp_sect_list -> fp_sect_list, tkSemiColon, fp_sect { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-3].stn as formal_parameters).Add(ValueStack[ValueStack.Depth-1].stn as typed_parameters, CurrentLocationSpan); } break; - case 452: // fp_sect -> attribute_declarations, simple_fp_sect + case 453: // fp_sect -> attribute_declarations, simple_fp_sect { (ValueStack[ValueStack.Depth-1].stn as declaration).attributes = ValueStack[ValueStack.Depth-2].stn as attribute_list; CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 453: // simple_fp_sect -> param_name_list, tkColon, fptype + case 454: // simple_fp_sect -> param_name_list, tkColon, fptype { CurrentSemanticValue.stn = new typed_parameters(ValueStack[ValueStack.Depth-3].stn as ident_list, ValueStack[ValueStack.Depth-1].td, parametr_kind.none, null, CurrentLocationSpan); } break; - case 454: // simple_fp_sect -> tkVar, param_name_list, tkColon, fptype + case 455: // simple_fp_sect -> tkVar, param_name_list, tkColon, fptype { CurrentSemanticValue.stn = new typed_parameters(ValueStack[ValueStack.Depth-3].stn as ident_list, ValueStack[ValueStack.Depth-1].td, parametr_kind.var_parametr, null, CurrentLocationSpan); } break; - case 455: // simple_fp_sect -> tkConst, param_name_list, tkColon, fptype + case 456: // simple_fp_sect -> tkConst, param_name_list, tkColon, fptype { CurrentSemanticValue.stn = new typed_parameters(ValueStack[ValueStack.Depth-3].stn as ident_list, ValueStack[ValueStack.Depth-1].td, parametr_kind.const_parametr, null, CurrentLocationSpan); } break; - case 456: // simple_fp_sect -> tkParams, param_name_list, tkColon, fptype + case 457: // simple_fp_sect -> tkParams, param_name_list, tkColon, fptype { CurrentSemanticValue.stn = new typed_parameters(ValueStack[ValueStack.Depth-3].stn as ident_list, ValueStack[ValueStack.Depth-1].td,parametr_kind.params_parametr,null, CurrentLocationSpan); } break; - case 457: // simple_fp_sect -> param_name_list, tkColon, fptype, tkAssign, const_expr + case 458: // simple_fp_sect -> param_name_list, tkColon, fptype, tkAssign, const_expr { CurrentSemanticValue.stn = new typed_parameters(ValueStack[ValueStack.Depth-5].stn as ident_list, ValueStack[ValueStack.Depth-3].td, parametr_kind.none, ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 458: // simple_fp_sect -> tkVar, param_name_list, tkColon, fptype, tkAssign, const_expr + case 459: // simple_fp_sect -> tkVar, param_name_list, tkColon, fptype, tkAssign, const_expr { CurrentSemanticValue.stn = new typed_parameters(ValueStack[ValueStack.Depth-5].stn as ident_list, ValueStack[ValueStack.Depth-3].td, parametr_kind.var_parametr, ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 459: // simple_fp_sect -> tkConst, param_name_list, tkColon, fptype, tkAssign, + case 460: // simple_fp_sect -> tkConst, param_name_list, tkColon, fptype, tkAssign, // const_expr { CurrentSemanticValue.stn = new typed_parameters(ValueStack[ValueStack.Depth-5].stn as ident_list, ValueStack[ValueStack.Depth-3].td, parametr_kind.const_parametr, ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 460: // param_name_list -> param_name + case 461: // param_name_list -> param_name { CurrentSemanticValue.stn = new ident_list(ValueStack[ValueStack.Depth-1].id, CurrentLocationSpan); } break; - case 461: // param_name_list -> param_name_list, tkComma, param_name + case 462: // param_name_list -> param_name_list, tkComma, param_name { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-3].stn as ident_list).Add(ValueStack[ValueStack.Depth-1].id, CurrentLocationSpan); } break; - case 462: // param_name -> identifier + case 463: // param_name -> identifier { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 463: // fptype -> type_ref + case 464: // fptype -> type_ref { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 464: // fptype_noproctype -> simple_type + case 465: // fptype_noproctype -> simple_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 465: // fptype_noproctype -> string_type + case 466: // fptype_noproctype -> string_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 466: // fptype_noproctype -> pointer_type + case 467: // fptype_noproctype -> pointer_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 467: // fptype_noproctype -> structured_type + case 468: // fptype_noproctype -> structured_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 468: // fptype_noproctype -> template_type + case 469: // fptype_noproctype -> template_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 469: // stmt -> unlabelled_stmt + case 470: // stmt -> unlabelled_stmt { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 470: // stmt -> label_name, tkColon, stmt + case 471: // stmt -> label_name, tkColon, stmt { CurrentSemanticValue.stn = new labeled_statement(ValueStack[ValueStack.Depth-3].id, ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 471: // unlabelled_stmt -> /* empty */ + case 472: // unlabelled_stmt -> /* empty */ { CurrentSemanticValue.stn = new empty_statement(); CurrentSemanticValue.stn.source_context = null; } break; - case 472: // unlabelled_stmt -> assignment + case 473: // unlabelled_stmt -> assignment { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 473: // unlabelled_stmt -> proc_call + case 474: // unlabelled_stmt -> proc_call { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 474: // unlabelled_stmt -> goto_stmt + case 475: // unlabelled_stmt -> goto_stmt { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 475: // unlabelled_stmt -> compound_stmt + case 476: // unlabelled_stmt -> compound_stmt { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 476: // unlabelled_stmt -> if_stmt + case 477: // unlabelled_stmt -> if_stmt { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 477: // unlabelled_stmt -> case_stmt + case 478: // unlabelled_stmt -> case_stmt { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 478: // unlabelled_stmt -> repeat_stmt + case 479: // unlabelled_stmt -> repeat_stmt { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 479: // unlabelled_stmt -> while_stmt + case 480: // unlabelled_stmt -> while_stmt { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 480: // unlabelled_stmt -> for_stmt + case 481: // unlabelled_stmt -> for_stmt { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 481: // unlabelled_stmt -> with_stmt + case 482: // unlabelled_stmt -> with_stmt { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 482: // unlabelled_stmt -> inherited_message + case 483: // unlabelled_stmt -> inherited_message { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 483: // unlabelled_stmt -> try_stmt + case 484: // unlabelled_stmt -> try_stmt { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 484: // unlabelled_stmt -> raise_stmt + case 485: // unlabelled_stmt -> raise_stmt { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 485: // unlabelled_stmt -> foreach_stmt + case 486: // unlabelled_stmt -> foreach_stmt { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 486: // unlabelled_stmt -> var_stmt + case 487: // unlabelled_stmt -> var_stmt { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 487: // unlabelled_stmt -> expr_as_stmt + case 488: // unlabelled_stmt -> expr_as_stmt { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 488: // unlabelled_stmt -> lock_stmt + case 489: // unlabelled_stmt -> lock_stmt { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 489: // unlabelled_stmt -> yield_stmt + case 490: // unlabelled_stmt -> yield_stmt { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 490: // unlabelled_stmt -> yield_sequence_stmt + case 491: // unlabelled_stmt -> yield_sequence_stmt { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 491: // unlabelled_stmt -> loop_stmt + case 492: // unlabelled_stmt -> loop_stmt { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 492: // loop_stmt -> tkLoop, expr_l1, tkDo, unlabelled_stmt + case 493: // loop_stmt -> tkLoop, expr_l1, tkDo, unlabelled_stmt { CurrentSemanticValue.stn = new loop_stmt(ValueStack[ValueStack.Depth-3].ex,ValueStack[ValueStack.Depth-1].stn as statement,CurrentLocationSpan); } break; - case 493: // yield_stmt -> tkYield, expr_l1 + case 494: // yield_stmt -> tkYield, expr_l1 { CurrentSemanticValue.stn = new yield_node(ValueStack[ValueStack.Depth-1].ex,CurrentLocationSpan); } break; - case 494: // yield_sequence_stmt -> tkYield, tkSequence, expr_l1 + case 495: // yield_sequence_stmt -> tkYield, tkSequence, expr_l1 { CurrentSemanticValue.stn = new yield_sequence_node(ValueStack[ValueStack.Depth-1].ex,CurrentLocationSpan); } break; - case 495: // var_stmt -> tkVar, var_decl_part + case 496: // var_stmt -> tkVar, var_decl_part { CurrentSemanticValue.stn = new var_statement(ValueStack[ValueStack.Depth-1].stn as var_def_statement, CurrentLocationSpan); } break; - case 496: // var_stmt -> tkRoundOpen, tkVar, identifier, tkComma, var_ident_list, + case 497: // var_stmt -> tkRoundOpen, tkVar, identifier, tkComma, var_ident_list, // tkRoundClose, tkAssign, expr { (ValueStack[ValueStack.Depth-4].ob as ident_list).Insert(0,ValueStack[ValueStack.Depth-6].id); @@ -4620,7 +4628,7 @@ public partial class GPPGParser: ShiftReduceParser tkVar, tkRoundOpen, identifier, tkComma, ident_list, tkRoundClose, + case 498: // var_stmt -> tkVar, tkRoundOpen, identifier, tkComma, ident_list, tkRoundClose, // tkAssign, expr { (ValueStack[ValueStack.Depth-4].stn as ident_list).Insert(0,ValueStack[ValueStack.Depth-6].id); @@ -4628,12 +4636,12 @@ public partial class GPPGParser: ShiftReduceParser var_reference, assign_operator, expr_with_func_decl_lambda + case 499: // assignment -> var_reference, assign_operator, expr_with_func_decl_lambda { 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; - case 499: // assignment -> tkRoundOpen, variable, tkComma, variable_list, tkRoundClose, + case 500: // assignment -> tkRoundOpen, variable, tkComma, variable_list, tkRoundClose, // assign_operator, expr { if (ValueStack[ValueStack.Depth-2].op.type != Operators.Assignment) @@ -4643,41 +4651,41 @@ public partial class GPPGParser: ShiftReduceParser variable + case 501: // variable_list -> variable { CurrentSemanticValue.ob = new addressed_value_list(ValueStack[ValueStack.Depth-1].ex as addressed_value,LocationStack[LocationStack.Depth-1]); } break; - case 501: // variable_list -> variable_list, tkComma, variable + case 502: // variable_list -> variable_list, tkComma, variable { (ValueStack[ValueStack.Depth-3].ob as addressed_value_list).Add(ValueStack[ValueStack.Depth-1].ex as addressed_value); (ValueStack[ValueStack.Depth-3].ob as syntax_tree_node).source_context = LexLocation.MergeAll(LocationStack[LocationStack.Depth-3],LocationStack[LocationStack.Depth-2],LocationStack[LocationStack.Depth-1]); CurrentSemanticValue.ob = ValueStack[ValueStack.Depth-3].ob; } break; - case 502: // var_ident_list -> tkVar, identifier + case 503: // var_ident_list -> tkVar, identifier { CurrentSemanticValue.ob = new ident_list(ValueStack[ValueStack.Depth-1].id,CurrentLocationSpan); } break; - case 503: // var_ident_list -> var_ident_list, tkComma, tkVar, identifier + case 504: // var_ident_list -> var_ident_list, tkComma, tkVar, identifier { (ValueStack[ValueStack.Depth-4].ob as ident_list).Add(ValueStack[ValueStack.Depth-1].id); (ValueStack[ValueStack.Depth-4].ob as ident_list).source_context = LexLocation.MergeAll(LocationStack[LocationStack.Depth-4],LocationStack[LocationStack.Depth-3],LocationStack[LocationStack.Depth-2],LocationStack[LocationStack.Depth-1]); CurrentSemanticValue.ob = ValueStack[ValueStack.Depth-4].ob; } break; - case 504: // proc_call -> var_reference + case 505: // proc_call -> var_reference { CurrentSemanticValue.stn = new procedure_call(ValueStack[ValueStack.Depth-1].ex as addressed_value, CurrentLocationSpan); } break; - case 505: // goto_stmt -> tkGoto, label_name + case 506: // goto_stmt -> tkGoto, label_name { CurrentSemanticValue.stn = new goto_statement(ValueStack[ValueStack.Depth-1].id, CurrentLocationSpan); } break; - case 506: // compound_stmt -> tkBegin, stmt_list, tkEnd + case 507: // compound_stmt -> tkBegin, stmt_list, tkEnd { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-2].stn; (CurrentSemanticValue.stn as statement_list).left_logical_bracket = ValueStack[ValueStack.Depth-3].ti; @@ -4685,73 +4693,73 @@ public partial class GPPGParser: ShiftReduceParser stmt + case 508: // stmt_list -> stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, LocationStack[LocationStack.Depth-1]); } break; - case 508: // stmt_list -> stmt_list, tkSemiColon, stmt + case 509: // stmt_list -> stmt_list, tkSemiColon, stmt { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-3].stn as statement_list).Add(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 509: // if_stmt -> tkIf, expr_l1, tkThen, unlabelled_stmt + case 510: // if_stmt -> tkIf, expr_l1, tkThen, unlabelled_stmt { CurrentSemanticValue.stn = new if_node(ValueStack[ValueStack.Depth-3].ex, ValueStack[ValueStack.Depth-1].stn as statement, null, CurrentLocationSpan); } break; - case 510: // if_stmt -> tkIf, expr_l1, tkThen, unlabelled_stmt, tkElse, unlabelled_stmt + case 511: // if_stmt -> tkIf, expr_l1, tkThen, unlabelled_stmt, tkElse, unlabelled_stmt { CurrentSemanticValue.stn = new if_node(ValueStack[ValueStack.Depth-5].ex, ValueStack[ValueStack.Depth-3].stn as statement, ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 511: // case_stmt -> tkCase, expr_l1, tkOf, case_list, else_case, tkEnd + case 512: // case_stmt -> tkCase, expr_l1, tkOf, case_list, else_case, tkEnd { CurrentSemanticValue.stn = new case_node(ValueStack[ValueStack.Depth-5].ex, ValueStack[ValueStack.Depth-3].stn as case_variants, ValueStack[ValueStack.Depth-2].stn as statement, CurrentLocationSpan); } break; - case 512: // case_list -> case_item + case 513: // case_list -> case_item { if (ValueStack[ValueStack.Depth-1].stn is empty_statement) CurrentSemanticValue.stn = NewCaseItem(ValueStack[ValueStack.Depth-1].stn, null); else CurrentSemanticValue.stn = NewCaseItem(ValueStack[ValueStack.Depth-1].stn, CurrentLocationSpan); } break; - case 513: // case_list -> case_list, tkSemiColon, case_item + case 514: // case_list -> case_list, tkSemiColon, case_item { CurrentSemanticValue.stn = AddCaseItem(ValueStack[ValueStack.Depth-3].stn as case_variants, ValueStack[ValueStack.Depth-1].stn, CurrentLocationSpan); } break; - case 514: // case_item -> /* empty */ + case 515: // case_item -> /* empty */ { CurrentSemanticValue.stn = new empty_statement(); } break; - case 515: // case_item -> case_label_list, tkColon, unlabelled_stmt + case 516: // case_item -> case_label_list, tkColon, unlabelled_stmt { CurrentSemanticValue.stn = new case_variant(ValueStack[ValueStack.Depth-3].stn as expression_list, ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 516: // case_label_list -> case_label + case 517: // case_label_list -> case_label { CurrentSemanticValue.stn = new expression_list(ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 517: // case_label_list -> case_label_list, tkComma, case_label + case 518: // case_label_list -> case_label_list, tkComma, case_label { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-3].stn as expression_list).Add(ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 518: // case_label -> const_elem + case 519: // case_label -> const_elem { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 519: // else_case -> /* empty */ + case 520: // else_case -> /* empty */ { CurrentSemanticValue.stn = null;} break; - case 520: // else_case -> tkElse, stmt_list + case 521: // else_case -> tkElse, stmt_list { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 521: // repeat_stmt -> tkRepeat, stmt_list, tkUntil, expr + case 522: // repeat_stmt -> tkRepeat, stmt_list, tkUntil, expr { CurrentSemanticValue.stn = new repeat_node(ValueStack[ValueStack.Depth-3].stn as statement_list, ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); (ValueStack[ValueStack.Depth-3].stn as statement_list).left_logical_bracket = ValueStack[ValueStack.Depth-4].ti; @@ -4759,23 +4767,23 @@ public partial class GPPGParser: ShiftReduceParser tkWhile, expr_l1, optional_tk_do, unlabelled_stmt + case 523: // while_stmt -> tkWhile, expr_l1, optional_tk_do, unlabelled_stmt { CurrentSemanticValue.stn = NewWhileStmt(ValueStack[ValueStack.Depth-4].ti, ValueStack[ValueStack.Depth-3].ex, ValueStack[ValueStack.Depth-2].ti, ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 523: // optional_tk_do -> tkDo + case 524: // optional_tk_do -> tkDo { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 524: // optional_tk_do -> /* empty */ + case 525: // optional_tk_do -> /* empty */ { CurrentSemanticValue.ti = null; } break; - case 525: // lock_stmt -> tkLock, expr_l1, tkDo, unlabelled_stmt + case 526: // lock_stmt -> tkLock, expr_l1, tkDo, unlabelled_stmt { CurrentSemanticValue.stn = new lock_stmt(ValueStack[ValueStack.Depth-3].ex, ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 526: // foreach_stmt -> tkForeach, identifier, foreach_stmt_ident_dype_opt, tkIn, + case 527: // foreach_stmt -> tkForeach, identifier, foreach_stmt_ident_dype_opt, tkIn, // expr_l1, tkDo, unlabelled_stmt { CurrentSemanticValue.stn = new foreach_stmt(ValueStack[ValueStack.Depth-6].id, ValueStack[ValueStack.Depth-5].td, ValueStack[ValueStack.Depth-3].ex, ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); @@ -4783,68 +4791,68 @@ public partial class GPPGParser: ShiftReduceParser tkForeach, tkVar, identifier, tkColon, type_ref, tkIn, expr_l1, + case 528: // foreach_stmt -> tkForeach, tkVar, identifier, tkColon, type_ref, tkIn, expr_l1, // tkDo, unlabelled_stmt { CurrentSemanticValue.stn = new foreach_stmt(ValueStack[ValueStack.Depth-7].id, ValueStack[ValueStack.Depth-5].td, ValueStack[ValueStack.Depth-3].ex, ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 528: // foreach_stmt -> tkForeach, tkVar, identifier, tkIn, expr_l1, tkDo, + case 529: // foreach_stmt -> tkForeach, tkVar, identifier, tkIn, expr_l1, tkDo, // unlabelled_stmt { CurrentSemanticValue.stn = new foreach_stmt(ValueStack[ValueStack.Depth-5].id, new no_type_foreach(), ValueStack[ValueStack.Depth-3].ex, (statement)ValueStack[ValueStack.Depth-1].stn, CurrentLocationSpan); } break; - case 529: // foreach_stmt_ident_dype_opt -> tkColon, type_ref + case 530: // foreach_stmt_ident_dype_opt -> tkColon, type_ref { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 531: // for_stmt -> tkFor, optional_var, identifier, for_stmt_decl_or_assign, expr_l1, + case 532: // for_stmt -> tkFor, optional_var, identifier, for_stmt_decl_or_assign, expr_l1, // for_cycle_type, expr_l1, optional_tk_do, unlabelled_stmt { CurrentSemanticValue.stn = NewForStmt((bool)ValueStack[ValueStack.Depth-8].ob, ValueStack[ValueStack.Depth-7].id, ValueStack[ValueStack.Depth-6].td, ValueStack[ValueStack.Depth-5].ex, (for_cycle_type)ValueStack[ValueStack.Depth-4].ob, ValueStack[ValueStack.Depth-3].ex, ValueStack[ValueStack.Depth-2].ti, ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 532: // optional_var -> tkVar + case 533: // optional_var -> tkVar { CurrentSemanticValue.ob = true; } break; - case 533: // optional_var -> /* empty */ + case 534: // optional_var -> /* empty */ { CurrentSemanticValue.ob = false; } break; - case 535: // for_stmt_decl_or_assign -> tkColon, simple_type_identifier, tkAssign + case 536: // for_stmt_decl_or_assign -> tkColon, simple_type_identifier, tkAssign { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-2].td; } break; - case 536: // for_cycle_type -> tkTo + case 537: // for_cycle_type -> tkTo { CurrentSemanticValue.ob = for_cycle_type.to; } break; - case 537: // for_cycle_type -> tkDownto + case 538: // for_cycle_type -> tkDownto { CurrentSemanticValue.ob = for_cycle_type.downto; } break; - case 538: // with_stmt -> tkWith, expr_list, tkDo, unlabelled_stmt + case 539: // with_stmt -> tkWith, expr_list, tkDo, unlabelled_stmt { CurrentSemanticValue.stn = new with_statement(ValueStack[ValueStack.Depth-1].stn as statement, ValueStack[ValueStack.Depth-3].stn as expression_list, CurrentLocationSpan); } break; - case 539: // inherited_message -> tkInherited + case 540: // inherited_message -> tkInherited { CurrentSemanticValue.stn = new inherited_message(); CurrentSemanticValue.stn.source_context = CurrentLocationSpan; } break; - case 540: // try_stmt -> tkTry, stmt_list, try_handler + case 541: // try_stmt -> tkTry, stmt_list, try_handler { CurrentSemanticValue.stn = new try_stmt(ValueStack[ValueStack.Depth-2].stn as statement_list, ValueStack[ValueStack.Depth-1].stn as try_handler, CurrentLocationSpan); (ValueStack[ValueStack.Depth-2].stn as statement_list).left_logical_bracket = ValueStack[ValueStack.Depth-3].ti; ValueStack[ValueStack.Depth-2].stn.source_context = LocationStack[LocationStack.Depth-3].Merge(LocationStack[LocationStack.Depth-2]); } break; - case 541: // try_handler -> tkFinally, stmt_list, tkEnd + case 542: // try_handler -> tkFinally, stmt_list, tkEnd { CurrentSemanticValue.stn = new try_handler_finally(ValueStack[ValueStack.Depth-2].stn as statement_list, CurrentLocationSpan); (ValueStack[ValueStack.Depth-2].stn as statement_list).left_logical_bracket = ValueStack[ValueStack.Depth-3].ti; (ValueStack[ValueStack.Depth-2].stn as statement_list).right_logical_bracket = ValueStack[ValueStack.Depth-1].ti; } break; - case 542: // try_handler -> tkExcept, exception_block, tkEnd + case 543: // try_handler -> tkExcept, exception_block, tkEnd { CurrentSemanticValue.stn = new try_handler_except((exception_block)ValueStack[ValueStack.Depth-2].stn, CurrentLocationSpan); if ((ValueStack[ValueStack.Depth-2].stn as exception_block).stmt_list != null) @@ -4854,160 +4862,160 @@ public partial class GPPGParser: ShiftReduceParser exception_handler_list, exception_block_else_branch + case 544: // exception_block -> exception_handler_list, exception_block_else_branch { CurrentSemanticValue.stn = new exception_block(null, (exception_handler_list)ValueStack[ValueStack.Depth-2].stn, (statement_list)ValueStack[ValueStack.Depth-1].stn, CurrentLocationSpan); } break; - case 544: // exception_block -> exception_handler_list, tkSemiColon, + case 545: // exception_block -> exception_handler_list, tkSemiColon, // exception_block_else_branch { CurrentSemanticValue.stn = new exception_block(null, (exception_handler_list)ValueStack[ValueStack.Depth-3].stn, (statement_list)ValueStack[ValueStack.Depth-1].stn, CurrentLocationSpan); } break; - case 545: // exception_block -> stmt_list + case 546: // exception_block -> stmt_list { CurrentSemanticValue.stn = new exception_block(ValueStack[ValueStack.Depth-1].stn as statement_list, null, null, LocationStack[LocationStack.Depth-1]); } break; - case 546: // exception_handler_list -> exception_handler + case 547: // exception_handler_list -> exception_handler { CurrentSemanticValue.stn = new exception_handler_list(ValueStack[ValueStack.Depth-1].stn as exception_handler, CurrentLocationSpan); } break; - case 547: // exception_handler_list -> exception_handler_list, tkSemiColon, + case 548: // exception_handler_list -> exception_handler_list, tkSemiColon, // exception_handler { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-3].stn as exception_handler_list).Add(ValueStack[ValueStack.Depth-1].stn as exception_handler, CurrentLocationSpan); } break; - case 548: // exception_block_else_branch -> /* empty */ + case 549: // exception_block_else_branch -> /* empty */ { CurrentSemanticValue.stn = null; } break; - case 549: // exception_block_else_branch -> tkElse, stmt_list + case 550: // exception_block_else_branch -> tkElse, stmt_list { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 550: // exception_handler -> tkOn, exception_identifier, tkDo, unlabelled_stmt + case 551: // exception_handler -> tkOn, exception_identifier, tkDo, unlabelled_stmt { CurrentSemanticValue.stn = new exception_handler((ValueStack[ValueStack.Depth-3].stn as exception_ident).variable, (ValueStack[ValueStack.Depth-3].stn as exception_ident).type_name, ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 551: // exception_identifier -> exception_class_type_identifier + case 552: // exception_identifier -> exception_class_type_identifier { CurrentSemanticValue.stn = new exception_ident(null, (named_type_reference)ValueStack[ValueStack.Depth-1].td, CurrentLocationSpan); } break; - case 552: // exception_identifier -> exception_variable, tkColon, + case 553: // exception_identifier -> exception_variable, tkColon, // exception_class_type_identifier { CurrentSemanticValue.stn = new exception_ident(ValueStack[ValueStack.Depth-3].id, (named_type_reference)ValueStack[ValueStack.Depth-1].td, CurrentLocationSpan); } break; - case 553: // exception_class_type_identifier -> simple_type_identifier + case 554: // exception_class_type_identifier -> simple_type_identifier { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 554: // exception_variable -> identifier + case 555: // exception_variable -> identifier { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 555: // raise_stmt -> tkRaise + case 556: // raise_stmt -> tkRaise { CurrentSemanticValue.stn = new raise_stmt(); CurrentSemanticValue.stn.source_context = CurrentLocationSpan; } break; - case 556: // raise_stmt -> tkRaise, expr + case 557: // raise_stmt -> tkRaise, expr { CurrentSemanticValue.stn = new raise_stmt(ValueStack[ValueStack.Depth-1].ex, null, CurrentLocationSpan); } break; - case 557: // expr_list -> expr_with_func_decl_lambda + case 558: // expr_list -> expr_with_func_decl_lambda { CurrentSemanticValue.stn = new expression_list(ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 558: // expr_list -> expr_list, tkComma, expr_with_func_decl_lambda + case 559: // expr_list -> expr_list, tkComma, expr_with_func_decl_lambda { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-3].stn as expression_list).Add(ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 559: // expr_as_stmt -> allowable_expr_as_stmt + case 560: // expr_as_stmt -> allowable_expr_as_stmt { CurrentSemanticValue.stn = new expression_as_statement(ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 560: // allowable_expr_as_stmt -> new_expr + case 561: // allowable_expr_as_stmt -> new_expr { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 561: // expr_with_func_decl_lambda -> expr + case 562: // expr_with_func_decl_lambda -> expr { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 562: // expr_with_func_decl_lambda -> func_decl_lambda + case 563: // expr_with_func_decl_lambda -> func_decl_lambda { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 563: // expr -> expr_l1 + case 564: // expr -> expr_l1 { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 564: // expr -> format_expr + case 565: // expr -> format_expr { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 565: // expr_l1 -> expr_dq + case 566: // expr_l1 -> expr_dq { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 566: // expr_l1 -> question_expr + case 567: // expr_l1 -> question_expr { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 567: // expr_dq -> relop_expr + case 568: // expr_dq -> relop_expr { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 568: // expr_dq -> expr_dq, tkDoubleQuestion, relop_expr + case 569: // expr_dq -> expr_dq, tkDoubleQuestion, relop_expr { CurrentSemanticValue.ex = new double_question_node(ValueStack[ValueStack.Depth-3].ex as expression, ValueStack[ValueStack.Depth-1].ex as expression, CurrentLocationSpan);} break; - case 569: // sizeof_expr -> tkSizeOf, tkRoundOpen, simple_or_template_type_reference, + case 570: // sizeof_expr -> tkSizeOf, tkRoundOpen, simple_or_template_type_reference, // tkRoundClose { CurrentSemanticValue.ex = new sizeof_operator((named_type_reference)ValueStack[ValueStack.Depth-2].td, null, CurrentLocationSpan); } break; - case 570: // typeof_expr -> tkTypeOf, tkRoundOpen, simple_or_template_type_reference, + case 571: // typeof_expr -> tkTypeOf, tkRoundOpen, simple_or_template_type_reference, // tkRoundClose { CurrentSemanticValue.ex = new typeof_operator((named_type_reference)ValueStack[ValueStack.Depth-2].td, CurrentLocationSpan); } break; - case 571: // question_expr -> expr_l1, tkQuestion, expr_l1, tkColon, expr_l1 + case 572: // question_expr -> expr_l1, tkQuestion, expr_l1, tkColon, expr_l1 { CurrentSemanticValue.ex = new question_colon_expression(ValueStack[ValueStack.Depth-5].ex, ValueStack[ValueStack.Depth-3].ex, ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 572: // simple_or_template_type_reference -> simple_type_identifier + case 573: // simple_or_template_type_reference -> simple_type_identifier { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 573: // simple_or_template_type_reference -> simple_type_identifier, + case 574: // simple_or_template_type_reference -> simple_type_identifier, // template_type_params { CurrentSemanticValue.td = new template_type_reference((named_type_reference)ValueStack[ValueStack.Depth-2].td, (template_param_list)ValueStack[ValueStack.Depth-1].stn, CurrentLocationSpan); } break; - case 574: // simple_or_template_type_reference -> simple_type_identifier, tkAmpersend, + case 575: // simple_or_template_type_reference -> simple_type_identifier, tkAmpersend, // template_type_or_typeclass_params { CurrentSemanticValue.td = new template_type_reference((named_type_reference)ValueStack[ValueStack.Depth-3].td, (template_param_list)ValueStack[ValueStack.Depth-1].stn, CurrentLocationSpan); } break; - case 575: // optional_array_initializer -> tkRoundOpen, typed_const_list, tkRoundClose + case 576: // optional_array_initializer -> tkRoundOpen, typed_const_list, tkRoundClose { CurrentSemanticValue.stn = new array_const((expression_list)ValueStack[ValueStack.Depth-2].stn, CurrentLocationSpan); } break; - case 577: // new_expr -> tkNew, simple_or_template_type_reference, + case 578: // new_expr -> tkNew, simple_or_template_type_reference, // optional_expr_list_with_bracket { CurrentSemanticValue.ex = new new_expr(ValueStack[ValueStack.Depth-2].td, ValueStack[ValueStack.Depth-1].stn as expression_list, false, null, CurrentLocationSpan); } break; - case 578: // new_expr -> tkNew, array_name_for_new_expr, tkSquareOpen, optional_expr_list, + case 579: // new_expr -> tkNew, array_name_for_new_expr, tkSquareOpen, optional_expr_list, // tkSquareClose, optional_array_initializer { var el = ValueStack[ValueStack.Depth-3].stn as expression_list; @@ -5023,7 +5031,7 @@ public partial class GPPGParser: ShiftReduceParser tkNew, tkClass, tkRoundOpen, list_fields_in_unnamed_object, + case 580: // new_expr -> tkNew, tkClass, tkRoundOpen, list_fields_in_unnamed_object, // tkRoundClose { // sugared node @@ -5038,12 +5046,12 @@ public partial class GPPGParser: ShiftReduceParser identifier, tkAssign, relop_expr + case 581: // field_in_unnamed_object -> identifier, tkAssign, relop_expr { CurrentSemanticValue.ob = new name_assign_expr(ValueStack[ValueStack.Depth-3].id,ValueStack[ValueStack.Depth-1].ex,CurrentLocationSpan); } break; - case 581: // field_in_unnamed_object -> relop_expr + case 582: // field_in_unnamed_object -> relop_expr { ident name = null; var id = ValueStack[ValueStack.Depth-1].ex as ident; @@ -5063,13 +5071,13 @@ public partial class GPPGParser: ShiftReduceParser field_in_unnamed_object + case 583: // list_fields_in_unnamed_object -> field_in_unnamed_object { var l = new name_assign_expr_list(); CurrentSemanticValue.ob = l.Add(ValueStack[ValueStack.Depth-1].ob as name_assign_expr); } break; - case 583: // list_fields_in_unnamed_object -> list_fields_in_unnamed_object, tkComma, + case 584: // list_fields_in_unnamed_object -> list_fields_in_unnamed_object, tkComma, // field_in_unnamed_object { var nel = ValueStack[ValueStack.Depth-3].ob as name_assign_expr_list; @@ -5080,169 +5088,169 @@ public partial class GPPGParser: ShiftReduceParser simple_type_identifier + case 585: // array_name_for_new_expr -> simple_type_identifier { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 585: // array_name_for_new_expr -> unsized_array_type + case 586: // array_name_for_new_expr -> unsized_array_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 586: // optional_expr_list_with_bracket -> /* empty */ + case 587: // optional_expr_list_with_bracket -> /* empty */ { CurrentSemanticValue.stn = null; } break; - case 587: // optional_expr_list_with_bracket -> tkRoundOpen, optional_expr_list, + case 588: // optional_expr_list_with_bracket -> tkRoundOpen, optional_expr_list, // tkRoundClose { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-2].stn; } break; - case 588: // relop_expr -> simple_expr + case 589: // relop_expr -> simple_expr { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 589: // relop_expr -> relop_expr, relop, simple_expr + case 590: // relop_expr -> relop_expr, relop, simple_expr { CurrentSemanticValue.ex = new bin_expr(ValueStack[ValueStack.Depth-3].ex, ValueStack[ValueStack.Depth-1].ex, ValueStack[ValueStack.Depth-2].op.type, CurrentLocationSpan); } break; - case 590: // simple_expr_or_nothing -> simple_expr + case 591: // simple_expr_or_nothing -> simple_expr { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 591: // simple_expr_or_nothing -> /* empty */ + case 592: // simple_expr_or_nothing -> /* empty */ { CurrentSemanticValue.ex = null; } break; - case 592: // format_expr -> simple_expr, tkColon, simple_expr_or_nothing + case 593: // format_expr -> simple_expr, tkColon, simple_expr_or_nothing { CurrentSemanticValue.ex = new format_expr(ValueStack[ValueStack.Depth-3].ex, ValueStack[ValueStack.Depth-1].ex, null, CurrentLocationSpan); } break; - case 593: // format_expr -> tkColon, simple_expr_or_nothing + case 594: // format_expr -> tkColon, simple_expr_or_nothing { CurrentSemanticValue.ex = new format_expr(null, ValueStack[ValueStack.Depth-1].ex, null, CurrentLocationSpan); } break; - case 594: // format_expr -> simple_expr, tkColon, simple_expr_or_nothing, tkColon, + case 595: // format_expr -> simple_expr, tkColon, simple_expr_or_nothing, tkColon, // simple_expr { CurrentSemanticValue.ex = new format_expr(ValueStack[ValueStack.Depth-5].ex, ValueStack[ValueStack.Depth-3].ex, ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 595: // format_expr -> tkColon, simple_expr_or_nothing, tkColon, simple_expr + case 596: // format_expr -> tkColon, simple_expr_or_nothing, tkColon, simple_expr { CurrentSemanticValue.ex = new format_expr(null, ValueStack[ValueStack.Depth-3].ex, ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 596: // relop -> tkEqual + case 597: // relop -> tkEqual { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 597: // relop -> tkNotEqual + case 598: // relop -> tkNotEqual { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 598: // relop -> tkLower + case 599: // relop -> tkLower { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 599: // relop -> tkGreater + case 600: // relop -> tkGreater { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 600: // relop -> tkLowerEqual + case 601: // relop -> tkLowerEqual { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 601: // relop -> tkGreaterEqual + case 602: // relop -> tkGreaterEqual { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 602: // relop -> tkIn + case 603: // relop -> tkIn { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 603: // simple_expr -> term + case 604: // simple_expr -> term { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 604: // simple_expr -> simple_expr, addop, term + case 605: // simple_expr -> simple_expr, addop, term { CurrentSemanticValue.ex = new bin_expr(ValueStack[ValueStack.Depth-3].ex, ValueStack[ValueStack.Depth-1].ex, ValueStack[ValueStack.Depth-2].op.type, CurrentLocationSpan); } break; - case 605: // addop -> tkPlus + case 606: // addop -> tkPlus { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 606: // addop -> tkMinus + case 607: // addop -> tkMinus { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 607: // addop -> tkOr + case 608: // addop -> tkOr { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 608: // addop -> tkXor + case 609: // addop -> tkXor { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 609: // addop -> tkCSharpStyleOr + case 610: // addop -> tkCSharpStyleOr { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 610: // typecast_op -> tkAs + case 611: // typecast_op -> tkAs { CurrentSemanticValue.ob = op_typecast.as_op; } break; - case 611: // typecast_op -> tkIs + case 612: // typecast_op -> tkIs { CurrentSemanticValue.ob = op_typecast.is_op; } break; - case 612: // as_is_expr -> term, typecast_op, simple_or_template_type_reference + case 613: // as_is_expr -> term, typecast_op, simple_or_template_type_reference { CurrentSemanticValue.ex = NewAsIsExpr(ValueStack[ValueStack.Depth-3].ex, (op_typecast)ValueStack[ValueStack.Depth-2].ob, ValueStack[ValueStack.Depth-1].td, CurrentLocationSpan); } break; - case 613: // simple_term -> factor + case 614: // simple_term -> factor { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 614: // power_expr -> simple_term, tkStarStar, factor + case 615: // power_expr -> simple_term, tkStarStar, factor { CurrentSemanticValue.ex = new bin_expr(ValueStack[ValueStack.Depth-3].ex,ValueStack[ValueStack.Depth-1].ex,(ValueStack[ValueStack.Depth-2].op).type, CurrentLocationSpan); } break; - case 615: // term -> factor + case 616: // term -> factor { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 616: // term -> new_expr + case 617: // term -> new_expr { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 617: // term -> power_expr + case 618: // term -> power_expr { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 618: // term -> term, mulop, factor + case 619: // term -> term, mulop, factor { CurrentSemanticValue.ex = new bin_expr(ValueStack[ValueStack.Depth-3].ex,ValueStack[ValueStack.Depth-1].ex,(ValueStack[ValueStack.Depth-2].op).type, CurrentLocationSpan); } break; - case 619: // term -> term, mulop, power_expr + case 620: // term -> term, mulop, power_expr { CurrentSemanticValue.ex = new bin_expr(ValueStack[ValueStack.Depth-3].ex,ValueStack[ValueStack.Depth-1].ex,(ValueStack[ValueStack.Depth-2].op).type, CurrentLocationSpan); } break; - case 620: // term -> as_is_expr + case 621: // term -> as_is_expr { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 621: // mulop -> tkStar + case 622: // mulop -> tkStar { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 622: // mulop -> tkSlash + case 623: // mulop -> tkSlash { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 623: // mulop -> tkDiv + case 624: // mulop -> tkDiv { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 624: // mulop -> tkMod + case 625: // mulop -> tkMod { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 625: // mulop -> tkShl + case 626: // mulop -> tkShl { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 626: // mulop -> tkShr + case 627: // mulop -> tkShr { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 627: // mulop -> tkAnd + case 628: // mulop -> tkAnd { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 628: // default_expr -> tkDefault, tkRoundOpen, simple_or_template_type_reference, + case 629: // default_expr -> tkDefault, tkRoundOpen, simple_or_template_type_reference, // tkRoundClose { CurrentSemanticValue.ex = new default_operator(ValueStack[ValueStack.Depth-2].td as named_type_reference, CurrentLocationSpan); } break; - case 629: // tuple -> tkRoundOpen, expr_l1, tkComma, expr_l1_list, lambda_type_ref, + case 630: // tuple -> tkRoundOpen, expr_l1, tkComma, expr_l1_list, lambda_type_ref, // optional_full_lambda_fp_list, tkRoundClose { /*if ($5 != null) @@ -5256,112 +5264,112 @@ public partial class GPPGParser: ShiftReduceParser tkNil + case 631: // factor -> tkNil { CurrentSemanticValue.ex = new nil_const(); CurrentSemanticValue.ex.source_context = CurrentLocationSpan; } break; - case 631: // factor -> literal_or_number + case 632: // factor -> literal_or_number { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 632: // factor -> default_expr + case 633: // factor -> default_expr { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 633: // factor -> tkSquareOpen, elem_list, tkSquareClose + case 634: // factor -> tkSquareOpen, elem_list, tkSquareClose { CurrentSemanticValue.ex = new pascal_set_constant(ValueStack[ValueStack.Depth-2].stn as expression_list, CurrentLocationSpan); } break; - case 634: // factor -> tkNot, factor + case 635: // factor -> tkNot, factor { CurrentSemanticValue.ex = new un_expr(ValueStack[ValueStack.Depth-1].ex, ValueStack[ValueStack.Depth-2].op.type, CurrentLocationSpan); } break; - case 635: // factor -> sign, factor + case 636: // factor -> sign, factor { CurrentSemanticValue.ex = new un_expr(ValueStack[ValueStack.Depth-1].ex, ValueStack[ValueStack.Depth-2].op.type, CurrentLocationSpan); } break; - case 636: // factor -> tkDeref, factor + case 637: // factor -> tkDeref, factor { CurrentSemanticValue.ex = new roof_dereference(ValueStack[ValueStack.Depth-1].ex as addressed_value, CurrentLocationSpan); } break; - case 637: // factor -> var_reference + case 638: // factor -> var_reference { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 638: // factor -> tuple + case 639: // factor -> tuple { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 639: // literal_or_number -> literal + case 640: // literal_or_number -> literal { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 640: // literal_or_number -> unsigned_number + case 641: // literal_or_number -> unsigned_number { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 641: // var_question_point -> variable, tkQuestionPoint, variable + case 642: // var_question_point -> variable, tkQuestionPoint, variable { CurrentSemanticValue.ex = new dot_question_node(ValueStack[ValueStack.Depth-3].ex as addressed_value,ValueStack[ValueStack.Depth-1].ex as addressed_value,CurrentLocationSpan); } break; - case 642: // var_question_point -> variable, tkQuestionPoint, var_question_point + case 643: // var_question_point -> variable, tkQuestionPoint, var_question_point { CurrentSemanticValue.ex = new dot_question_node(ValueStack[ValueStack.Depth-3].ex as addressed_value,ValueStack[ValueStack.Depth-1].ex as addressed_value,CurrentLocationSpan); } break; - case 643: // var_reference -> var_address, variable + case 644: // var_reference -> var_address, variable { CurrentSemanticValue.ex = NewVarReference(ValueStack[ValueStack.Depth-2].stn as get_address, ValueStack[ValueStack.Depth-1].ex as addressed_value, CurrentLocationSpan); } break; - case 644: // var_reference -> variable + case 645: // var_reference -> variable { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 645: // var_reference -> var_question_point + case 646: // var_reference -> var_question_point { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 646: // var_address -> tkAddressOf + case 647: // var_address -> tkAddressOf { CurrentSemanticValue.stn = NewVarAddress(CurrentLocationSpan); } break; - case 647: // var_address -> var_address, tkAddressOf + case 648: // var_address -> var_address, tkAddressOf { CurrentSemanticValue.stn = NewVarAddress(ValueStack[ValueStack.Depth-2].stn as get_address, CurrentLocationSpan); } break; - case 648: // attribute_variable -> simple_type_identifier, optional_expr_list_with_bracket + case 649: // attribute_variable -> simple_type_identifier, optional_expr_list_with_bracket { CurrentSemanticValue.stn = new attribute(null, ValueStack[ValueStack.Depth-2].td as named_type_reference, ValueStack[ValueStack.Depth-1].stn as expression_list, CurrentLocationSpan); } break; - case 649: // dotted_identifier -> identifier + case 650: // dotted_identifier -> identifier { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].id; } break; - case 650: // dotted_identifier -> dotted_identifier, tkPoint, identifier_or_keyword + case 651: // dotted_identifier -> dotted_identifier, tkPoint, identifier_or_keyword { CurrentSemanticValue.ex = new dot_node(ValueStack[ValueStack.Depth-3].ex as addressed_value, ValueStack[ValueStack.Depth-1].id as addressed_value, CurrentLocationSpan); } break; - case 651: // variable_as_type -> dotted_identifier + case 652: // variable_as_type -> dotted_identifier { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex;} break; - case 652: // variable_as_type -> dotted_identifier, template_type_params + case 653: // variable_as_type -> dotted_identifier, template_type_params { CurrentSemanticValue.ex = new ident_with_templateparams(ValueStack[ValueStack.Depth-2].ex as addressed_value, ValueStack[ValueStack.Depth-1].stn as template_param_list, CurrentLocationSpan); } break; - case 653: // variable -> identifier + case 654: // variable -> identifier { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].id; } break; - case 654: // variable -> operator_name_ident + case 655: // variable -> operator_name_ident { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 655: // variable -> tkInherited, identifier + case 656: // variable -> tkInherited, identifier { CurrentSemanticValue.ex = new inherited_ident(ValueStack[ValueStack.Depth-1].id.name, CurrentLocationSpan); } break; - case 656: // variable -> tkRoundOpen, expr, tkRoundClose + case 657: // variable -> tkRoundOpen, expr, tkRoundClose { if (!parsertools.build_tree_for_formatter) { @@ -5371,18 +5379,18 @@ public partial class GPPGParser: ShiftReduceParser sizeof_expr + case 658: // variable -> sizeof_expr { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 658: // variable -> typeof_expr + case 659: // variable -> typeof_expr { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 659: // variable -> literal_or_number, tkPoint, identifier_or_keyword + case 660: // variable -> literal_or_number, tkPoint, identifier_or_keyword { CurrentSemanticValue.ex = new dot_node(ValueStack[ValueStack.Depth-3].ex as addressed_value, ValueStack[ValueStack.Depth-1].id as addressed_value, CurrentLocationSpan); } break; - case 660: // variable -> variable, tkSquareOpen, expr_list, tkSquareClose + case 661: // variable -> variable, tkSquareOpen, expr_list, tkSquareClose { var el = ValueStack[ValueStack.Depth-2].stn as expression_list; // SSM 10/03/16 if (el.Count==1 && el.expressions[0] is format_expr) @@ -5400,7 +5408,7 @@ public partial class GPPGParser: ShiftReduceParser variable, tkQuestionSquareOpen, format_expr, tkSquareClose + case 662: // variable -> variable, tkQuestionSquareOpen, format_expr, tkSquareClose { var fe = ValueStack[ValueStack.Depth-2].ex as format_expr; // SSM 9/01/17 if (fe.expr == null) @@ -5410,71 +5418,71 @@ public partial class GPPGParser: ShiftReduceParser variable, tkRoundOpen, optional_expr_list, tkRoundClose + case 663: // variable -> variable, tkRoundOpen, optional_expr_list, tkRoundClose { CurrentSemanticValue.ex = new method_call(ValueStack[ValueStack.Depth-4].ex as addressed_value,ValueStack[ValueStack.Depth-2].stn as expression_list, CurrentLocationSpan); } break; - case 663: // variable -> variable, tkPoint, identifier_keyword_operatorname + case 664: // variable -> variable, tkPoint, identifier_keyword_operatorname { CurrentSemanticValue.ex = new dot_node(ValueStack[ValueStack.Depth-3].ex as addressed_value, ValueStack[ValueStack.Depth-1].id as addressed_value, CurrentLocationSpan); } break; - case 664: // variable -> tuple, tkPoint, identifier_keyword_operatorname + case 665: // variable -> tuple, tkPoint, identifier_keyword_operatorname { CurrentSemanticValue.ex = new dot_node(ValueStack[ValueStack.Depth-3].ex as addressed_value, ValueStack[ValueStack.Depth-1].id as addressed_value, CurrentLocationSpan); } break; - case 665: // variable -> variable, tkDeref + case 666: // variable -> variable, tkDeref { CurrentSemanticValue.ex = new roof_dereference(ValueStack[ValueStack.Depth-2].ex as addressed_value,CurrentLocationSpan); } break; - case 666: // variable -> variable, tkAmpersend, template_type_or_typeclass_params + case 667: // variable -> variable, tkAmpersend, template_type_or_typeclass_params { CurrentSemanticValue.ex = new ident_with_templateparams(ValueStack[ValueStack.Depth-3].ex as addressed_value, ValueStack[ValueStack.Depth-1].stn as template_param_list, CurrentLocationSpan); } break; - case 667: // optional_expr_list -> expr_list + case 668: // optional_expr_list -> expr_list { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 668: // optional_expr_list -> /* empty */ + case 669: // optional_expr_list -> /* empty */ { CurrentSemanticValue.stn = null; } break; - case 669: // elem_list -> elem_list1 + case 670: // elem_list -> elem_list1 { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 670: // elem_list -> /* empty */ + case 671: // elem_list -> /* empty */ { CurrentSemanticValue.stn = null; } break; - case 671: // elem_list1 -> elem + case 672: // elem_list1 -> elem { CurrentSemanticValue.stn = new expression_list(ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 672: // elem_list1 -> elem_list1, tkComma, elem + case 673: // elem_list1 -> elem_list1, tkComma, elem { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-3].stn as expression_list).Add(ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 673: // elem -> expr + case 674: // elem -> expr { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 674: // elem -> expr, tkDotDot, expr + case 675: // elem -> expr, tkDotDot, expr { CurrentSemanticValue.ex = new diapason_expr(ValueStack[ValueStack.Depth-3].ex, ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 675: // one_literal -> tkStringLiteral + case 676: // one_literal -> tkStringLiteral { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].stn as literal; } break; - case 676: // one_literal -> tkAsciiChar + case 677: // one_literal -> tkAsciiChar { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].stn as literal; } break; - case 677: // literal -> literal_list + case 678: // literal -> literal_list { CurrentSemanticValue.ex = NewLiteral(ValueStack[ValueStack.Depth-1].stn as literal_const_line); } break; - case 678: // literal -> tkFormatStringLiteral + case 679: // literal -> tkFormatStringLiteral { if (parsertools.build_tree_for_formatter) { @@ -5486,444 +5494,444 @@ public partial class GPPGParser: ShiftReduceParser one_literal + case 680: // literal_list -> one_literal { CurrentSemanticValue.stn = new literal_const_line(ValueStack[ValueStack.Depth-1].ex as literal, CurrentLocationSpan); } break; - case 680: // literal_list -> literal_list, one_literal + case 681: // literal_list -> literal_list, one_literal { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-2].stn as literal_const_line).Add(ValueStack[ValueStack.Depth-1].ex as literal, CurrentLocationSpan); } break; - case 681: // operator_name_ident -> tkOperator, overload_operator + case 682: // operator_name_ident -> tkOperator, overload_operator { CurrentSemanticValue.ex = new operator_name_ident((ValueStack[ValueStack.Depth-1].op as op_type_node).text, (ValueStack[ValueStack.Depth-1].op as op_type_node).type, CurrentLocationSpan); } break; - case 682: // optional_method_modificators -> tkSemiColon + case 683: // optional_method_modificators -> tkSemiColon { CurrentSemanticValue.stn = new procedure_attributes_list(new List(),CurrentLocationSpan); } break; - case 683: // optional_method_modificators -> tkSemiColon, meth_modificators, tkSemiColon + case 684: // optional_method_modificators -> tkSemiColon, meth_modificators, tkSemiColon { //parsertools.AddModifier((procedure_attributes_list)$2, proc_attribute.attr_overload); CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-2].stn; } break; - case 684: // optional_method_modificators1 -> /* empty */ + case 685: // optional_method_modificators1 -> /* empty */ { CurrentSemanticValue.stn = new procedure_attributes_list(new List(),CurrentLocationSpan); } break; - case 685: // optional_method_modificators1 -> tkSemiColon, meth_modificators + case 686: // optional_method_modificators1 -> tkSemiColon, meth_modificators { //parsertools.AddModifier((procedure_attributes_list)$2, proc_attribute.attr_overload); CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 686: // meth_modificators -> meth_modificator + case 687: // meth_modificators -> meth_modificator { CurrentSemanticValue.stn = new procedure_attributes_list(ValueStack[ValueStack.Depth-1].id as procedure_attribute, CurrentLocationSpan); } break; - case 687: // meth_modificators -> meth_modificators, tkSemiColon, meth_modificator + case 688: // meth_modificators -> meth_modificators, tkSemiColon, meth_modificator { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-3].stn as procedure_attributes_list).Add(ValueStack[ValueStack.Depth-1].id as procedure_attribute, CurrentLocationSpan); } break; - case 688: // identifier -> tkIdentifier + case 689: // identifier -> tkIdentifier { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 689: // identifier -> property_specifier_directives + case 690: // identifier -> property_specifier_directives { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 690: // identifier -> non_reserved + case 691: // identifier -> non_reserved { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 691: // identifier_or_keyword -> identifier + case 692: // identifier_or_keyword -> identifier { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 692: // identifier_or_keyword -> keyword + case 693: // identifier_or_keyword -> keyword { CurrentSemanticValue.id = new ident(ValueStack[ValueStack.Depth-1].ti.text, CurrentLocationSpan); } break; - case 693: // identifier_or_keyword -> reserved_keyword + case 694: // identifier_or_keyword -> reserved_keyword { CurrentSemanticValue.id = new ident(ValueStack[ValueStack.Depth-1].ti.text, CurrentLocationSpan); } break; - case 694: // identifier_keyword_operatorname -> identifier + case 695: // identifier_keyword_operatorname -> identifier { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 695: // identifier_keyword_operatorname -> keyword + case 696: // identifier_keyword_operatorname -> keyword { CurrentSemanticValue.id = new ident(ValueStack[ValueStack.Depth-1].ti.text, CurrentLocationSpan); } break; - case 696: // identifier_keyword_operatorname -> operator_name_ident + case 697: // identifier_keyword_operatorname -> operator_name_ident { CurrentSemanticValue.id = (ident)ValueStack[ValueStack.Depth-1].ex; } break; - case 697: // meth_modificator -> tkAbstract + case 698: // meth_modificator -> tkAbstract { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 698: // meth_modificator -> tkOverload + case 699: // meth_modificator -> tkOverload { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; parsertools.AddWarningFromResource("OVERLOAD_IS_NOT_USED", ValueStack[ValueStack.Depth-1].id.source_context); } break; - case 699: // meth_modificator -> tkReintroduce + case 700: // meth_modificator -> tkReintroduce { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 700: // meth_modificator -> tkOverride + case 701: // meth_modificator -> tkOverride { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 701: // meth_modificator -> tkExtensionMethod + case 702: // meth_modificator -> tkExtensionMethod { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 702: // meth_modificator -> tkVirtual + case 703: // meth_modificator -> tkVirtual { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 703: // property_modificator -> tkVirtual + case 704: // property_modificator -> tkVirtual { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 704: // property_modificator -> tkOverride + case 705: // property_modificator -> tkOverride { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 705: // property_specifier_directives -> tkRead + case 706: // property_specifier_directives -> tkRead { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 706: // property_specifier_directives -> tkWrite + case 707: // property_specifier_directives -> tkWrite { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 707: // non_reserved -> tkName + case 708: // non_reserved -> tkName { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 708: // non_reserved -> tkNew + case 709: // non_reserved -> tkNew { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 709: // visibility_specifier -> tkInternal + case 710: // visibility_specifier -> tkInternal { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 710: // visibility_specifier -> tkPublic + case 711: // visibility_specifier -> tkPublic { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 711: // visibility_specifier -> tkProtected + case 712: // visibility_specifier -> tkProtected { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 712: // visibility_specifier -> tkPrivate + case 713: // visibility_specifier -> tkPrivate { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 713: // keyword -> visibility_specifier + case 714: // keyword -> visibility_specifier { CurrentSemanticValue.ti = new token_info(ValueStack[ValueStack.Depth-1].id.name, CurrentLocationSpan); } break; - case 714: // keyword -> tkSealed + case 715: // keyword -> tkSealed { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 715: // keyword -> tkTemplate + case 716: // keyword -> tkTemplate { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 716: // keyword -> tkOr + case 717: // keyword -> tkOr { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].op; } break; - case 717: // keyword -> tkTypeOf + case 718: // keyword -> tkTypeOf { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 718: // keyword -> tkSizeOf + case 719: // keyword -> tkSizeOf { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 719: // keyword -> tkDefault + case 720: // keyword -> tkDefault { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 720: // keyword -> tkWhere + case 721: // keyword -> tkWhere { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 721: // keyword -> tkXor + case 722: // keyword -> tkXor { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].op; } break; - case 722: // keyword -> tkAnd + case 723: // keyword -> tkAnd { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].op; } break; - case 723: // keyword -> tkDiv + case 724: // keyword -> tkDiv { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].op; } break; - case 724: // keyword -> tkMod + case 725: // keyword -> tkMod { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].op; } break; - case 725: // keyword -> tkShl + case 726: // keyword -> tkShl { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].op; } break; - case 726: // keyword -> tkShr + case 727: // keyword -> tkShr { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].op; } break; - case 727: // keyword -> tkNot + case 728: // keyword -> tkNot { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].op; } break; - case 728: // keyword -> tkAs + case 729: // keyword -> tkAs { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].op; } break; - case 729: // keyword -> tkIn + case 730: // keyword -> tkIn { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].op; } break; - case 730: // keyword -> tkIs + case 731: // keyword -> tkIs { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].op; } break; - case 731: // keyword -> tkArray + case 732: // keyword -> tkArray { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 732: // keyword -> tkSequence + case 733: // keyword -> tkSequence { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 733: // keyword -> tkBegin + case 734: // keyword -> tkBegin { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 734: // keyword -> tkCase + case 735: // keyword -> tkCase { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 735: // keyword -> tkClass + case 736: // keyword -> tkClass { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 736: // keyword -> tkConst + case 737: // keyword -> tkConst { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 737: // keyword -> tkConstructor + case 738: // keyword -> tkConstructor { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 738: // keyword -> tkDestructor + case 739: // keyword -> tkDestructor { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 739: // keyword -> tkDownto + case 740: // keyword -> tkDownto { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 740: // keyword -> tkDo + case 741: // keyword -> tkDo { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 741: // keyword -> tkElse + case 742: // keyword -> tkElse { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 742: // keyword -> tkExcept + case 743: // keyword -> tkExcept { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 743: // keyword -> tkFile + case 744: // keyword -> tkFile { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 744: // keyword -> tkAuto + case 745: // keyword -> tkAuto { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 745: // keyword -> tkFinalization + case 746: // keyword -> tkFinalization { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 746: // keyword -> tkFinally + case 747: // keyword -> tkFinally { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 747: // keyword -> tkFor + case 748: // keyword -> tkFor { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 748: // keyword -> tkForeach + case 749: // keyword -> tkForeach { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 749: // keyword -> tkFunction + case 750: // keyword -> tkFunction { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 750: // keyword -> tkIf + case 751: // keyword -> tkIf { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 751: // keyword -> tkImplementation + case 752: // keyword -> tkImplementation { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 752: // keyword -> tkInherited + case 753: // keyword -> tkInherited { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 753: // keyword -> tkInitialization + case 754: // keyword -> tkInitialization { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 754: // keyword -> tkInterface + case 755: // keyword -> tkInterface { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 755: // keyword -> tkProcedure + case 756: // keyword -> tkProcedure { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 756: // keyword -> tkProperty + case 757: // keyword -> tkProperty { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 757: // keyword -> tkRaise + case 758: // keyword -> tkRaise { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 758: // keyword -> tkRecord + case 759: // keyword -> tkRecord { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 759: // keyword -> tkRepeat + case 760: // keyword -> tkRepeat { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 760: // keyword -> tkSet + case 761: // keyword -> tkSet { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 761: // keyword -> tkTry + case 762: // keyword -> tkTry { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 762: // keyword -> tkType + case 763: // keyword -> tkType { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 763: // keyword -> tkThen + case 764: // keyword -> tkThen { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 764: // keyword -> tkTo + case 765: // keyword -> tkTo { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 765: // keyword -> tkUntil + case 766: // keyword -> tkUntil { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 766: // keyword -> tkUses + case 767: // keyword -> tkUses { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 767: // keyword -> tkVar + case 768: // keyword -> tkVar { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 768: // keyword -> tkWhile + case 769: // keyword -> tkWhile { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 769: // keyword -> tkWith + case 770: // keyword -> tkWith { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 770: // keyword -> tkNil + case 771: // keyword -> tkNil { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 771: // keyword -> tkGoto + case 772: // keyword -> tkGoto { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 772: // keyword -> tkOf + case 773: // keyword -> tkOf { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 773: // keyword -> tkLabel + case 774: // keyword -> tkLabel { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 774: // keyword -> tkProgram + case 775: // keyword -> tkProgram { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 775: // keyword -> tkUnit + case 776: // keyword -> tkUnit { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 776: // keyword -> tkLibrary + case 777: // keyword -> tkLibrary { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 777: // keyword -> tkNamespace + case 778: // keyword -> tkNamespace { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 778: // keyword -> tkExternal + case 779: // keyword -> tkExternal { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 779: // keyword -> tkParams + case 780: // keyword -> tkParams { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 780: // keyword -> tkEvent + case 781: // keyword -> tkEvent { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 781: // keyword -> tkYield + case 782: // keyword -> tkYield { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 782: // reserved_keyword -> tkOperator + case 783: // reserved_keyword -> tkOperator { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 783: // reserved_keyword -> tkEnd + case 784: // reserved_keyword -> tkEnd { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 784: // overload_operator -> tkMinus + case 785: // overload_operator -> tkMinus { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 785: // overload_operator -> tkPlus + case 786: // overload_operator -> tkPlus { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 786: // overload_operator -> tkSlash + case 787: // overload_operator -> tkSlash { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 787: // overload_operator -> tkStar + case 788: // overload_operator -> tkStar { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 788: // overload_operator -> tkEqual + case 789: // overload_operator -> tkEqual { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 789: // overload_operator -> tkGreater + case 790: // overload_operator -> tkGreater { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 790: // overload_operator -> tkGreaterEqual + case 791: // overload_operator -> tkGreaterEqual { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 791: // overload_operator -> tkLower + case 792: // overload_operator -> tkLower { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 792: // overload_operator -> tkLowerEqual + case 793: // overload_operator -> tkLowerEqual { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 793: // overload_operator -> tkNotEqual + case 794: // overload_operator -> tkNotEqual { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 794: // overload_operator -> tkOr + case 795: // overload_operator -> tkOr { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 795: // overload_operator -> tkXor + case 796: // overload_operator -> tkXor { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 796: // overload_operator -> tkAnd + case 797: // overload_operator -> tkAnd { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 797: // overload_operator -> tkDiv + case 798: // overload_operator -> tkDiv { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 798: // overload_operator -> tkMod + case 799: // overload_operator -> tkMod { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 799: // overload_operator -> tkShl + case 800: // overload_operator -> tkShl { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 800: // overload_operator -> tkShr + case 801: // overload_operator -> tkShr { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 801: // overload_operator -> tkNot + case 802: // overload_operator -> tkNot { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 802: // overload_operator -> tkIn + case 803: // overload_operator -> tkIn { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 803: // overload_operator -> tkImplicit + case 804: // overload_operator -> tkImplicit { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 804: // overload_operator -> tkExplicit + case 805: // overload_operator -> tkExplicit { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 805: // overload_operator -> assign_operator + case 806: // overload_operator -> assign_operator { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 806: // overload_operator -> tkStarStar + case 807: // overload_operator -> tkStarStar { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 807: // assign_operator -> tkAssign + case 808: // assign_operator -> tkAssign { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 808: // assign_operator -> tkPlusEqual + case 809: // assign_operator -> tkPlusEqual { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 809: // assign_operator -> tkMinusEqual + case 810: // assign_operator -> tkMinusEqual { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 810: // assign_operator -> tkMultEqual + case 811: // assign_operator -> tkMultEqual { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 811: // assign_operator -> tkDivEqual + case 812: // assign_operator -> tkDivEqual { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 812: // func_decl_lambda -> identifier, tkArrow, lambda_function_body + case 813: // func_decl_lambda -> identifier, tkArrow, lambda_function_body { var idList = new ident_list(ValueStack[ValueStack.Depth-3].id, LocationStack[LocationStack.Depth-3]); var formalPars = new formal_parameters(new typed_parameters(idList, new lambda_inferred_type(new PascalABCCompiler.TreeRealization.lambda_any_type_node(), LocationStack[LocationStack.Depth-3]), parametr_kind.none, null, LocationStack[LocationStack.Depth-3]), LocationStack[LocationStack.Depth-3]); CurrentSemanticValue.ex = new function_lambda_definition(lambdaHelper.CreateLambdaName(), formalPars, new lambda_inferred_type(new PascalABCCompiler.TreeRealization.lambda_any_type_node(), LocationStack[LocationStack.Depth-3]), ValueStack[ValueStack.Depth-1].stn as statement_list, CurrentLocationSpan); } break; - case 813: // func_decl_lambda -> tkRoundOpen, tkRoundClose, lambda_type_ref_noproctype, + case 814: // func_decl_lambda -> tkRoundOpen, tkRoundClose, lambda_type_ref_noproctype, // tkArrow, lambda_function_body { CurrentSemanticValue.ex = new function_lambda_definition(lambdaHelper.CreateLambdaName(), null, ValueStack[ValueStack.Depth-3].td, ValueStack[ValueStack.Depth-1].stn as statement_list, CurrentLocationSpan); } break; - case 814: // func_decl_lambda -> tkRoundOpen, identifier, tkColon, fptype, tkRoundClose, + case 815: // func_decl_lambda -> tkRoundOpen, identifier, tkColon, fptype, tkRoundClose, // lambda_type_ref_noproctype, tkArrow, lambda_function_body { var idList = new ident_list(ValueStack[ValueStack.Depth-7].id, LocationStack[LocationStack.Depth-7]); @@ -5932,7 +5940,7 @@ public partial class GPPGParser: ShiftReduceParser tkRoundOpen, identifier, tkSemiColon, full_lambda_fp_list, + case 816: // func_decl_lambda -> tkRoundOpen, identifier, tkSemiColon, full_lambda_fp_list, // tkRoundClose, lambda_type_ref_noproctype, tkArrow, // lambda_function_body { @@ -5943,7 +5951,7 @@ public partial class GPPGParser: ShiftReduceParser tkRoundOpen, identifier, tkColon, fptype, tkSemiColon, + case 817: // func_decl_lambda -> tkRoundOpen, identifier, tkColon, fptype, tkSemiColon, // full_lambda_fp_list, tkRoundClose, // lambda_type_ref_noproctype, tkArrow, lambda_function_body { @@ -5955,7 +5963,7 @@ public partial class GPPGParser: ShiftReduceParser tkRoundOpen, expr_l1, tkComma, expr_l1_list, + case 818: // func_decl_lambda -> tkRoundOpen, expr_l1, tkComma, expr_l1_list, // lambda_type_ref, optional_full_lambda_fp_list, // tkRoundClose, rem_lambda { @@ -6017,61 +6025,61 @@ public partial class GPPGParser: ShiftReduceParser expl_func_decl_lambda + case 819: // func_decl_lambda -> expl_func_decl_lambda { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 819: // optional_full_lambda_fp_list -> /* empty */ + case 820: // optional_full_lambda_fp_list -> /* empty */ { CurrentSemanticValue.stn = null; } break; - case 820: // optional_full_lambda_fp_list -> tkSemiColon, full_lambda_fp_list + case 821: // optional_full_lambda_fp_list -> tkSemiColon, full_lambda_fp_list { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 821: // rem_lambda -> lambda_type_ref_noproctype, tkArrow, lambda_function_body + case 822: // rem_lambda -> lambda_type_ref_noproctype, tkArrow, lambda_function_body { CurrentSemanticValue.ob = new pair_type_stlist(ValueStack[ValueStack.Depth-3].td,ValueStack[ValueStack.Depth-1].stn as statement_list); } break; - case 822: // expl_func_decl_lambda -> tkFunction, lambda_type_ref, tkArrow, + case 823: // expl_func_decl_lambda -> tkFunction, lambda_type_ref, tkArrow, // lambda_function_body { CurrentSemanticValue.ex = new function_lambda_definition(lambdaHelper.CreateLambdaName(), null, ValueStack[ValueStack.Depth-3].td, ValueStack[ValueStack.Depth-1].stn as statement_list, 1, CurrentLocationSpan); } break; - case 823: // expl_func_decl_lambda -> tkFunction, tkRoundOpen, tkRoundClose, lambda_type_ref, + case 824: // expl_func_decl_lambda -> tkFunction, tkRoundOpen, tkRoundClose, lambda_type_ref, // tkArrow, lambda_function_body { CurrentSemanticValue.ex = new function_lambda_definition(lambdaHelper.CreateLambdaName(), null, ValueStack[ValueStack.Depth-3].td, ValueStack[ValueStack.Depth-1].stn as statement_list, 1, CurrentLocationSpan); } break; - case 824: // expl_func_decl_lambda -> tkFunction, tkRoundOpen, full_lambda_fp_list, + case 825: // expl_func_decl_lambda -> tkFunction, tkRoundOpen, full_lambda_fp_list, // tkRoundClose, lambda_type_ref, tkArrow, // lambda_function_body { CurrentSemanticValue.ex = new function_lambda_definition(lambdaHelper.CreateLambdaName(), ValueStack[ValueStack.Depth-5].stn as formal_parameters, ValueStack[ValueStack.Depth-3].td, ValueStack[ValueStack.Depth-1].stn as statement_list, 1, CurrentLocationSpan); } break; - case 825: // expl_func_decl_lambda -> tkProcedure, tkArrow, lambda_procedure_body + case 826: // expl_func_decl_lambda -> tkProcedure, tkArrow, lambda_procedure_body { CurrentSemanticValue.ex = new function_lambda_definition(lambdaHelper.CreateLambdaName(), null, null, ValueStack[ValueStack.Depth-1].stn as statement_list, 2, CurrentLocationSpan); } break; - case 826: // expl_func_decl_lambda -> tkProcedure, tkRoundOpen, tkRoundClose, tkArrow, + case 827: // expl_func_decl_lambda -> tkProcedure, tkRoundOpen, tkRoundClose, tkArrow, // lambda_procedure_body { CurrentSemanticValue.ex = new function_lambda_definition(lambdaHelper.CreateLambdaName(), null, null, ValueStack[ValueStack.Depth-1].stn as statement_list, 2, CurrentLocationSpan); } break; - case 827: // expl_func_decl_lambda -> tkProcedure, tkRoundOpen, full_lambda_fp_list, + case 828: // expl_func_decl_lambda -> tkProcedure, tkRoundOpen, full_lambda_fp_list, // tkRoundClose, tkArrow, lambda_procedure_body { CurrentSemanticValue.ex = new function_lambda_definition(lambdaHelper.CreateLambdaName(), ValueStack[ValueStack.Depth-4].stn as formal_parameters, null, ValueStack[ValueStack.Depth-1].stn as statement_list, 2, CurrentLocationSpan); } break; - case 828: // full_lambda_fp_list -> lambda_simple_fp_sect + case 829: // full_lambda_fp_list -> lambda_simple_fp_sect { var typed_pars = ValueStack[ValueStack.Depth-1].stn as typed_parameters; if (typed_pars.vars_type is lambda_inferred_type) @@ -6091,147 +6099,147 @@ public partial class GPPGParser: ShiftReduceParser full_lambda_fp_list, tkSemiColon, lambda_simple_fp_sect + case 830: // full_lambda_fp_list -> full_lambda_fp_list, tkSemiColon, lambda_simple_fp_sect { CurrentSemanticValue.stn =(ValueStack[ValueStack.Depth-3].stn as formal_parameters).Add(ValueStack[ValueStack.Depth-1].stn as typed_parameters, CurrentLocationSpan); } break; - case 830: // lambda_simple_fp_sect -> ident_list, lambda_type_ref + case 831: // lambda_simple_fp_sect -> ident_list, lambda_type_ref { CurrentSemanticValue.stn = new typed_parameters(ValueStack[ValueStack.Depth-2].stn as ident_list, ValueStack[ValueStack.Depth-1].td, parametr_kind.none, null, CurrentLocationSpan); } break; - case 831: // lambda_type_ref -> /* empty */ + case 832: // lambda_type_ref -> /* empty */ { CurrentSemanticValue.td = new lambda_inferred_type(new PascalABCCompiler.TreeRealization.lambda_any_type_node(), null); } break; - case 832: // lambda_type_ref -> tkColon, fptype + case 833: // lambda_type_ref -> tkColon, fptype { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 833: // lambda_type_ref_noproctype -> /* empty */ + case 834: // lambda_type_ref_noproctype -> /* empty */ { CurrentSemanticValue.td = new lambda_inferred_type(new PascalABCCompiler.TreeRealization.lambda_any_type_node(), null); } break; - case 834: // lambda_type_ref_noproctype -> tkColon, fptype_noproctype + case 835: // lambda_type_ref_noproctype -> tkColon, fptype_noproctype { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 835: // lambda_function_body -> expr_l1 + case 836: // lambda_function_body -> expr_l1 { CurrentSemanticValue.stn = NewLambdaBody(ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 836: // lambda_function_body -> compound_stmt + case 837: // lambda_function_body -> compound_stmt { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 837: // lambda_function_body -> if_stmt + case 838: // lambda_function_body -> if_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 838: // lambda_function_body -> while_stmt + case 839: // lambda_function_body -> while_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 839: // lambda_function_body -> repeat_stmt + case 840: // lambda_function_body -> repeat_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 840: // lambda_function_body -> for_stmt + case 841: // lambda_function_body -> for_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 841: // lambda_function_body -> foreach_stmt + case 842: // lambda_function_body -> foreach_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 842: // lambda_function_body -> case_stmt + case 843: // lambda_function_body -> case_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 843: // lambda_function_body -> try_stmt + case 844: // lambda_function_body -> try_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 844: // lambda_function_body -> lock_stmt + case 845: // lambda_function_body -> lock_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 845: // lambda_function_body -> yield_stmt + case 846: // lambda_function_body -> yield_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 846: // lambda_procedure_body -> proc_call + case 847: // lambda_procedure_body -> proc_call { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 847: // lambda_procedure_body -> compound_stmt + case 848: // lambda_procedure_body -> compound_stmt { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 848: // lambda_procedure_body -> if_stmt + case 849: // lambda_procedure_body -> if_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 849: // lambda_procedure_body -> while_stmt + case 850: // lambda_procedure_body -> while_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 850: // lambda_procedure_body -> repeat_stmt + case 851: // lambda_procedure_body -> repeat_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 851: // lambda_procedure_body -> for_stmt + case 852: // lambda_procedure_body -> for_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 852: // lambda_procedure_body -> foreach_stmt + case 853: // lambda_procedure_body -> foreach_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 853: // lambda_procedure_body -> case_stmt + case 854: // lambda_procedure_body -> case_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 854: // lambda_procedure_body -> try_stmt + case 855: // lambda_procedure_body -> try_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 855: // lambda_procedure_body -> lock_stmt + case 856: // lambda_procedure_body -> lock_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 856: // lambda_procedure_body -> yield_stmt + case 857: // lambda_procedure_body -> yield_stmt { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } break; - case 857: // lambda_procedure_body -> assignment + case 858: // lambda_procedure_body -> assignment { CurrentSemanticValue.stn = new statement_list(ValueStack[ValueStack.Depth-1].stn as statement, CurrentLocationSpan); } diff --git a/SyntaxTree/tree/AbstractVisitor.cs b/SyntaxTree/tree/AbstractVisitor.cs index 8ce7d317f..1d6ef2611 100644 --- a/SyntaxTree/tree/AbstractVisitor.cs +++ b/SyntaxTree/tree/AbstractVisitor.cs @@ -1142,6 +1142,11 @@ namespace PascalABCCompiler.SyntaxTree { DefaultVisit(_typeclass_param_list); } + + public virtual void visit(typeclass_reference _typeclass_reference) + { + DefaultVisit(_typeclass_reference); + } } diff --git a/SyntaxTree/tree/HierarchyVisitor.cs b/SyntaxTree/tree/HierarchyVisitor.cs index fd3134cba..4fdbfc685 100644 --- a/SyntaxTree/tree/HierarchyVisitor.cs +++ b/SyntaxTree/tree/HierarchyVisitor.cs @@ -1821,6 +1821,14 @@ namespace PascalABCCompiler.SyntaxTree { } + public virtual void pre_do_visit(typeclass_reference _typeclass_reference) + { + } + + public virtual void post_do_visit(typeclass_reference _typeclass_reference) + { + } + public override void visit(expression _expression) { DefaultVisit(_expression); @@ -3763,6 +3771,14 @@ namespace PascalABCCompiler.SyntaxTree pre_do_visit(_typeclass_param_list); post_do_visit(_typeclass_param_list); } + + public override void visit(typeclass_reference _typeclass_reference) + { + DefaultVisit(_typeclass_reference); + pre_do_visit(_typeclass_reference); + visit(typeclass_reference.restriction_args); + post_do_visit(_typeclass_reference); + } } diff --git a/SyntaxTree/tree/SyntaxTreeStreamReader.cs b/SyntaxTree/tree/SyntaxTreeStreamReader.cs index 9d0239964..090ebbe2a 100644 --- a/SyntaxTree/tree/SyntaxTreeStreamReader.cs +++ b/SyntaxTree/tree/SyntaxTreeStreamReader.cs @@ -474,6 +474,8 @@ namespace PascalABCCompiler.SyntaxTree return new where_typeclass_constraint(); case 226: return new typeclass_param_list(); + case 227: + return new typeclass_reference(); } return null; } @@ -3990,6 +3992,18 @@ namespace PascalABCCompiler.SyntaxTree read_template_param_list(_typeclass_param_list); } + + public void visit(typeclass_reference _typeclass_reference) + { + read_typeclass_reference(_typeclass_reference); + } + + public void read_typeclass_reference(typeclass_reference _typeclass_reference) + { + read_named_type_reference(_typeclass_reference); + _typeclass_reference.restriction_args = _read_node() as template_param_list; + } + } diff --git a/SyntaxTree/tree/SyntaxTreeStreamWriter.cs b/SyntaxTree/tree/SyntaxTreeStreamWriter.cs index 792567e2e..910dbc9cf 100644 --- a/SyntaxTree/tree/SyntaxTreeStreamWriter.cs +++ b/SyntaxTree/tree/SyntaxTreeStreamWriter.cs @@ -6244,6 +6244,27 @@ namespace PascalABCCompiler.SyntaxTree write_template_param_list(_typeclass_param_list); } + + public void visit(typeclass_reference _typeclass_reference) + { + bw.Write((Int16)227); + write_typeclass_reference(_typeclass_reference); + } + + public void write_typeclass_reference(typeclass_reference _typeclass_reference) + { + write_named_type_reference(_typeclass_reference); + if (_typeclass_reference.restriction_args == null) + { + bw.Write((byte)0); + } + else + { + bw.Write((byte)1); + _typeclass_reference.restriction_args.visit(this); + } + } + } diff --git a/SyntaxTree/tree/Tree.cs b/SyntaxTree/tree/Tree.cs index 15f6773f6..57318c6d2 100644 --- a/SyntaxTree/tree/Tree.cs +++ b/SyntaxTree/tree/Tree.cs @@ -48225,8 +48225,8 @@ namespace PascalABCCompiler.SyntaxTree FillParentsInDirectChilds(); } public typeclass_param_list(template_param_list _template_param_list): this(_template_param_list.dereferencing_value, _template_param_list.params_list, _template_param_list.source_context) - { - } +{ +} /// Создает копию узла public override syntax_tree_node Clone() @@ -48373,6 +48373,238 @@ namespace PascalABCCompiler.SyntaxTree } + /// + /// + /// + [Serializable] + public partial class typeclass_reference : named_type_reference + { + + /// + ///Конструктор без параметров. + /// + public typeclass_reference() + { + + } + + /// + ///Конструктор с параметрами. + /// + public typeclass_reference(template_param_list _restriction_args) + { + this._restriction_args=_restriction_args; + FillParentsInDirectChilds(); + } + + /// + ///Конструктор с параметрами. + /// + public typeclass_reference(template_param_list _restriction_args,SourceContext sc) + { + this._restriction_args=_restriction_args; + source_context = sc; + FillParentsInDirectChilds(); + } + + /// + ///Конструктор с параметрами. + /// + public typeclass_reference(type_definition_attr_list _attr_list,List _names,template_param_list _restriction_args) + { + this._attr_list=_attr_list; + this._names=_names; + this._restriction_args=_restriction_args; + FillParentsInDirectChilds(); + } + + /// + ///Конструктор с параметрами. + /// + public typeclass_reference(type_definition_attr_list _attr_list,List _names,template_param_list _restriction_args,SourceContext sc) + { + this._attr_list=_attr_list; + this._names=_names; + this._restriction_args=_restriction_args; + source_context = sc; + FillParentsInDirectChilds(); + } + protected template_param_list _restriction_args; + + /// + /// + /// + public template_param_list restriction_args + { + get + { + return _restriction_args; + } + set + { + _restriction_args=value; + } + } + + + /// Создает копию узла + public override syntax_tree_node Clone() + { + typeclass_reference copy = new typeclass_reference(); + copy.Parent = this.Parent; + if (source_context != null) + copy.source_context = new SourceContext(source_context); + if (attributes != null) + { + copy.attributes = (attribute_list)attributes.Clone(); + copy.attributes.Parent = copy; + } + if (attr_list != null) + { + copy.attr_list = (type_definition_attr_list)attr_list.Clone(); + copy.attr_list.Parent = copy; + } + if (names != null) + { + foreach (ident elem in names) + { + if (elem != null) + { + copy.Add((ident)elem.Clone()); + copy.Last().Parent = copy; + } + else + copy.Add(null); + } + } + if (restriction_args != null) + { + copy.restriction_args = (template_param_list)restriction_args.Clone(); + copy.restriction_args.Parent = copy; + } + return copy; + } + + /// Получает копию данного узла корректного типа + public new typeclass_reference TypedClone() + { + return Clone() as typeclass_reference; + } + + /// Заполняет поля Parent в непосредственных дочерних узлах + public override void FillParentsInDirectChilds() + { + if (attributes != null) + attributes.Parent = this; + if (attr_list != null) + attr_list.Parent = this; + if (names != null) + { + foreach (var child in names) + if (child != null) + child.Parent = this; + } + if (restriction_args != null) + restriction_args.Parent = this; + } + + /// Заполняет поля Parent во всем поддереве + public override void FillParentsInAllChilds() + { + FillParentsInDirectChilds(); + attributes?.FillParentsInAllChilds(); + attr_list?.FillParentsInAllChilds(); + if (names != null) + { + foreach (var child in names) + child?.FillParentsInAllChilds(); + } + restriction_args?.FillParentsInAllChilds(); + } + + /// + ///Свойство для получения количества всех подузлов без элементов поля типа List + /// + public override Int32 subnodes_without_list_elements_count + { + get + { + return 2; + } + } + /// + ///Свойство для получения количества всех подузлов. Подузлом также считается каждый элемент поля типа List + /// + public override Int32 subnodes_count + { + get + { + return 2 + (names == null ? 0 : names.Count); + } + } + /// + ///Индексатор для получения всех подузлов + /// + public override syntax_tree_node this[Int32 ind] + { + get + { + if(subnodes_count == 0 || ind < 0 || ind > subnodes_count-1) + throw new IndexOutOfRangeException(); + switch(ind) + { + case 0: + return attr_list; + case 1: + return restriction_args; + } + Int32 index_counter=ind - 2; + if(names != null) + { + if(index_counter < names.Count) + { + return names[index_counter]; + } + } + return null; + } + set + { + if(subnodes_count == 0 || ind < 0 || ind > subnodes_count-1) + throw new IndexOutOfRangeException(); + switch(ind) + { + case 0: + attr_list = (type_definition_attr_list)value; + break; + case 1: + restriction_args = (template_param_list)value; + break; + } + Int32 index_counter=ind - 2; + if(names != null) + { + if(index_counter < names.Count) + { + names[index_counter]= (ident)value; + return; + } + } + } + } + /// + ///Метод для обхода дерева посетителем + /// + ///Объект-посетитель. + ///Return value is void + public override void visit(IVisitor visitor) + { + visitor.visit(this); + } + + } + + } diff --git a/SyntaxTree/tree/Visitor.cs b/SyntaxTree/tree/Visitor.cs index 1a59ae516..ffe8d748f 100644 --- a/SyntaxTree/tree/Visitor.cs +++ b/SyntaxTree/tree/Visitor.cs @@ -1366,6 +1366,12 @@ namespace PascalABCCompiler.SyntaxTree ///Node to visit /// Return value is void void visit(typeclass_param_list _typeclass_param_list); + /// + ///Method to visit typeclass_reference. + /// + ///Node to visit + /// Return value is void + void visit(typeclass_reference _typeclass_reference); } diff --git a/SyntaxTree/tree/tree.xml b/SyntaxTree/tree/tree.xml index dda99b84e..fec84e825 100644 --- a/SyntaxTree/tree/tree.xml +++ b/SyntaxTree/tree/tree.xml @@ -2940,6 +2940,22 @@ + + + + + + + + 0 + 0 + + + 9 + 4 + + + Tree.cs @@ -2960,12 +2976,12 @@ - + - + @@ -4162,6 +4178,9 @@ + + + diff --git a/SyntaxTreeConverters/StandardSyntaxConverter.cs b/SyntaxTreeConverters/StandardSyntaxConverter.cs index 0fd484011..d4379b0e9 100644 --- a/SyntaxTreeConverters/StandardSyntaxConverter.cs +++ b/SyntaxTreeConverters/StandardSyntaxConverter.cs @@ -31,6 +31,8 @@ namespace PascalABCCompiler.SyntaxTreeConverters instancesAndRestrictedFunctions.ProcessNode(root); SyntaxVisitors.TypeclassVisitors.ReplaceTypeclassVisitor.New(instancesAndRestrictedFunctions).ProcessNode(root); } + root.FillParentsInAllChilds(); + new SimplePrettyPrinterVisitor("E:/projs/out.txt").ProcessNode(root); // loop LoopDesugarVisitor.New.ProcessNode(root); diff --git a/SyntaxVisitors/TypeclassVisitors/FindInstancesAndRestrictedFunctionsVisitor.cs b/SyntaxVisitors/TypeclassVisitors/FindInstancesAndRestrictedFunctionsVisitor.cs index 49c5de87e..2049a45ba 100644 --- a/SyntaxVisitors/TypeclassVisitors/FindInstancesAndRestrictedFunctionsVisitor.cs +++ b/SyntaxVisitors/TypeclassVisitors/FindInstancesAndRestrictedFunctionsVisitor.cs @@ -13,13 +13,13 @@ namespace SyntaxVisitors.TypeclassVisitors { // (Typeclass name) -> (Type arguments count) - public Dictionary typeclasses; + public Dictionary typeclasses; // (Typeclass name) -> [Instances] public Dictionary> instances = new Dictionary>(); public Dictionary> restrictedFunctions = new Dictionary>(); - public FindInstancesAndRestrictedFunctionsVisitor(Dictionary typeclasses) + public FindInstancesAndRestrictedFunctionsVisitor(Dictionary typeclasses) { this.typeclasses = typeclasses; @@ -30,7 +30,7 @@ namespace SyntaxVisitors.TypeclassVisitors } - public static FindInstancesAndRestrictedFunctionsVisitor New(Dictionary typeclasses) + public static FindInstancesAndRestrictedFunctionsVisitor New(Dictionary typeclasses) { return new FindInstancesAndRestrictedFunctionsVisitor(typeclasses); } diff --git a/SyntaxVisitors/TypeclassVisitors/FindTypeclassesVisitor.cs b/SyntaxVisitors/TypeclassVisitors/FindTypeclassesVisitor.cs index 6b502db64..9b163a958 100644 --- a/SyntaxVisitors/TypeclassVisitors/FindTypeclassesVisitor.cs +++ b/SyntaxVisitors/TypeclassVisitors/FindTypeclassesVisitor.cs @@ -14,7 +14,7 @@ namespace SyntaxVisitors.TypeclassVisitors //TODO: add searching typeclasses at libraries // (Typeclass name) -> (Type arguments count) - public Dictionary typeclasses = new Dictionary(); + public Dictionary typeclasses = new Dictionary(); public FindTypeclassesVisitor() @@ -42,7 +42,7 @@ namespace SyntaxVisitors.TypeclassVisitors var typeclassName = typeclassDeclaration.type_name as typeclass_restriction; - typeclasses.Add(typeclassName.name, typeclassName.restriction_args.params_list.Count); + typeclasses.Add(typeclassName.name, typeclassDeclaration); } } } diff --git a/SyntaxVisitors/TypeclassVisitors/ReplaceTypeclassVisitor.cs b/SyntaxVisitors/TypeclassVisitors/ReplaceTypeclassVisitor.cs index e7d751178..c609eb11b 100644 --- a/SyntaxVisitors/TypeclassVisitors/ReplaceTypeclassVisitor.cs +++ b/SyntaxVisitors/TypeclassVisitors/ReplaceTypeclassVisitor.cs @@ -7,6 +7,7 @@ using PascalABCCompiler; using PascalABCCompiler.Errors; using PascalABCCompiler.SyntaxTree; + namespace SyntaxVisitors.TypeclassVisitors { public class ReplaceTypeclassVisitor: BaseChangeVisitor @@ -32,13 +33,44 @@ namespace SyntaxVisitors.TypeclassVisitors } var instanceName = instanceDeclaration.type_name as typeclass_restriction; - var parents = new named_type_reference_list(new template_type_reference( - instanceName.name, instanceName.restriction_args)); + // If it is instance of derived typelass than it should have template parameters + var templateArgs = new ident_list(); + where_definition_list whereSection = null; + var typeclassParents = (instancesAndRestrictedFunctions.typeclasses[instanceName.name].type_def as typeclass_definition).additional_restrictions; + if (typeclassParents != null && typeclassParents.Count > 0) + { + whereSection = new where_definition_list(); + + for (int i = 0; i < typeclassParents.Count; i++) + { + ident template_name; + if (typeclassParents[i] is typeclass_reference tr) + { + string name = tr.names[0].name; + template_name = TypeclassRestrctionToTemplateName(name, tr.restriction_args); + + whereSection.Add(GetWhereRestriction( + TypeclassReferenceToInterfaceName(name, instanceName.restriction_args), + template_name)); + } + else + { + throw new NotImplementedException("Should be syntactic error"); + } + templateArgs.Add(template_name); + } + } + + List templateLists = instanceName.restriction_args.params_list.Concat(templateArgs.idents.Select(x => new named_type_reference(x.name)).OfType()).ToList(); + var parents = new named_type_reference_list(new List { + new template_type_reference(instanceName.name, new template_param_list(templateLists)), + new template_type_reference("I" + instanceName.name, instanceName.restriction_args)}); var instanceDefTranslated = SyntaxTreeBuilder.BuildClassDefinition( parents, null, instanceDefinition.body.class_def_blocks.ToArray()); - + instanceDefTranslated.template_args = templateArgs; + instanceDefTranslated.where_section = whereSection; for (int i = 0; i < instanceDefTranslated.body.class_def_blocks.Count; i++) { @@ -50,7 +82,7 @@ namespace SyntaxVisitors.TypeclassVisitors (cm[j] as procedure_definition)?.proc_header.proc_attributes.Add(new procedure_attribute("override", proc_attribute.attr_override)); } } - + /* { // Add constructor var cm = instanceDefTranslated.body.class_def_blocks[0]; @@ -62,12 +94,10 @@ namespace SyntaxVisitors.TypeclassVisitors cm.Add(def); } - + */ var typeName = CreateInstanceName(instanceName.restriction_args as typeclass_param_list, instanceName.name); - var typeclassNameTanslated = new ident(typeName); - - var instanceDeclTranslated = new type_declaration(typeclassNameTanslated, instanceDefTranslated, instanceDeclaration.source_context); + var instanceDeclTranslated = new type_declaration(new ident(typeName), instanceDefTranslated, instanceDeclaration.source_context); Replace(instanceDeclaration, instanceDeclTranslated); visit(instanceDeclTranslated); @@ -96,9 +126,59 @@ namespace SyntaxVisitors.TypeclassVisitors // TODO: typeclassDefinition.additional_restrictions - translate to usual classes + // Creating interface + + // Get members for typeclass interface + var interfaceMembers = new List(); + foreach (var cm in typeclassDefinition.body.class_def_blocks) + { + var cmNew = (class_members)cm.Clone(); + + for (int i = 0; i < cmNew.members.Count; i++) + { + var member = cmNew.members[i]; + if (member is function_header || member is procedure_header) + { + continue; + } + else if (member is procedure_definition procDef) + { + cmNew.members[i] = procDef.proc_header; + } + } + + interfaceMembers.Add(cmNew); + } + var interfaceInheritance = (named_type_reference_list)typeclassDefinition.additional_restrictions?.Clone(); + if (interfaceInheritance != null) + { + interfaceInheritance.source_context = null; + for (int i = 0; i < interfaceInheritance.types.Count; i++) + { + if (interfaceInheritance.types[i] is typeclass_reference tr) + { + interfaceInheritance.types[i] = TypeclassReferenceToInterfaceName(tr.names[0].name, tr.restriction_args); + } + else + { + throw new NotImplementedException("Syntactic Error"); + } + } + } + var typeclassInterfaceDef = + SyntaxTreeBuilder.BuildClassDefinition( + interfaceInheritance, + null, interfaceMembers.ToArray()); + typeclassInterfaceDef.keyword = class_keyword.Interface; + var typeclassInterfaceName = new template_type_name("I" + typeclassName.name, RestrictionsToIdentList(typeclassName.restriction_args)); + var typeclassInterfaceDecl = new type_declaration(typeclassInterfaceName, typeclassInterfaceDef); + + + // Creating class + var typeclassDefTranslated = SyntaxTreeBuilder.BuildClassDefinition( - typeclassDefinition.additional_restrictions, + new named_type_reference_list(new template_type_reference(typeclassInterfaceName.name, typeclassName.restriction_args)), null, typeclassDefinition.body.class_def_blocks.ToArray()); typeclassDefTranslated.attribute = class_attribute.Abstract; @@ -112,7 +192,7 @@ namespace SyntaxVisitors.TypeclassVisitors (cm[j] as procedure_definition)?.proc_header.proc_attributes.Add(new procedure_attribute("virtual", proc_attribute.attr_virtual)); } } - + /* { // Add constructor var cm = typeclassDefTranslated.body.class_def_blocks[0]; @@ -124,18 +204,105 @@ namespace SyntaxVisitors.TypeclassVisitors cm.Add(def); } - + */ + // Add template parameters for typeclass class(derived typeclasses) ident_list templates = RestrictionsToIdentList(typeclassName.restriction_args); + if (typeclassDefinition.additional_restrictions != null) + { + for (int i = 0; i < typeclassDefinition.additional_restrictions.types.Count; i++) + { + string name; + string templateName; + if (typeclassDefinition.additional_restrictions.types[i] is typeclass_reference tr) + { + name = tr.names[0].name; + templateName = TypeclassRestrctionToTemplateName(name, tr.restriction_args).name; + } + else + { + throw new NotImplementedException("SyntaxError"); + } + + // Add template parameter + templates.Add(templateName); + + // Add where restriction + if (typeclassDefTranslated.where_section == null) + { + typeclassDefTranslated.where_section = new where_definition_list(); + } + typeclassDefTranslated.where_section.Add(GetWhereRestriction( + interfaceInheritance.types[i], + templateName)); + + // Add methods from derived typeclasses + var body = (instancesAndRestrictedFunctions.typeclasses[name].type_def as typeclass_definition).body; + foreach (var cdb in body.class_def_blocks) + { + var cdbNew = new class_members(cdb.access_mod == null ? access_modifer.none : cdb.access_mod.access_level); + foreach (var member in cdb.members) + { + procedure_header memberHeaderNew; + + if (member is procedure_header || member is function_header) + { + memberHeaderNew = (procedure_header)member.Clone(); + memberHeaderNew.source_context = null; + } + else if (member is procedure_definition procDefinition) + { + memberHeaderNew = (procedure_header)procDefinition.proc_header.Clone(); + memberHeaderNew.Parent = null; + memberHeaderNew.source_context = null; + } + else + { + continue; + } + + var variableName = templateName + "Instance"; + var parameters = memberHeaderNew.parameters.params_list.Aggregate(new expression_list(), (x, y) => new expression_list(x.expressions.Concat(y.idents.idents).ToList())); + var callName = new dot_node(variableName, memberHeaderNew.name.meth_name.name); + var methodCall = new method_call(callName, parameters); + statement exec = null; + if (memberHeaderNew is function_header) + { + exec = new assign("Result", methodCall); + } + else if (memberHeaderNew is procedure_header) + { + exec = new procedure_call(methodCall); + } + var procDef = new procedure_definition( + memberHeaderNew, + new statement_list( + GetInstanceSingleton(templateName), + exec)); + cdbNew.Add(procDef); + } + typeclassDefTranslated.body.class_def_blocks.Add(cdbNew); + } + } + } var typeclassNameTanslated = new template_type_name(typeclassName.name, templates, typeclassName.source_context); var typeclassDeclTranslated = new type_declaration(typeclassNameTanslated, typeclassDefTranslated, typeclassDeclaration.source_context); + Replace(typeclassDeclaration, typeclassDeclTranslated); + UpperNodeAs().InsertBefore(typeclassDeclTranslated, typeclassInterfaceDecl); + visit(typeclassInterfaceDecl); visit(typeclassDeclTranslated); return true; } + private static template_type_reference TypeclassReferenceToInterfaceName(string name, template_param_list restriction_args) + { + return new template_type_reference( + new named_type_reference("I" + name), restriction_args); + } + private static ident_list RestrictionsToIdentList(template_param_list restrictions) { var templates = new ident_list(); @@ -187,22 +354,15 @@ namespace SyntaxVisitors.TypeclassVisitors if (where is where_typeclass_constraint) { var typeclassWhere = where as where_typeclass_constraint; - var newName = TypeclassRestrctionToTemplateName(typeclassWhere.restriction); + var newName = TypeclassRestrctionToTemplateName(typeclassWhere.restriction.name, typeclassWhere.restriction.restriction_args); additionalTemplateArgs.Add(newName); // Create name for template that replaces typeclass(for ex. SumTC) headerTranslated.where_defs.defs.Add( - // where - new where_definition( - // ConstraintTC : - new ident_list(newName), - new where_type_specificator_list(new List { - // Constraint, - new template_type_reference(new named_type_reference(typeclassWhere.restriction.name), typeclassWhere.restriction.restriction_args), - // constructor - new declaration_specificator(DeclarationSpecificator.WhereDefConstructor, "constructor") - }))); + GetWhereRestriction( + new template_type_reference(new named_type_reference("I" + typeclassWhere.restriction.name), typeclassWhere.restriction.restriction_args), + newName)); } else { @@ -217,12 +377,7 @@ namespace SyntaxVisitors.TypeclassVisitors var blockProc = (_procedure_definition.proc_body as block); foreach (var arg in additionalTemplateArgs.idents) { - blockProc.program_code.AddFirst(new var_statement(new var_def_statement( - arg.name + "Instance", - new dot_node( - new ident_with_templateparams(new ident("__ConceptSingleton"), new template_param_list(new List { new named_type_reference((ident)arg.Clone()) })), - new ident("Instance") - )))); + blockProc.program_code.AddFirst(GetInstanceSingleton(arg.name)); } //var list = _procedure_definition.proc_body.DescendantNodes().OfType(); @@ -251,6 +406,30 @@ namespace SyntaxVisitors.TypeclassVisitors Replace(_procedure_definition, procedureDefTranslated); } + private static var_statement GetInstanceSingleton(string typeName) + { + return new var_statement(new var_def_statement( + typeName + "Instance", + new dot_node( + new ident_with_templateparams(new ident("__ConceptSingleton"), new template_param_list(new List { new named_type_reference(typeName) })), + new ident("Instance") + ))); + } + + private static where_definition GetWhereRestriction(type_definition restriction, ident templateName) + { + return // where + new where_definition( + // ConstraintTC : + new ident_list(templateName), + new where_type_specificator_list(new List { + // IConstraint, + restriction, + // constructor + new declaration_specificator(DeclarationSpecificator.WhereDefConstructor, "constructor") + })); + } + public override void visit(method_call methodCall) { var methodName = methodCall.dereferencing_value as ident_with_templateparams; @@ -272,9 +451,22 @@ namespace SyntaxVisitors.TypeclassVisitors // TODO: Add template types for typeclass instances var methodStrName = (methodName.name as ident).name; var typeclasses = instancesAndRestrictedFunctions.restrictedFunctions[methodStrName]; - - var possibleOverloadingsForEachTypeclass = typeclasses.Select(x => - new KeyValuePair>(x, instancesAndRestrictedFunctions.instances[x])); + + List newParams = GetTranslatedTypeclassParameters(paramList, typeclasses); + + paramList.AddRange(newParams); + + var methodCallTranslated = new method_call( + new ident_with_templateparams(methodName.name, new template_param_list(paramList), methodName.source_context), + methodCall.parameters, + methodCall.source_context); + Replace(methodCall, methodCallTranslated); + } + + private List GetTranslatedTypeclassParameters(List paramList, IEnumerable typeclasses) + { + var possibleOverloadingsForEachTypeclass = typeclasses.Select(x => + new KeyValuePair>(x, instancesAndRestrictedFunctions.instances[x])); // Find current overloading in possible var newParams = new List(); @@ -292,36 +484,48 @@ namespace SyntaxVisitors.TypeclassVisitors break; } } - + // TODO: need many checks // Typeclass params and function restriction params are mixed up // Fix it as soon as it possible // Btw for 1 argument it's ok. if (isEqual) { - newParams.Add(new named_type_reference(CreateInstanceName(possibleParamList, typeclassOverloadings.Key))); + var derived_typeclass = + (instancesAndRestrictedFunctions.typeclasses[typeclassOverloadings.Key].type_def as typeclass_definition); + + var base_typeclasses = derived_typeclass.additional_restrictions?.types.OfType().Select(x => x.names[0].name); + var typeName = new named_type_reference(CreateInstanceName(possibleParamList, typeclassOverloadings.Key)); + if (base_typeclasses == null || base_typeclasses.Count() == 0) + { + newParams.Add(typeName); + + } + else + { + var translatedParams = GetTranslatedTypeclassParameters(paramList, base_typeclasses); + + newParams.Add(new template_type_reference( + typeName, + new template_param_list(translatedParams))); + } + } } } - paramList.AddRange(newParams); - - var methodCallTranslated = new method_call( - new ident_with_templateparams(methodName.name, new template_param_list(paramList), methodName.source_context), - methodCall.parameters, - methodCall.source_context); - Replace(methodCall, methodCallTranslated); + return newParams; } - private static ident TypeclassRestrctionToTemplateName(typeclass_restriction typeclassWhere) + private static ident TypeclassRestrctionToTemplateName(string name, template_param_list restriction_args) { // Concatenate type constraint into new type name // For example: // Constaint[T, C] => ConstraintTC - return RestrictionsToIdentList(typeclassWhere.restriction_args).idents.Aggregate( - new ident(typeclassWhere.name), (x, y) => x.name + y.name); + return RestrictionsToIdentList(restriction_args).idents.Aggregate( + new ident(name), (x, y) => x.name + y.name); } }