diff --git a/ada/grammar.py b/ada/grammar.py index 68ae2ccd4..0495c048a 100644 --- a/ada/grammar.py +++ b/ada/grammar.py @@ -1123,7 +1123,8 @@ def end_named_block(): BracketAggregate( "[", cut(), Opt(A.expr, "with"), - List(A.aggregate_assoc, sep=",", list_cls=AssocList), + List(A.aggregate_assoc, + sep=",", list_cls=AssocList, empty_valid=True), "]" ), @@ -1175,7 +1176,7 @@ def end_named_block(): # parsers, so that we can use A.subtype_indication | A.name in allocator. qualified_name=QualExpr( - A.qual_name_internal, "'", Or(A.paren_expr, A.regular_aggregate) + A.qual_name_internal, "'", Or(A.paren_expr, A.aggregate) ), qual_name_internal=Or( diff --git a/testsuite/tests/parser/bracket_aggregate_0/input b/testsuite/tests/parser/bracket_aggregate_0/input new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/testsuite/tests/parser/bracket_aggregate_0/input @@ -0,0 +1 @@ +[] diff --git a/testsuite/tests/parser/bracket_aggregate_0/test.out b/testsuite/tests/parser/bracket_aggregate_0/test.out new file mode 100644 index 000000000..9857381a4 --- /dev/null +++ b/testsuite/tests/parser/bracket_aggregate_0/test.out @@ -0,0 +1,4 @@ +BracketAggregate[1:1-1:3] +|f_ancestor_expr: +|f_assocs: +| AssocList[1:2-1:2]: diff --git a/testsuite/tests/parser/bracket_aggregate_0/test.yaml b/testsuite/tests/parser/bracket_aggregate_0/test.yaml new file mode 100644 index 000000000..d8ab7a160 --- /dev/null +++ b/testsuite/tests/parser/bracket_aggregate_0/test.yaml @@ -0,0 +1,2 @@ +driver: parser +rule: aggregate diff --git a/testsuite/tests/parser/qualified_expression_1/input b/testsuite/tests/parser/qualified_expression_1/input new file mode 100644 index 000000000..f3de27da5 --- /dev/null +++ b/testsuite/tests/parser/qualified_expression_1/input @@ -0,0 +1 @@ +Foo'[Bar, Baz] diff --git a/testsuite/tests/parser/qualified_expression_1/test.out b/testsuite/tests/parser/qualified_expression_1/test.out new file mode 100644 index 000000000..e93f3383f --- /dev/null +++ b/testsuite/tests/parser/qualified_expression_1/test.out @@ -0,0 +1,18 @@ +QualExpr[1:1-1:15] +|f_prefix: +| Id[1:1-1:4]: Foo +|f_suffix: +| BracketAggregate[1:5-1:15] +| |f_ancestor_expr: +| |f_assocs: +| | AssocList[1:6-1:14] +| | | AggregateAssoc[1:6-1:9] +| | | |f_designators: +| | | | AlternativesList[1:5-1:5]: +| | | |f_r_expr: +| | | | Id[1:6-1:9]: Bar +| | | AggregateAssoc[1:11-1:14] +| | | |f_designators: +| | | | AlternativesList[1:9-1:9]: +| | | |f_r_expr: +| | | | Id[1:11-1:14]: Baz diff --git a/testsuite/tests/parser/qualified_expression_1/test.yaml b/testsuite/tests/parser/qualified_expression_1/test.yaml new file mode 100644 index 000000000..5dbf96198 --- /dev/null +++ b/testsuite/tests/parser/qualified_expression_1/test.yaml @@ -0,0 +1,2 @@ +driver: parser +rule: qualified_name