The existing grammar was causing discriminant constraints in
allocators to be incorrectly parsed as function calls. This change
modifies the grammar to more accurately follow the grammar of the
language and corrects the issue.
Updated the test corpus to add additional allocator tests with
numerous subtype indications and qualified expressions for more
extensive testing.
(discriminant_specification): accept aspect_specification
In accordance with Ada 2022 RM 3.7(5/5); this was not allowed in Ada
2012, but was changed in AI12-0398-1/03.
extend test.
(entry_index_specification): accept aspect_specification
In accordance with Ada 2022 RM 9.5.2(8/5); this was not allowed in Ada
2012, but was changed in AI12-0398-1/03.
add dummy test.
(entry_body): directly parse entry_body_formal_part
In Ada grammar the entry_body_formal_part both the
entry_index_specification and the parameter_profile are optional
(because they describe both simple entries and entry families,
both with and without parameters). However, tree-sitter does not
allow rules that match empty strings.
The simplest solution is to directly encode entry_body_formal_part
within the entry_body.
add test.
(extended_return_object_declaration): accept aspect_specification
In accordance with Ada 2022 RM 6.5(2.1/5); this was not allowed in Ada
2012, but was changed in AI12-0398-1/03.
add test.
(_declare_item): accept pragmas
Assert pragmas (and other "executable" pragmas) are specifically allowed
in declare expressions, thanks to a recent AI22-0045. They are accepted
by the latest GNAT compilers.
Regenerate grammar using tree-sitter-linux-x64-0.20.7; add test.
Instead, package_declaration replaces it. This provides
better folding in nvim: otherwise, the final ';' was not
part of the tree node, and thus the last line "end P;" was
not folded.
This was copied from ada_mode, but results in
confusion when we have statements after the pragma
Fix allocates with if-expression, which no longer
needs double-parenthesis.