From a0968468ec5b221b4c00119c14bb2bf332cec9d2 Mon Sep 17 00:00:00 2001 From: Ivan Bondarev Date: Sun, 4 Sep 2022 14:07:24 +0200 Subject: [PATCH] #2696 --- .../PascalABCParserNewSaushkin/ABCPascal.cs | 6 +- .../PascalABCParserNewSaushkin/ABCPascal.y | 3 +- .../ABCPascalYacc.cs | 2855 ++++++++--------- TestSuite/enum7.pas | 8 + 4 files changed, 1438 insertions(+), 1434 deletions(-) create mode 100644 TestSuite/enum7.pas diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs b/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs index b299341a5..9b3e70570 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: DESKTOP-G8V08V4 -// DateTime: 23.05.2022 8:03:08 -// UserName: ????????? +// Machine: DESKTOP-2BJCJ7I +// DateTime: 04.09.2022 14:03:46 +// UserName: ibond // GPLEX input file // GPLEX frame file // diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascal.y b/Parsers/PascalABCParserNewSaushkin/ABCPascal.y index fb97cfcc4..b249cb8bb 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascal.y +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascal.y @@ -1481,10 +1481,9 @@ simple_type_identifier ; enumeration_id_list - : enumeration_id tkComma enumeration_id + : enumeration_id { $$ = new enumerator_list($1 as enumerator, @$); - ($$ as enumerator_list).Add($3 as enumerator, @$); } | enumeration_id_list tkComma enumeration_id { diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs b/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs index 037587d5f..f585db2e3 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: DESKTOP-G8V08V4 -// DateTime: 23.05.2022 8:03:08 -// UserName: ????????? +// Machine: DESKTOP-2BJCJ7I +// DateTime: 04.09.2022 14:03:46 +// UserName: ibond // Input file // options: no-lines gplex @@ -78,7 +78,7 @@ public partial class GPPGParser: ShiftReduceParser aliasses; #pragma warning restore 649 private static Rule[] rules = new Rule[1010]; - private static State[] states = new State[1679]; + private static State[] states = new State[1677]; private static string[] nonTerms = new string[] { "parse_goal", "unit_key_word", "class_or_static", "assignment", "optional_array_initializer", "attribute_declarations", "ot_visibility_specifier", "one_attribute", "attribute_variable", @@ -174,13 +174,13 @@ public partial class GPPGParser: ShiftReduceParser enumeration_id, tkComma, enumeration_id + case 261: // enumeration_id_list -> 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); + CurrentSemanticValue.stn = new enumerator_list(ValueStack[ValueStack.Depth-1].stn as enumerator, CurrentLocationSpan); } break; case 262: // enumeration_id_list -> enumeration_id_list, tkComma, enumeration_id diff --git a/TestSuite/enum7.pas b/TestSuite/enum7.pas new file mode 100644 index 000000000..97e96e59e --- /dev/null +++ b/TestSuite/enum7.pas @@ -0,0 +1,8 @@ +type + enum1 = (enval1 = 1); + enum2 = (enval2); + +begin + var e := enum1.enval1; + assert(integer(e) = 1); +end. \ No newline at end of file