tree-sitter-ada/test/corpus/pragmas.txt
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

132 lines
3.4 KiB
Plaintext

================================================================================
pragma on record field
================================================================================
package P is
type R is record
Started : Boolean := False;
pragma Atomic (Started);
end record;
pragma Foo;
end;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(package_declaration
(identifier)
(full_type_declaration
(identifier)
(record_type_definition
(record_definition
(component_list
(component_declaration
(identifier)
(component_definition
(identifier))
(expression
(term
(identifier))))
(pragma_g
(identifier)
(pragma_argument_association
(expression
(term
(identifier)))))))))
(pragma_g
(identifier)))))
================================================================================
pragma in statement
================================================================================
procedure P is
begin
null;
pragma Foo;
null;
end;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(subprogram_body
(procedure_specification
(identifier))
(handled_sequence_of_statements
(null_statement)
(pragma_g
(identifier))
(null_statement)))))
================================================================================
pragma in tasks
================================================================================
package P is
task type T is
pragma Storage_Size (1024);
end T;
end;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(package_declaration
(identifier)
(full_type_declaration
(task_type_declaration
(identifier)
(task_definition
(pragma_g
(identifier)
(pragma_argument_association
(expression
(term
(numeric_literal)))))
(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))))))))))