diff --git a/NETGenerator/NETGenerator.cs b/NETGenerator/NETGenerator.cs index 990ce67d7..cdbdbc9ef 100644 --- a/NETGenerator/NETGenerator.cs +++ b/NETGenerator/NETGenerator.cs @@ -1181,7 +1181,7 @@ namespace PascalABCCompiler.NETGenerator else fb.SetConstant(constant_value.value); } - else if (!(constant_value is INullConstantNode)) + else if (!(constant_value is INullConstantNode) && constant_value.value != null) { if (constant_value.value.GetType() != t) { diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs b/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs index 8d87aa8ea..d6df5a83f 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs @@ -2,7 +2,7 @@ // This CSharp output file generated by Gardens Point LEX // Version: 1.1.3.301 // Machine: DESKTOP-2BJCJ7I -// DateTime: 05.04.2021 11:40:44 +// DateTime: 05.04.2021 12:23:25 // UserName: ibond // GPLEX input file // GPLEX frame file diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascal.y b/Parsers/PascalABCParserNewSaushkin/ABCPascal.y index fc56d6017..99a0fa551 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascal.y +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascal.y @@ -967,6 +967,8 @@ const_factor } | new_expr { $$ = $1; } + | default_expr + { $$ = $1; } // | tkDeref const_factor // { // $$ = new roof_dereference($2 as addressed_value, @$); @@ -2315,8 +2317,6 @@ typed_const_plus { $$ = $1; } /*| new_expr { $$ = $1; }*/ - | default_expr - { $$ = $1; } ; constr_destr_decl diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs b/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs index 9a9e1256b..37ea31efe 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs @@ -2,7 +2,7 @@ // GPPG version 1.3.6 // Machine: DESKTOP-2BJCJ7I -// DateTime: 05.04.2021 11:40:45 +// DateTime: 05.04.2021 12:23:26 // UserName: ibond // Input file @@ -171,7 +171,7 @@ public partial class GPPGParser: ShiftReduceParser new_expr { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 163: // const_set -> tkSquareOpen, elem_list, tkSquareClose + case 163: // const_factor -> default_expr +{ CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } + break; + case 164: // const_set -> tkSquareOpen, elem_list, tkSquareClose { CurrentSemanticValue.ex = new pascal_set_constant(ValueStack[ValueStack.Depth-2].stn as expression_list, CurrentLocationSpan); } break; - case 164: // const_set -> tkVertParen, elem_list, tkVertParen + case 165: // const_set -> tkVertParen, elem_list, tkVertParen { CurrentSemanticValue.ex = new array_const_new(ValueStack[ValueStack.Depth-2].stn as expression_list, CurrentLocationSpan); } break; - case 165: // sign -> tkPlus + case 166: // sign -> tkPlus { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 166: // sign -> tkMinus + case 167: // sign -> tkMinus { CurrentSemanticValue.op = ValueStack[ValueStack.Depth-1].op; } break; - case 167: // const_variable -> identifier + case 168: // const_variable -> identifier { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].id; } break; - case 168: // const_variable -> literal + case 169: // const_variable -> literal { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 169: // const_variable -> unsigned_number + case 170: // const_variable -> unsigned_number { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 170: // const_variable -> tkInherited, identifier + case 171: // const_variable -> tkInherited, identifier { CurrentSemanticValue.ex = new inherited_ident(ValueStack[ValueStack.Depth-1].id.name, CurrentLocationSpan); } break; - case 171: // const_variable -> sizeof_expr + case 172: // const_variable -> sizeof_expr { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 172: // const_variable -> typeof_expr + case 173: // const_variable -> typeof_expr { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 173: // const_variable -> const_variable, const_variable_2 + case 174: // const_variable -> const_variable, const_variable_2 { CurrentSemanticValue.ex = NewConstVariable(ValueStack[ValueStack.Depth-2].ex, ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 174: // const_variable -> const_variable, tkAmpersend, template_type_params + case 175: // const_variable -> const_variable, tkAmpersend, template_type_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 175: // const_variable -> const_variable, tkSquareOpen, format_const_expr, + case 176: // const_variable -> const_variable, tkSquareOpen, format_const_expr, // tkSquareClose { var fe = ValueStack[ValueStack.Depth-2].ex as format_expr; @@ -3635,199 +3638,199 @@ public partial class GPPGParser: ShiftReduceParser tkPoint, identifier_or_keyword + case 177: // const_variable_2 -> tkPoint, identifier_or_keyword { CurrentSemanticValue.ex = new dot_node(null, ValueStack[ValueStack.Depth-1].id as addressed_value, CurrentLocationSpan); } break; - case 177: // const_variable_2 -> tkDeref + case 178: // const_variable_2 -> tkDeref { CurrentSemanticValue.ex = new roof_dereference(); CurrentSemanticValue.ex.source_context = CurrentLocationSpan; } break; - case 178: // const_variable_2 -> tkRoundOpen, optional_const_func_expr_list, tkRoundClose + case 179: // const_variable_2 -> tkRoundOpen, optional_const_func_expr_list, tkRoundClose { CurrentSemanticValue.ex = new method_call(ValueStack[ValueStack.Depth-2].stn as expression_list, CurrentLocationSpan); } break; - case 179: // const_variable_2 -> tkSquareOpen, const_elem_list, tkSquareClose + case 180: // const_variable_2 -> tkSquareOpen, const_elem_list, tkSquareClose { CurrentSemanticValue.ex = new indexer(ValueStack[ValueStack.Depth-2].stn as expression_list, CurrentLocationSpan); } break; - case 180: // optional_const_func_expr_list -> expr_list + case 181: // optional_const_func_expr_list -> expr_list { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 181: // optional_const_func_expr_list -> /* empty */ + case 182: // optional_const_func_expr_list -> /* empty */ { CurrentSemanticValue.stn = null; } break; - case 182: // const_elem_list -> const_elem_list1 + case 183: // const_elem_list -> const_elem_list1 { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 184: // const_elem_list1 -> const_elem + case 185: // const_elem_list1 -> const_elem { CurrentSemanticValue.stn = new expression_list(ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 185: // const_elem_list1 -> const_elem_list1, tkComma, const_elem + case 186: // const_elem_list1 -> const_elem_list1, tkComma, const_elem { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-3].stn as expression_list).Add(ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 186: // const_elem -> const_expr + case 187: // const_elem -> const_expr { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 187: // const_elem -> const_expr, tkDotDot, const_expr + case 188: // const_elem -> const_expr, tkDotDot, const_expr { CurrentSemanticValue.ex = new diapason_expr(ValueStack[ValueStack.Depth-3].ex, ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 188: // unsigned_number -> tkInteger + case 189: // unsigned_number -> tkInteger { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 189: // unsigned_number -> tkHex + case 190: // unsigned_number -> tkHex { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 190: // unsigned_number -> tkFloat + case 191: // unsigned_number -> tkFloat { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 191: // unsigned_number -> tkBigInteger + case 192: // unsigned_number -> tkBigInteger { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 192: // typed_const -> const_expr + case 193: // typed_const -> const_expr { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 193: // typed_const -> array_const + case 194: // typed_const -> array_const { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 194: // typed_const -> record_const + case 195: // typed_const -> record_const { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 195: // array_const -> tkRoundOpen, typed_const_list, tkRoundClose + case 196: // array_const -> tkRoundOpen, typed_const_list, tkRoundClose { CurrentSemanticValue.ex = new array_const(ValueStack[ValueStack.Depth-2].stn as expression_list, CurrentLocationSpan); } break; - case 197: // typed_const_list -> typed_const_list1 + case 198: // typed_const_list -> typed_const_list1 { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 198: // typed_const_list1 -> typed_const_plus + case 199: // typed_const_list1 -> typed_const_plus { CurrentSemanticValue.stn = new expression_list(ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 199: // typed_const_list1 -> typed_const_list1, tkComma, typed_const_plus + case 200: // typed_const_list1 -> typed_const_list1, tkComma, typed_const_plus { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-3].stn as expression_list).Add(ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 200: // record_const -> tkRoundOpen, const_field_list, tkRoundClose + case 201: // record_const -> tkRoundOpen, const_field_list, tkRoundClose { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-2].ex; CurrentSemanticValue.ex.source_context = CurrentLocationSpan; } break; - case 201: // const_field_list -> const_field_list_1 + case 202: // const_field_list -> const_field_list_1 { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 202: // const_field_list -> const_field_list_1, tkSemiColon + case 203: // const_field_list -> const_field_list_1, tkSemiColon { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-2].ex; } break; - case 203: // const_field_list_1 -> const_field + case 204: // const_field_list_1 -> const_field { CurrentSemanticValue.ex = new record_const(ValueStack[ValueStack.Depth-1].stn as record_const_definition, CurrentLocationSpan); } break; - case 204: // const_field_list_1 -> const_field_list_1, tkSemiColon, const_field + case 205: // const_field_list_1 -> const_field_list_1, tkSemiColon, const_field { CurrentSemanticValue.ex = (ValueStack[ValueStack.Depth-3].ex as record_const).Add(ValueStack[ValueStack.Depth-1].stn as record_const_definition, CurrentLocationSpan); } break; - case 205: // const_field -> const_field_name, tkColon, typed_const + case 206: // const_field -> const_field_name, tkColon, typed_const { CurrentSemanticValue.stn = new record_const_definition(ValueStack[ValueStack.Depth-3].id, ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 206: // const_field_name -> identifier + case 207: // const_field_name -> identifier { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 207: // type_decl -> attribute_declarations, simple_type_decl + case 208: // type_decl -> attribute_declarations, simple_type_decl { (ValueStack[ValueStack.Depth-1].stn as declaration).attributes = ValueStack[ValueStack.Depth-2].stn as attribute_list; CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; CurrentSemanticValue.stn.source_context = LocationStack[LocationStack.Depth-1]; } break; - case 208: // attribute_declarations -> attribute_declaration + case 209: // attribute_declarations -> attribute_declaration { CurrentSemanticValue.stn = new attribute_list(ValueStack[ValueStack.Depth-1].stn as simple_attribute_list, CurrentLocationSpan); } break; - case 209: // attribute_declarations -> attribute_declarations, attribute_declaration + case 210: // attribute_declarations -> attribute_declarations, attribute_declaration { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-2].stn as attribute_list).Add(ValueStack[ValueStack.Depth-1].stn as simple_attribute_list, CurrentLocationSpan); } break; - case 210: // attribute_declarations -> /* empty */ + case 211: // attribute_declarations -> /* empty */ { CurrentSemanticValue.stn = null; } break; - case 211: // attribute_declaration -> tkSquareOpen, one_or_some_attribute, tkSquareClose + case 212: // attribute_declaration -> tkSquareOpen, one_or_some_attribute, tkSquareClose { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-2].stn; } break; - case 212: // one_or_some_attribute -> one_attribute + case 213: // one_or_some_attribute -> one_attribute { CurrentSemanticValue.stn = new simple_attribute_list(ValueStack[ValueStack.Depth-1].stn as attribute, CurrentLocationSpan); } break; - case 213: // one_or_some_attribute -> one_or_some_attribute, tkComma, one_attribute + case 214: // one_or_some_attribute -> one_or_some_attribute, tkComma, one_attribute { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-3].stn as simple_attribute_list).Add(ValueStack[ValueStack.Depth-1].stn as attribute, CurrentLocationSpan); } break; - case 214: // one_attribute -> attribute_variable + case 215: // one_attribute -> attribute_variable { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 215: // one_attribute -> identifier, tkColon, attribute_variable + case 216: // one_attribute -> identifier, tkColon, attribute_variable { (ValueStack[ValueStack.Depth-1].stn as attribute).qualifier = ValueStack[ValueStack.Depth-3].id; CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; CurrentSemanticValue.stn.source_context = CurrentLocationSpan; } break; - case 216: // simple_type_decl -> type_decl_identifier, tkEqual, type_decl_type, tkSemiColon + case 217: // simple_type_decl -> type_decl_identifier, tkEqual, type_decl_type, tkSemiColon { CurrentSemanticValue.stn = new type_declaration(ValueStack[ValueStack.Depth-4].id, ValueStack[ValueStack.Depth-2].td, CurrentLocationSpan); } break; - case 217: // simple_type_decl -> template_identifier_with_equal, type_decl_type, tkSemiColon + case 218: // simple_type_decl -> template_identifier_with_equal, type_decl_type, tkSemiColon { CurrentSemanticValue.stn = new type_declaration(ValueStack[ValueStack.Depth-3].id, ValueStack[ValueStack.Depth-2].td, CurrentLocationSpan); } break; - case 218: // type_decl_identifier -> identifier + case 219: // type_decl_identifier -> identifier { CurrentSemanticValue.id = ValueStack[ValueStack.Depth-1].id; } break; - case 219: // type_decl_identifier -> identifier, template_arguments + case 220: // type_decl_identifier -> identifier, 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 220: // template_identifier_with_equal -> identifier, tkLower, ident_list, + case 221: // template_identifier_with_equal -> identifier, tkLower, ident_list, // tkGreaterEqual { CurrentSemanticValue.id = new template_type_name(ValueStack[ValueStack.Depth-4].id.name, ValueStack[ValueStack.Depth-2].stn as ident_list, CurrentLocationSpan); } break; - case 221: // type_decl_type -> type_ref + case 222: // type_decl_type -> type_ref { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 222: // type_decl_type -> object_type + case 223: // type_decl_type -> object_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 223: // simple_type_question -> simple_type, tkQuestion + case 224: // simple_type_question -> simple_type, tkQuestion { if (parsertools.build_tree_for_formatter) { @@ -3842,7 +3845,7 @@ public partial class GPPGParser: ShiftReduceParser template_type, tkQuestion + case 225: // simple_type_question -> template_type, tkQuestion { if (parsertools.build_tree_for_formatter) { @@ -3857,39 +3860,39 @@ public partial class GPPGParser: ShiftReduceParser simple_type + case 226: // type_ref -> simple_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 226: // type_ref -> simple_type_question + case 227: // type_ref -> simple_type_question { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 227: // type_ref -> string_type + case 228: // type_ref -> string_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 228: // type_ref -> pointer_type + case 229: // type_ref -> pointer_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 229: // type_ref -> structured_type + case 230: // type_ref -> structured_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 230: // type_ref -> procedural_type + case 231: // type_ref -> procedural_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 231: // type_ref -> template_type + case 232: // type_ref -> template_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 232: // template_type -> simple_type_identifier, template_type_params + case 233: // template_type -> simple_type_identifier, template_type_params { CurrentSemanticValue.td = new template_type_reference(ValueStack[ValueStack.Depth-2].td as named_type_reference, ValueStack[ValueStack.Depth-1].stn as template_param_list, CurrentLocationSpan); } break; - case 233: // template_type_params -> tkLower, template_param_list, tkGreater + case 234: // template_type_params -> tkLower, template_param_list, tkGreater { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-2].stn; CurrentSemanticValue.stn.source_context = CurrentLocationSpan; } break; - case 234: // template_type_empty_params -> tkNotEqual + case 235: // template_type_empty_params -> tkNotEqual { var ntr = new named_type_reference(new ident(""), CurrentLocationSpan); @@ -3897,42 +3900,42 @@ public partial class GPPGParser: ShiftReduceParser tkLower, template_empty_param_list, tkGreater + case 236: // template_type_empty_params -> tkLower, template_empty_param_list, tkGreater { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-2].stn; CurrentSemanticValue.stn.source_context = CurrentLocationSpan; } break; - case 236: // template_param_list -> template_param + case 237: // template_param_list -> template_param { CurrentSemanticValue.stn = new template_param_list(ValueStack[ValueStack.Depth-1].td, CurrentLocationSpan); } break; - case 237: // template_param_list -> template_param_list, tkComma, template_param + case 238: // template_param_list -> template_param_list, tkComma, template_param { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-3].stn as template_param_list).Add(ValueStack[ValueStack.Depth-1].td, CurrentLocationSpan); } break; - case 238: // template_empty_param_list -> template_empty_param + case 239: // template_empty_param_list -> template_empty_param { CurrentSemanticValue.stn = new template_param_list(ValueStack[ValueStack.Depth-1].td, CurrentLocationSpan); } break; - case 239: // template_empty_param_list -> template_empty_param_list, tkComma, + case 240: // template_empty_param_list -> template_empty_param_list, tkComma, // template_empty_param { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-3].stn as template_param_list).Add(ValueStack[ValueStack.Depth-1].td, CurrentLocationSpan); } break; - case 240: // template_empty_param -> /* empty */ + case 241: // template_empty_param -> /* empty */ { CurrentSemanticValue.td = new named_type_reference(new ident(""), CurrentLocationSpan); } break; - case 241: // template_param -> simple_type + case 242: // template_param -> simple_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 242: // template_param -> simple_type, tkQuestion + case 243: // template_param -> simple_type, tkQuestion { if (parsertools.build_tree_for_formatter) { @@ -3947,240 +3950,240 @@ public partial class GPPGParser: ShiftReduceParser structured_type + case 244: // template_param -> structured_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 244: // template_param -> procedural_type + case 245: // template_param -> procedural_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 245: // template_param -> template_type + case 246: // template_param -> template_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 246: // simple_type -> range_expr + case 247: // simple_type -> range_expr { CurrentSemanticValue.td = parsertools.ConvertDotNodeOrIdentToNamedTypeReference(ValueStack[ValueStack.Depth-1].ex); } break; - case 247: // simple_type -> range_expr, tkDotDot, range_expr + case 248: // simple_type -> range_expr, tkDotDot, range_expr { CurrentSemanticValue.td = new diapason(ValueStack[ValueStack.Depth-3].ex, ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 248: // simple_type -> tkRoundOpen, enumeration_id_list, tkRoundClose + case 249: // simple_type -> tkRoundOpen, enumeration_id_list, tkRoundClose { CurrentSemanticValue.td = new enum_type_definition(ValueStack[ValueStack.Depth-2].stn as enumerator_list, CurrentLocationSpan); } break; - case 249: // range_expr -> range_term + case 250: // range_expr -> range_term { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 250: // range_expr -> range_expr, const_addop, range_term + case 251: // range_expr -> range_expr, const_addop, range_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 251: // range_term -> range_factor + case 252: // range_term -> range_factor { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 252: // range_term -> range_term, const_mulop, range_factor + case 253: // range_term -> range_term, const_mulop, range_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 253: // range_factor -> simple_type_identifier + case 254: // range_factor -> simple_type_identifier { CurrentSemanticValue.ex = parsertools.ConvertNamedTypeReferenceToDotNodeOrIdent(ValueStack[ValueStack.Depth-1].td as named_type_reference); } break; - case 254: // range_factor -> unsigned_number + case 255: // range_factor -> unsigned_number { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 255: // range_factor -> sign, range_factor + case 256: // range_factor -> sign, range_factor { CurrentSemanticValue.ex = new un_expr(ValueStack[ValueStack.Depth-1].ex, ValueStack[ValueStack.Depth-2].op.type, CurrentLocationSpan); } break; - case 256: // range_factor -> literal + case 257: // range_factor -> literal { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 257: // range_factor -> range_factor, tkRoundOpen, const_elem_list, tkRoundClose + case 258: // range_factor -> range_factor, tkRoundOpen, const_elem_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 258: // simple_type_identifier -> identifier + case 259: // simple_type_identifier -> identifier { CurrentSemanticValue.td = new named_type_reference(ValueStack[ValueStack.Depth-1].id, CurrentLocationSpan); } break; - case 259: // simple_type_identifier -> simple_type_identifier, tkPoint, + case 260: // simple_type_identifier -> simple_type_identifier, tkPoint, // identifier_or_keyword { CurrentSemanticValue.td = (ValueStack[ValueStack.Depth-3].td as named_type_reference).Add(ValueStack[ValueStack.Depth-1].id, CurrentLocationSpan); } break; - case 260: // enumeration_id_list -> enumeration_id, tkComma, enumeration_id + case 261: // enumeration_id_list -> enumeration_id, tkComma, enumeration_id { CurrentSemanticValue.stn = new enumerator_list(ValueStack[ValueStack.Depth-3].stn as enumerator, CurrentLocationSpan); (CurrentSemanticValue.stn as enumerator_list).Add(ValueStack[ValueStack.Depth-1].stn as enumerator, CurrentLocationSpan); } break; - case 261: // enumeration_id_list -> enumeration_id_list, tkComma, enumeration_id + case 262: // enumeration_id_list -> enumeration_id_list, tkComma, enumeration_id { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-3].stn as enumerator_list).Add(ValueStack[ValueStack.Depth-1].stn as enumerator, CurrentLocationSpan); } break; - case 262: // enumeration_id -> type_ref + case 263: // enumeration_id -> type_ref { CurrentSemanticValue.stn = new enumerator(ValueStack[ValueStack.Depth-1].td, null, CurrentLocationSpan); } break; - case 263: // enumeration_id -> type_ref, tkEqual, expr + case 264: // enumeration_id -> type_ref, tkEqual, expr { CurrentSemanticValue.stn = new enumerator(ValueStack[ValueStack.Depth-3].td, ValueStack[ValueStack.Depth-1].ex, CurrentLocationSpan); } break; - case 264: // pointer_type -> tkDeref, fptype + case 265: // pointer_type -> tkDeref, fptype { CurrentSemanticValue.td = new ref_type(ValueStack[ValueStack.Depth-1].td,CurrentLocationSpan); } break; - case 265: // structured_type -> unpacked_structured_type + case 266: // structured_type -> unpacked_structured_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 266: // structured_type -> tkPacked, unpacked_structured_type + case 267: // structured_type -> tkPacked, unpacked_structured_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 267: // unpacked_structured_type -> array_type + case 268: // unpacked_structured_type -> array_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 268: // unpacked_structured_type -> record_type + case 269: // unpacked_structured_type -> record_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 269: // unpacked_structured_type -> set_type + case 270: // unpacked_structured_type -> set_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 270: // unpacked_structured_type -> file_type + case 271: // unpacked_structured_type -> file_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 271: // unpacked_structured_type -> sequence_type + case 272: // unpacked_structured_type -> sequence_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 272: // sequence_type -> tkSequence, tkOf, type_ref + case 273: // sequence_type -> tkSequence, tkOf, type_ref { CurrentSemanticValue.td = new sequence_type(ValueStack[ValueStack.Depth-1].td,CurrentLocationSpan); } break; - case 273: // array_type -> tkArray, tkSquareOpen, simple_type_list, tkSquareClose, tkOf, + case 274: // array_type -> tkArray, tkSquareOpen, simple_type_list, tkSquareClose, tkOf, // type_ref { CurrentSemanticValue.td = new array_type(ValueStack[ValueStack.Depth-4].stn as indexers_types, ValueStack[ValueStack.Depth-1].td, CurrentLocationSpan); } break; - case 274: // array_type -> unsized_array_type + case 275: // array_type -> unsized_array_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 275: // unsized_array_type -> tkArray, tkOf, type_ref + case 276: // unsized_array_type -> tkArray, tkOf, type_ref { CurrentSemanticValue.td = new array_type(null, ValueStack[ValueStack.Depth-1].td, CurrentLocationSpan); } break; - case 276: // simple_type_list -> simple_type_or_ + case 277: // simple_type_list -> simple_type_or_ { CurrentSemanticValue.stn = new indexers_types(ValueStack[ValueStack.Depth-1].td, CurrentLocationSpan); } break; - case 277: // simple_type_list -> simple_type_list, tkComma, simple_type_or_ + case 278: // simple_type_list -> simple_type_list, tkComma, simple_type_or_ { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-3].stn as indexers_types).Add(ValueStack[ValueStack.Depth-1].td, CurrentLocationSpan); } break; - case 278: // simple_type_or_ -> simple_type + case 279: // simple_type_or_ -> simple_type { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 279: // simple_type_or_ -> /* empty */ + case 280: // simple_type_or_ -> /* empty */ { CurrentSemanticValue.td = null; } break; - case 280: // set_type -> tkSet, tkOf, type_ref + case 281: // set_type -> tkSet, tkOf, type_ref { CurrentSemanticValue.td = new set_type_definition(ValueStack[ValueStack.Depth-1].td, CurrentLocationSpan); } break; - case 281: // file_type -> tkFile, tkOf, type_ref + case 282: // file_type -> tkFile, tkOf, type_ref { CurrentSemanticValue.td = new file_type(ValueStack[ValueStack.Depth-1].td, CurrentLocationSpan); } break; - case 282: // file_type -> tkFile + case 283: // file_type -> tkFile { CurrentSemanticValue.td = new file_type(); CurrentSemanticValue.td.source_context = CurrentLocationSpan; } break; - case 283: // string_type -> tkIdentifier, tkSquareOpen, const_expr, tkSquareClose + case 284: // string_type -> tkIdentifier, tkSquareOpen, const_expr, tkSquareClose { CurrentSemanticValue.td = new string_num_definition(ValueStack[ValueStack.Depth-2].ex, ValueStack[ValueStack.Depth-4].id, CurrentLocationSpan); } break; - case 284: // procedural_type -> procedural_type_kind + case 285: // procedural_type -> procedural_type_kind { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 285: // procedural_type_kind -> proc_type_decl + case 286: // procedural_type_kind -> proc_type_decl { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 286: // proc_type_decl -> tkProcedure, fp_list + case 287: // proc_type_decl -> tkProcedure, fp_list { CurrentSemanticValue.td = new procedure_header(ValueStack[ValueStack.Depth-1].stn as formal_parameters,null,null,false,false,null,null,CurrentLocationSpan); } break; - case 287: // proc_type_decl -> tkFunction, fp_list, tkColon, fptype + case 288: // proc_type_decl -> tkFunction, fp_list, tkColon, fptype { CurrentSemanticValue.td = new function_header(ValueStack[ValueStack.Depth-3].stn as formal_parameters, null, null, null, ValueStack[ValueStack.Depth-1].td as type_definition, CurrentLocationSpan); } break; - case 288: // proc_type_decl -> simple_type_identifier, tkArrow, template_param + case 289: // proc_type_decl -> simple_type_identifier, tkArrow, template_param { CurrentSemanticValue.td = new modern_proc_type(ValueStack[ValueStack.Depth-3].td,null,ValueStack[ValueStack.Depth-1].td,CurrentLocationSpan); } break; - case 289: // proc_type_decl -> template_type, tkArrow, template_param + case 290: // proc_type_decl -> template_type, tkArrow, template_param { CurrentSemanticValue.td = new modern_proc_type(ValueStack[ValueStack.Depth-3].td,null,ValueStack[ValueStack.Depth-1].td,CurrentLocationSpan); } break; - case 290: // proc_type_decl -> tkRoundOpen, tkRoundClose, tkArrow, template_param + case 291: // proc_type_decl -> tkRoundOpen, tkRoundClose, tkArrow, template_param { CurrentSemanticValue.td = new modern_proc_type(null,null,ValueStack[ValueStack.Depth-1].td,CurrentLocationSpan); } break; - case 291: // proc_type_decl -> tkRoundOpen, enumeration_id_list, tkRoundClose, tkArrow, + case 292: // proc_type_decl -> tkRoundOpen, enumeration_id_list, tkRoundClose, tkArrow, // template_param { CurrentSemanticValue.td = new modern_proc_type(null,ValueStack[ValueStack.Depth-4].stn as enumerator_list,ValueStack[ValueStack.Depth-1].td,CurrentLocationSpan); } break; - case 292: // proc_type_decl -> simple_type_identifier, tkArrow, tkRoundOpen, tkRoundClose + case 293: // proc_type_decl -> simple_type_identifier, tkArrow, tkRoundOpen, tkRoundClose { CurrentSemanticValue.td = new modern_proc_type(ValueStack[ValueStack.Depth-4].td,null,null,CurrentLocationSpan); } break; - case 293: // proc_type_decl -> template_type, tkArrow, tkRoundOpen, tkRoundClose + case 294: // proc_type_decl -> template_type, tkArrow, tkRoundOpen, tkRoundClose { CurrentSemanticValue.td = new modern_proc_type(ValueStack[ValueStack.Depth-4].td,null,null,CurrentLocationSpan); } break; - case 294: // proc_type_decl -> tkRoundOpen, tkRoundClose, tkArrow, tkRoundOpen, tkRoundClose + case 295: // proc_type_decl -> tkRoundOpen, tkRoundClose, tkArrow, tkRoundOpen, tkRoundClose { CurrentSemanticValue.td = new modern_proc_type(null,null,null,CurrentLocationSpan); } break; - case 295: // proc_type_decl -> tkRoundOpen, enumeration_id_list, tkRoundClose, tkArrow, + case 296: // proc_type_decl -> tkRoundOpen, enumeration_id_list, tkRoundClose, tkArrow, // tkRoundOpen, tkRoundClose { CurrentSemanticValue.td = new modern_proc_type(null,ValueStack[ValueStack.Depth-5].stn as enumerator_list,null,CurrentLocationSpan); } break; - case 296: // object_type -> class_attributes, class_or_interface_keyword, + case 297: // object_type -> class_attributes, class_or_interface_keyword, // optional_base_classes, optional_where_section, // optional_component_list_seq_end { @@ -4188,7 +4191,7 @@ public partial class GPPGParser: ShiftReduceParser tkRecord, optional_base_classes, optional_where_section, + case 298: // record_type -> tkRecord, optional_base_classes, optional_where_section, // member_list_section, tkEnd { var nnrt = new class_definition(ValueStack[ValueStack.Depth-4].stn as named_type_reference_list, ValueStack[ValueStack.Depth-2].stn as class_body_list, class_keyword.Record, null, ValueStack[ValueStack.Depth-3].stn as where_definition_list, class_attribute.None, false, CurrentLocationSpan); @@ -4201,37 +4204,37 @@ public partial class GPPGParser: ShiftReduceParser tkSealed + case 299: // class_attribute -> tkSealed { CurrentSemanticValue.ob = class_attribute.Sealed; } break; - case 299: // class_attribute -> tkPartial + case 300: // class_attribute -> tkPartial { CurrentSemanticValue.ob = class_attribute.Partial; } break; - case 300: // class_attribute -> tkAbstract + case 301: // class_attribute -> tkAbstract { CurrentSemanticValue.ob = class_attribute.Abstract; } break; - case 301: // class_attribute -> tkAuto + case 302: // class_attribute -> tkAuto { CurrentSemanticValue.ob = class_attribute.Auto; } break; - case 302: // class_attribute -> tkStatic + case 303: // class_attribute -> tkStatic { CurrentSemanticValue.ob = class_attribute.Static; } break; - case 303: // class_attributes -> /* empty */ + case 304: // class_attributes -> /* empty */ { CurrentSemanticValue.ob = class_attribute.None; } break; - case 304: // class_attributes -> class_attributes1 + case 305: // class_attributes -> class_attributes1 { CurrentSemanticValue.ob = ValueStack[ValueStack.Depth-1].ob; } break; - case 305: // class_attributes1 -> class_attribute + case 306: // class_attributes1 -> class_attribute { CurrentSemanticValue.ob = ValueStack[ValueStack.Depth-1].ob; } break; - case 306: // class_attributes1 -> class_attributes1, class_attribute + case 307: // class_attributes1 -> class_attributes1, class_attribute { if (((class_attribute)ValueStack[ValueStack.Depth-2].ob & (class_attribute)ValueStack[ValueStack.Depth-1].ob) == (class_attribute)ValueStack[ValueStack.Depth-1].ob) parsertools.AddErrorFromResource("ATTRIBUTE_REDECLARED",LocationStack[LocationStack.Depth-1]); @@ -4239,123 +4242,123 @@ public partial class GPPGParser: ShiftReduceParser tkClass + case 308: // class_or_interface_keyword -> tkClass { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 308: // class_or_interface_keyword -> tkInterface + case 309: // class_or_interface_keyword -> tkInterface { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 309: // class_or_interface_keyword -> tkTemplate + case 310: // class_or_interface_keyword -> tkTemplate { CurrentSemanticValue.ti = NewClassOrInterfaceKeyword(ValueStack[ValueStack.Depth-1].ti); } break; - case 310: // class_or_interface_keyword -> tkTemplate, tkClass + case 311: // class_or_interface_keyword -> tkTemplate, tkClass { CurrentSemanticValue.ti = NewClassOrInterfaceKeyword(ValueStack[ValueStack.Depth-2].ti, "c", CurrentLocationSpan); } break; - case 311: // class_or_interface_keyword -> tkTemplate, tkRecord + case 312: // class_or_interface_keyword -> tkTemplate, tkRecord { CurrentSemanticValue.ti = NewClassOrInterfaceKeyword(ValueStack[ValueStack.Depth-2].ti, "r", CurrentLocationSpan); } break; - case 312: // class_or_interface_keyword -> tkTemplate, tkInterface + case 313: // class_or_interface_keyword -> tkTemplate, tkInterface { CurrentSemanticValue.ti = NewClassOrInterfaceKeyword(ValueStack[ValueStack.Depth-2].ti, "i", CurrentLocationSpan); } break; - case 313: // optional_component_list_seq_end -> /* empty */ + case 314: // optional_component_list_seq_end -> /* empty */ { CurrentSemanticValue.stn = null; } break; - case 314: // optional_component_list_seq_end -> member_list_section, tkEnd + case 315: // optional_component_list_seq_end -> member_list_section, tkEnd { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-2].stn; CurrentSemanticValue.stn.source_context = CurrentLocationSpan; } break; - case 316: // optional_base_classes -> tkRoundOpen, base_classes_names_list, tkRoundClose + case 317: // optional_base_classes -> tkRoundOpen, base_classes_names_list, tkRoundClose { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-2].stn; } break; - case 317: // base_classes_names_list -> base_class_name + case 318: // base_classes_names_list -> base_class_name { CurrentSemanticValue.stn = new named_type_reference_list(ValueStack[ValueStack.Depth-1].stn as named_type_reference, CurrentLocationSpan); } break; - case 318: // base_classes_names_list -> base_classes_names_list, tkComma, base_class_name + case 319: // base_classes_names_list -> base_classes_names_list, tkComma, base_class_name { CurrentSemanticValue.stn = (ValueStack[ValueStack.Depth-3].stn as named_type_reference_list).Add(ValueStack[ValueStack.Depth-1].stn as named_type_reference, CurrentLocationSpan); } break; - case 319: // base_class_name -> simple_type_identifier + case 320: // base_class_name -> simple_type_identifier { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].td; } break; - case 320: // base_class_name -> template_type + case 321: // base_class_name -> template_type { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].td; } break; - case 321: // template_arguments -> tkLower, ident_list, tkGreater + case 322: // template_arguments -> tkLower, ident_list, tkGreater { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-2].stn; CurrentSemanticValue.stn.source_context = CurrentLocationSpan; } break; - case 322: // optional_where_section -> /* empty */ + case 323: // optional_where_section -> /* empty */ { CurrentSemanticValue.stn = null; } break; - case 323: // optional_where_section -> where_part_list + case 324: // optional_where_section -> where_part_list { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 324: // where_part_list -> where_part + case 325: // where_part_list -> where_part { CurrentSemanticValue.stn = new where_definition_list(ValueStack[ValueStack.Depth-1].stn as where_definition, CurrentLocationSpan); } break; - case 325: // where_part_list -> where_part_list, where_part + case 326: // 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 326: // where_part -> tkWhere, ident_list, tkColon, type_ref_and_secific_list, + case 327: // 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 327: // type_ref_and_secific_list -> type_ref_or_secific + case 328: // type_ref_and_secific_list -> type_ref_or_secific { CurrentSemanticValue.stn = new where_type_specificator_list(ValueStack[ValueStack.Depth-1].td, CurrentLocationSpan); } break; - case 328: // type_ref_and_secific_list -> type_ref_and_secific_list, tkComma, + case 329: // 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 329: // type_ref_or_secific -> type_ref + case 330: // type_ref_or_secific -> type_ref { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 330: // type_ref_or_secific -> tkClass + case 331: // type_ref_or_secific -> tkClass { CurrentSemanticValue.td = new declaration_specificator(DeclarationSpecificator.WhereDefClass, ValueStack[ValueStack.Depth-1].ti.text, CurrentLocationSpan); } break; - case 331: // type_ref_or_secific -> tkRecord + case 332: // type_ref_or_secific -> tkRecord { CurrentSemanticValue.td = new declaration_specificator(DeclarationSpecificator.WhereDefValueType, ValueStack[ValueStack.Depth-1].ti.text, CurrentLocationSpan); } break; - case 332: // type_ref_or_secific -> tkConstructor + case 333: // type_ref_or_secific -> tkConstructor { CurrentSemanticValue.td = new declaration_specificator(DeclarationSpecificator.WhereDefConstructor, ValueStack[ValueStack.Depth-1].ti.text, CurrentLocationSpan); } break; - case 333: // member_list_section -> member_list + case 334: // member_list_section -> member_list { CurrentSemanticValue.stn = new class_body_list(ValueStack[ValueStack.Depth-1].stn as class_members, CurrentLocationSpan); } break; - case 334: // member_list_section -> member_list_section, ot_visibility_specifier, + case 335: // 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; @@ -4367,121 +4370,121 @@ public partial class GPPGParser: ShiftReduceParser tkInternal + case 336: // ot_visibility_specifier -> tkInternal { CurrentSemanticValue.stn = new access_modifer_node(access_modifer.internal_modifer, CurrentLocationSpan); } break; - case 336: // ot_visibility_specifier -> tkPublic + case 337: // ot_visibility_specifier -> tkPublic { CurrentSemanticValue.stn = new access_modifer_node(access_modifer.public_modifer, CurrentLocationSpan); } break; - case 337: // ot_visibility_specifier -> tkProtected + case 338: // ot_visibility_specifier -> tkProtected { CurrentSemanticValue.stn = new access_modifer_node(access_modifer.protected_modifer, CurrentLocationSpan); } break; - case 338: // ot_visibility_specifier -> tkPrivate + case 339: // ot_visibility_specifier -> tkPrivate { CurrentSemanticValue.stn = new access_modifer_node(access_modifer.private_modifer, CurrentLocationSpan); } break; - case 339: // member_list -> /* empty */ + case 340: // member_list -> /* empty */ { CurrentSemanticValue.stn = new class_members(); } break; - case 340: // member_list -> field_or_const_definition_list, optional_semicolon + case 341: // member_list -> field_or_const_definition_list, optional_semicolon { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-2].stn; } break; - case 341: // member_list -> method_decl_list + case 342: // member_list -> method_decl_list { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 342: // member_list -> field_or_const_definition_list, tkSemiColon, method_decl_list + case 343: // 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 343: // ident_list -> identifier + case 344: // ident_list -> identifier { CurrentSemanticValue.stn = new ident_list(ValueStack[ValueStack.Depth-1].id, CurrentLocationSpan); } break; - case 344: // ident_list -> ident_list, tkComma, identifier + case 345: // 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 345: // optional_semicolon -> /* empty */ + case 346: // optional_semicolon -> /* empty */ { CurrentSemanticValue.ob = null; } break; - case 346: // optional_semicolon -> tkSemiColon + case 347: // optional_semicolon -> tkSemiColon { CurrentSemanticValue.ob = ValueStack[ValueStack.Depth-1].ti; } break; - case 347: // field_or_const_definition_list -> field_or_const_definition + case 348: // field_or_const_definition_list -> field_or_const_definition { CurrentSemanticValue.stn = new class_members(ValueStack[ValueStack.Depth-1].stn as declaration, CurrentLocationSpan); } break; - case 348: // field_or_const_definition_list -> field_or_const_definition_list, tkSemiColon, + case 349: // 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 349: // field_or_const_definition -> attribute_declarations, + case 350: // 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 350: // method_decl_list -> method_or_property_decl + case 351: // method_decl_list -> method_or_property_decl { CurrentSemanticValue.stn = new class_members(ValueStack[ValueStack.Depth-1].stn as declaration, CurrentLocationSpan); } break; - case 351: // method_decl_list -> method_decl_list, method_or_property_decl + case 352: // 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 352: // method_or_property_decl -> method_decl_withattr + case 353: // method_or_property_decl -> method_decl_withattr { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 353: // method_or_property_decl -> property_definition + case 354: // method_or_property_decl -> property_definition { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 354: // simple_field_or_const_definition -> tkConst, only_const_decl + case 355: // simple_field_or_const_definition -> tkConst, only_const_decl { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; CurrentSemanticValue.stn.source_context = CurrentLocationSpan; } break; - case 355: // simple_field_or_const_definition -> field_definition + case 356: // simple_field_or_const_definition -> field_definition { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 356: // simple_field_or_const_definition -> class_or_static, field_definition + case 357: // simple_field_or_const_definition -> class_or_static, 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 357: // class_or_static -> tkStatic + case 358: // class_or_static -> tkStatic { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 358: // class_or_static -> tkClass + case 359: // class_or_static -> tkClass { CurrentSemanticValue.ti = ValueStack[ValueStack.Depth-1].ti; } break; - case 359: // field_definition -> var_decl_part + case 360: // field_definition -> var_decl_part { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 360: // field_definition -> tkEvent, ident_list, tkColon, type_ref + case 361: // 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 361: // method_decl_withattr -> attribute_declarations, method_header + case 362: // 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 362: // method_decl_withattr -> attribute_declarations, method_decl + case 363: // 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) @@ -4489,72 +4492,72 @@ public partial class GPPGParser: ShiftReduceParser inclass_proc_func_decl + case 364: // method_decl -> inclass_proc_func_decl { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 364: // method_decl -> inclass_constr_destr_decl + case 365: // method_decl -> inclass_constr_destr_decl { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 365: // method_header -> class_or_static, method_procfunc_header + case 366: // method_header -> class_or_static, method_procfunc_header { (ValueStack[ValueStack.Depth-1].td as procedure_header).class_keyword = true; CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 366: // method_header -> method_procfunc_header + case 367: // method_header -> method_procfunc_header { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 367: // method_header -> constr_destr_header + case 368: // method_header -> constr_destr_header { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 368: // method_procfunc_header -> proc_func_header + case 369: // method_procfunc_header -> proc_func_header { CurrentSemanticValue.td = NewProcfuncHeading(ValueStack[ValueStack.Depth-1].td as procedure_header); } break; - case 369: // proc_func_header -> proc_header + case 370: // proc_func_header -> proc_header { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 370: // proc_func_header -> func_header + case 371: // proc_func_header -> func_header { CurrentSemanticValue.td = ValueStack[ValueStack.Depth-1].td; } break; - case 371: // constr_destr_header -> tkConstructor, optional_proc_name, fp_list, + case 372: // 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 372: // constr_destr_header -> class_or_static, tkConstructor, optional_proc_name, + case 373: // constr_destr_header -> class_or_static, 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 373: // constr_destr_header -> tkDestructor, optional_proc_name, fp_list, + case 374: // 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 374: // optional_proc_name -> proc_name + case 375: // optional_proc_name -> proc_name { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-1].stn; } break; - case 375: // optional_proc_name -> /* empty */ + case 376: // optional_proc_name -> /* empty */ { CurrentSemanticValue.stn = null; } break; - case 376: // property_definition -> attribute_declarations, simple_property_definition + case 377: // property_definition -> attribute_declarations, simple_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 377: // simple_property_definition -> tkProperty, func_name, property_interface, + case 378: // simple_property_definition -> tkProperty, func_name, 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 378: // simple_property_definition -> tkProperty, func_name, property_interface, + case 379: // simple_property_definition -> tkProperty, func_name, property_interface, // property_specifiers, tkSemiColon, // property_modificator, tkSemiColon, // array_defaultproperty @@ -4569,7 +4572,7 @@ public partial class GPPGParser: ShiftReduceParser class_or_static, tkProperty, func_name, + case 380: // simple_property_definition -> class_or_static, tkProperty, func_name, // property_interface, property_specifiers, // tkSemiColon, array_defaultproperty { @@ -4577,7 +4580,7 @@ public partial class GPPGParser: ShiftReduceParser class_or_static, tkProperty, func_name, + case 381: // simple_property_definition -> class_or_static, tkProperty, func_name, // property_interface, property_specifiers, // tkSemiColon, property_modificator, tkSemiColon, // array_defaultproperty @@ -4585,7 +4588,7 @@ public partial class GPPGParser: ShiftReduceParser tkAuto, tkProperty, func_name, property_interface, + case 382: // simple_property_definition -> tkAuto, tkProperty, func_name, property_interface, // optional_property_initialization, tkSemiColon { CurrentSemanticValue.stn = NewSimplePropertyDefinition(ValueStack[ValueStack.Depth-4].stn as method_name, ValueStack[ValueStack.Depth-3].stn as property_interface, null, proc_attribute.attr_none, null, CurrentLocationSpan); @@ -4593,7 +4596,7 @@ public partial class GPPGParser: ShiftReduceParser class_or_static, tkAuto, tkProperty, func_name, + case 383: // simple_property_definition -> class_or_static, tkAuto, tkProperty, func_name, // property_interface, // optional_property_initialization, tkSemiColon { @@ -4603,54 +4606,54 @@ public partial class GPPGParser: ShiftReduceParser tkAssign, expr + case 384: // optional_property_initialization -> tkAssign, expr { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 384: // optional_property_initialization -> /* empty */ + case 385: // optional_property_initialization -> /* empty */ { CurrentSemanticValue.ex = null; } break; - case 385: // array_defaultproperty -> /* empty */ + case 386: // array_defaultproperty -> /* empty */ { CurrentSemanticValue.stn = null; } break; - case 386: // array_defaultproperty -> tkDefault, tkSemiColon + case 387: // array_defaultproperty -> tkDefault, tkSemiColon { CurrentSemanticValue.stn = new property_array_default(); CurrentSemanticValue.stn.source_context = CurrentLocationSpan; } break; - case 387: // property_interface -> property_parameter_list, tkColon, fptype + case 388: // 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 388: // property_parameter_list -> /* empty */ + case 389: // property_parameter_list -> /* empty */ { CurrentSemanticValue.stn = null; } break; - case 389: // property_parameter_list -> tkSquareOpen, parameter_decl_list, tkSquareClose + case 390: // property_parameter_list -> tkSquareOpen, parameter_decl_list, tkSquareClose { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-2].stn; } break; - case 390: // parameter_decl_list -> parameter_decl + case 391: // parameter_decl_list -> parameter_decl { CurrentSemanticValue.stn = new property_parameter_list(ValueStack[ValueStack.Depth-1].stn as property_parameter, CurrentLocationSpan); } break; - case 391: // parameter_decl_list -> parameter_decl_list, tkSemiColon, parameter_decl + case 392: // 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 392: // parameter_decl -> ident_list, tkColon, fptype + case 393: // 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 393: // optional_read_expr -> expr_with_func_decl_lambda + case 394: // optional_read_expr -> expr_with_func_decl_lambda { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 394: // optional_read_expr -> /* empty */ + case 395: // optional_read_expr -> /* empty */ { CurrentSemanticValue.ex = null; } break; - case 396: // property_specifiers -> tkRead, optional_read_expr, write_property_specifiers + case 397: // property_specifiers -> tkRead, optional_read_expr, write_property_specifiers { if (ValueStack[ValueStack.Depth-2].ex == null || ValueStack[ValueStack.Depth-2].ex is ident) // ����������� �������� { @@ -4666,7 +4669,7 @@ public partial class GPPGParser: ShiftReduceParser tkWrite, unlabelled_stmt, read_property_specifiers + case 398: // property_specifiers -> tkWrite, unlabelled_stmt, read_property_specifiers { if (ValueStack[ValueStack.Depth-2].stn is empty_statement) { @@ -4690,7 +4693,7 @@ public partial class GPPGParser: ShiftReduceParser tkWrite, unlabelled_stmt + case 400: // write_property_specifiers -> tkWrite, unlabelled_stmt { if (ValueStack[ValueStack.Depth-1].stn is empty_statement) { @@ -4713,7 +4716,7 @@ public partial class GPPGParser: ShiftReduceParser tkRead, optional_read_expr + case 402: // read_property_specifiers -> tkRead, optional_read_expr { if (ValueStack[ValueStack.Depth-1].ex == null || ValueStack[ValueStack.Depth-1].ex is ident) { @@ -4729,29 +4732,29 @@ public partial class GPPGParser: ShiftReduceParser var_decl_part, tkSemiColon + case 403: // var_decl -> var_decl_part, tkSemiColon { CurrentSemanticValue.stn = ValueStack[ValueStack.Depth-2].stn; } break; - case 405: // var_decl_part -> ident_list, tkColon, type_ref + case 406: // 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 406: // var_decl_part -> ident_list, tkAssign, expr_with_func_decl_lambda + case 407: // var_decl_part -> ident_list, tkAssign, expr_with_func_decl_lambda { 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 407: // var_decl_part -> ident_list, tkColon, type_ref, tkAssignOrEqual, + case 408: // 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 408: // typed_var_init_expression -> typed_const_plus + case 409: // typed_var_init_expression -> typed_const_plus { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 409: // typed_var_init_expression -> const_simple_expr, tkDotDot, const_term + case 410: // typed_var_init_expression -> const_simple_expr, tkDotDot, const_term { if (parsertools.build_tree_for_formatter) CurrentSemanticValue.ex = new diapason_expr(ValueStack[ValueStack.Depth-3].ex,ValueStack[ValueStack.Depth-1].ex,CurrentLocationSpan); @@ -4759,23 +4762,23 @@ public partial class GPPGParser: ShiftReduceParser expl_func_decl_lambda + case 411: // typed_var_init_expression -> expl_func_decl_lambda { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; - case 411: // typed_var_init_expression -> identifier, tkArrow, lambda_function_body + case 412: // 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 412: // typed_var_init_expression -> tkRoundOpen, tkRoundClose, lambda_type_ref, + case 413: // 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 413: // typed_var_init_expression -> tkRoundOpen, typed_const_list, tkRoundClose, + case 414: // typed_var_init_expression -> tkRoundOpen, typed_const_list, tkRoundClose, // tkArrow, lambda_function_body { var el = ValueStack[ValueStack.Depth-4].stn as expression_list; @@ -4797,10 +4800,7 @@ public partial class GPPGParser: ShiftReduceParser typed_const -{ CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } - break; - case 415: // typed_const_plus -> default_expr + case 415: // typed_const_plus -> typed_const { CurrentSemanticValue.ex = ValueStack[ValueStack.Depth-1].ex; } break; case 416: // constr_destr_decl -> constr_destr_header, block diff --git a/TestSuite/default2.pas b/TestSuite/default2.pas new file mode 100644 index 000000000..f6af10de0 --- /dev/null +++ b/TestSuite/default2.pas @@ -0,0 +1,34 @@ +procedure Test; +const + x1 = default(integer)+1; + x2: integer = default(integer)+1; + x3 = default(integer); + x4 = default(string); + x5 = default(object); + x6 = default(integer) + default(real); +begin + assert(x1 = 1); + assert(x2 = 1); + assert(x3 = 0); + assert(x4 = nil); + assert(x5 = nil); + assert(abs(x6) < 0.000001); +end; + +const + x1 = default(integer)+1; + x2: integer = default(integer)+1; + x3 = default(integer); + x4 = default(string); + x5 = default(object); + x6 = default(integer) + default(real); + +begin + assert(x1 = 1); + assert(x2 = 1); + assert(x3 = 0); + assert(x4 = nil); + assert(x5 = nil); + assert(abs(x6) < 0.000001); + Test; +end. \ No newline at end of file