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.
The existing grammar was causing simple expressions to be incorrectly
parsed as a subtype indication. This change raises the precedence for
a discrete choice expression to address that issue.
Updated the test corpus to reflect the parsing correction. Additional
test cases were added for discrete choice.
Since upstream tree-sitter hasn't been released yet (nor the node
package updated), it is cumbersome to build things. For now keep
the old regexp.
This reverts commit 99d845cd94.
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.
Fixes handing of expression functions (for which the expression was
identified as an aggregate)
Move conditional expressions out of 'aggregate', to conform with ARM and
resolve the above amgiguity
Inline expression_list, which was resulting in a conflict with a
record_component_association.