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.
This commit is contained in:
parent
f21f13afe0
commit
a1e54e4e03
|
|
@ -685,6 +685,7 @@ module.exports = grammar({
|
||||||
_declare_item: $ => choice(
|
_declare_item: $ => choice(
|
||||||
$.object_declaration,
|
$.object_declaration,
|
||||||
$.object_renaming_declaration,
|
$.object_renaming_declaration,
|
||||||
|
$.pragma_g,
|
||||||
),
|
),
|
||||||
quantifier: $ => choice(
|
quantifier: $ => choice(
|
||||||
reservedWord('all'),
|
reservedWord('all'),
|
||||||
|
|
|
||||||
|
|
@ -3456,6 +3456,10 @@
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "object_renaming_declaration"
|
"name": "object_renaming_declaration"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "pragma_g"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -2095,6 +2095,10 @@
|
||||||
{
|
{
|
||||||
"type": "object_renaming_declaration",
|
"type": "object_renaming_declaration",
|
||||||
"named": true
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "pragma_g",
|
||||||
|
"named": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
14856
src/parser.c
14856
src/parser.c
File diff suppressed because it is too large
Load Diff
|
|
@ -88,3 +88,44 @@ end;
|
||||||
(term
|
(term
|
||||||
(numeric_literal)))))
|
(numeric_literal)))))
|
||||||
(identifier)))))))
|
(identifier)))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
pragma in declare expression
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
package P is
|
||||||
|
X : Integer :=
|
||||||
|
(declare
|
||||||
|
Y : constant Integer := 123;
|
||||||
|
pragma Assert (True);
|
||||||
|
begin
|
||||||
|
Y);
|
||||||
|
end;
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(compilation
|
||||||
|
(compilation_unit
|
||||||
|
(package_declaration
|
||||||
|
(identifier)
|
||||||
|
(object_declaration
|
||||||
|
(identifier)
|
||||||
|
(identifier)
|
||||||
|
(expression
|
||||||
|
(term
|
||||||
|
(declare_expression
|
||||||
|
(object_declaration
|
||||||
|
(identifier)
|
||||||
|
(identifier)
|
||||||
|
(expression
|
||||||
|
(term
|
||||||
|
(numeric_literal))))
|
||||||
|
(pragma_g
|
||||||
|
(identifier)
|
||||||
|
(pragma_argument_association
|
||||||
|
(expression
|
||||||
|
(term
|
||||||
|
(identifier)))))
|
||||||
|
(expression
|
||||||
|
(term
|
||||||
|
(identifier))))))))))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user