Commit Graph

77 Commits

Author SHA1 Message Date
Piotr Trojanek
ba0894efa0 Accept aspect specification for discriminant specification
(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.
2024-01-05 08:33:41 +01:00
Piotr Trojanek
1302d7fb0b Accept aspect specification for entry index specification
(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.
2024-01-05 08:31:05 +01:00
Piotr Trojanek
68040e7ae8 Accept entry families with no parameters
(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.
2024-01-05 08:29:29 +01:00
Piotr Trojanek
4312cfd8ba Accept aspect specification for extended return object
(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.
2024-01-05 08:24:33 +01:00
Piotr Trojanek
5a2bff7cea Reuse _conditional_expression 2024-01-05 08:21:59 +01:00
Piotr Trojanek
07019a9929 Accept declare expression in pragma
(_conditional_quantified_expression): accept declare expression; rename

Fixes parsing error that occurred in GNATprove source code.

add test.
2024-01-05 08:19:05 +01:00
Emmanuel Briot
73d90b439d Upgrade tree-sitter to version 20.6 2024-01-05 08:16:49 +01:00
Piotr Trojanek
a1e54e4e03 Accept pragmas within declare expressions
(_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.
2024-01-03 14:43:22 +01:00
Troy Brown
f21f13afe0 Correct parsing of discrete_choice expressions.
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.
2023-09-05 09:17:27 +02:00
Emmanuel Briot
0f572c4dcc Add test for #6 2023-08-28 07:32:53 +02:00
Emmanuel Briot
b6507d0a88 Revert "feat: use the i flag for Regex"
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.
2023-08-28 07:26:11 +02:00
Emmanuel Briot
f67bc6622a Synchronize queries with nvim-treesitter repository 2023-08-22 08:24:31 +02:00
Emmanuel Briot
1296a692cc Update dependencies versions 2023-08-22 08:24:31 +02:00
Emmanuel Briot
5bec028d82
Merge pull request #5 from amaanq/regex-i-flag
Regex i flag
2023-08-22 08:59:04 +02:00
Amaan Qureshi
9c6c5e2a18
chore: generate 2023-08-12 22:44:04 -04:00
Amaan Qureshi
c0f6fedb25
chore: remove unncessary conflicts 2023-08-12 22:44:00 -04:00
Amaan Qureshi
99d845cd94
feat: use the i flag for Regex 2023-08-12 22:43:43 -04:00
Emmanuel Briot
ba7951a8f3 Fill in year and name in license
Fixes #4
2023-06-06 07:59:04 +02:00
Emmanuel Briot
8f8a344baf A with_clause is not necessarily for a single identifier. 2023-06-06 07:44:19 +02:00
Emmanuel Briot
caed0d5025 Add support for folding subprogram declarations 2023-06-06 07:44:19 +02:00
Emmanuel Briot
5e125407b0 Add license
Fixes #4
2023-06-06 07:44:11 +02:00
Emmanuel Briot
42cc2eb141 (package_specification): now hidden in trees
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.
2023-02-13 13:51:44 +01:00
Emmanuel Briot
e9e2ec9d3b Also highlight tagged and limited in type declarations. 2022-12-15 09:58:32 +01:00
Emmanuel Briot
0210164cce Replace type.definition with keyword.type
The former is meant for the actual identifier, not the keywords around
it.
2022-12-15 09:35:25 +01:00
Emmanuel Briot
7426f191a1 Explain how to generate Railroad diagrams for the grammar. 2022-12-15 09:29:06 +01:00
Emmanuel Briot
d625712fe1 Allow empty statements of declarations in gnatprep
All runtime files and all the code from Deep Blue Capital are now
parsed without errors.
2022-12-14 14:28:59 +01:00
Emmanuel Briot
faa006e5fd Allow if-expression for discriminant constraints
The rule (not visible in the RM grammar) is that
if we have a single positional discriminant, we
can omit the extra pair of parenthesis.
2022-12-14 13:49:02 +01:00
Emmanuel Briot
7fe1b1edb4 Add support for gnatprep directives
They can be folded
2022-12-14 13:29:59 +01:00
Emmanuel Briot
39697ddca8 fix support of pragmas inside exception handlers
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.
2022-12-14 12:59:09 +01:00
Emmanuel Briot
dbd3401b14 A task type can contain pragmas
Not shown in the RM grammar, but explicit in 2.8
2022-12-14 12:31:43 +01:00
Emmanuel Briot
7b4bf400ab Task types may have no task_item
Based literals may have exponents
2022-12-14 12:24:09 +01:00
Emmanuel Briot
fb54a00c16 Allow pragmas inside records 2022-12-14 12:08:24 +01:00
Emmanuel Briot
b9645c74b2 Add discriminant_constraint 2022-12-14 11:55:25 +01:00
Emmanuel Briot
a63a4f53d3 (extension with aggregates): allow a single positional item 2022-12-14 11:19:43 +01:00
Emmanuel Briot
c61d74d03a Fix parsing numeric literals with underscore in decimal part
The regexp adapted from Emacs' ada-mode was wrong,
and also not accept "E+..."
2022-12-14 11:05:55 +01:00
Emmanuel Briot
6903869a00 Fix handling of variant records
Having two component_item followed by a variant_part
was not accepted
2022-12-14 10:44:51 +01:00
Emmanuel Briot
725a32a592 Fix handling of operator names in parameter_association 2022-12-14 10:06:22 +01:00
Emmanuel Briot
15b9745fff help tree-sitter with recognizing Ada files 2022-12-14 10:06:04 +01:00
Emmanuel Briot
c25792f45c Add support for slices 2022-12-13 12:29:02 +01:00
Emmanuel Briot
30545542d7 Remove no longer needed conflict clauses 2022-12-12 12:10:55 +01:00
Emmanuel Briot
4557f68292 Inline "statement" 2022-12-12 11:35:04 +01:00
Emmanuel Briot
d52ba823fa Add support for "or terminate" in select statements 2022-12-12 11:27:49 +01:00
Emmanuel Briot
d6ea15a3e0 Add support for double-quotes inside strings 2022-12-12 10:58:36 +01:00
Emmanuel Briot
ec82f7b2cf Fix support for Func(...).Value
Need to set associativity on selected_component
2022-12-12 10:50:59 +01:00
Emmanuel Briot
7bd8543b71 Fix error for access parameters and untyped constants 2022-12-09 14:38:08 +01:00
Emmanuel Briot
3b5200c14c Inline all rules that do not consume any character directly
This simplifies the trees significantly.
2022-12-09 12:32:06 +01:00
Emmanuel Briot
a41588c541 Various inlining of rules to simplify tree 2022-12-09 11:02:26 +01:00
Emmanuel Briot
de1a5f3038 Commit the generated files
This provides easier installation
2022-12-08 11:53:54 +01:00
Emmanuel Briot
1eafd432d7 Add queries for neovim 2022-12-08 11:53:03 +01:00
Emmanuel Briot
0a52f6df01 various attempts to simplify grammar
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.
2022-12-07 18:32:50 +01:00