Compare commits

...

10 Commits

Author SHA1 Message Date
Troy Brown
e8e2515465 Split allocator test and move to separate file. 2024-05-23 09:24:58 +02:00
Troy Brown
5417b9ffc7 Remove duplicate entry_declaration rule. 2024-05-22 21:12:41 +02:00
Troy Brown
6c3dc1f0ae Correct parsing of discriminant constraints in allocators.
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.
2024-05-22 21:12:41 +02:00
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
11 changed files with 46342 additions and 43730 deletions

View File

@ -97,6 +97,7 @@ module.exports = grammar({
[$._name, $.package_body_stub],
[$._name, $._subtype_indication],
[$._name, $._subtype_indication, $.component_choice_list],
[$._name, $._subtype_mark],
[$.attribute_definition_clause, $._attribute_reference],
[$.component_choice_list, $.discrete_choice],
[$.component_choice_list, $.positional_array_aggregate],
@ -158,6 +159,10 @@ module.exports = grammar({
$.identifier,
$.string_literal,
),
_subtype_mark: $ => choice(
$.identifier,
$.selected_component,
$._attribute_reference),
selected_component: $ => prec.left(seq( // RM 4.1.3
field('prefix', $._name),
@ -565,12 +570,22 @@ module.exports = grammar({
allocator: $ => seq(
reservedWord('new'),
optional($.subpool_specification),
choice(
$._subtype_indication_paren_constraint,
$.qualified_expression)
),
_subtype_indication_paren_constraint: $ => seq(
// Ada 2012+ doesn't allow null exclusion here -- RM 4.8(2)
// Before Ada 2012, null exclusion raises Constraint_Error (AI05-0104)
optional($.null_exclusion),
$._name,
optional($.index_constraint),
field('subtype_mark', $._subtype_mark),
optional(choice(
// Choose discriminant_constraint over index_constraint,
// when syntax ambiguity arises, to avoid potential
// highlighting of names in a discriminant_constraint as
// subtype names.
prec.dynamic(1, $.discriminant_constraint),
$.index_constraint)),
),
subpool_specification: $ => seq(
'(',
@ -661,10 +676,10 @@ module.exports = grammar({
$.if_expression,
$.case_expression,
),
_conditional_quantified_expression: $ => choice(
$.if_expression,
$.case_expression,
_conditional_quantified_declare_expression: $ => choice(
$._conditional_expression,
$.quantified_expression,
$.declare_expression,
),
quantified_expression: $ => seq( // ARM 4.5.8
reservedWord('for'),
@ -907,6 +922,7 @@ module.exports = grammar({
$.access_definition,
),
optional($._assign_value),
optional($.aspect_specification),
),
_type_definition: $ => choice(
$.enumeration_type_definition,
@ -1355,14 +1371,19 @@ module.exports = grammar({
$._discrete_subtype_definition,
')',
)),
optional($.formal_part),
field('parameter_profile', optional($.formal_part)),
optional($.aspect_specification),
';',
),
entry_body: $ => seq(
reservedWord('entry'),
$.identifier,
optional($.non_empty_entry_body_formal_part),
optional(seq(
'(',
$.entry_index_specification,
')',
)),
field('parameter_profile', optional($.formal_part)),
optional($.aspect_specification),
$.entry_barrier,
reservedWord('is'),
@ -1382,6 +1403,7 @@ module.exports = grammar({
$.identifier,
reservedWord('in'),
$._discrete_subtype_definition,
optional($.aspect_specification),
),
enumeration_aggregate: $ => $._array_aggregate, // ??? inline ARM 13.4
enumeration_representation_clause: $ => seq( // ARM 13.4
@ -1793,27 +1815,6 @@ module.exports = grammar({
)),
';',
),
non_empty_entry_body_formal_part: $ => seq(
optional(seq(
'(',
$.entry_index_specification,
')',
)),
field('parameter_profile', $.formal_part),
),
entry_declaration: $ => seq(
optional($.overriding_indicator),
reservedWord('entry'),
$.identifier,
optional(seq(
'(',
$._discrete_subtype_definition,
')',
)),
field('parameter_profile', optional($.formal_part)),
optional($.aspect_specification),
';',
),
_task_item: $ => choice(
$.entry_declaration,
$._aspect_clause,
@ -1862,7 +1863,7 @@ module.exports = grammar({
'(',
choice(
comma_separated_list_of($.pragma_argument_association),
$._conditional_quantified_expression,
$._conditional_quantified_declare_expression,
),
')',
)),
@ -2294,6 +2295,7 @@ module.exports = grammar({
optional(reservedWord('constant')),
$._return_subtype_indication,
optional($._assign_value),
optional($.aspect_specification),
),
_return_subtype_indication: $ => choice(
$._subtype_indication,

30
package-lock.json generated
View File

@ -8,7 +8,7 @@
"name": "tree-sitter-ada",
"version": "0.1.0",
"dependencies": {
"tree-sitter": "0.20.5",
"tree-sitter": "0.20.6",
"tree-sitter-cli": "0.20.8"
}
},
@ -190,9 +190,9 @@
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="
},
"node_modules/nan": {
"version": "2.17.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz",
"integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ=="
"version": "2.18.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz",
"integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w=="
},
"node_modules/napi-build-utils": {
"version": "1.0.2",
@ -398,12 +398,12 @@
}
},
"node_modules/tree-sitter": {
"version": "0.20.5",
"resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.20.5.tgz",
"integrity": "sha512-xjxkKCKV7F2F5HWmyRE4bosoxkbxe9lYvFRc/nzmtHNqFNTwYwh0oWVVEt0VnbupZHMirEQW7vDx8ddJn72tjg==",
"version": "0.20.6",
"resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.20.6.tgz",
"integrity": "sha512-GxJodajVpfgb3UREzzIbtA1hyRnTxVbWVXrbC6sk4xTMH5ERMBJk9HJNq4c8jOJeUaIOmLcwg+t6mez/PDvGqg==",
"hasInstallScript": true,
"dependencies": {
"nan": "^2.17.0",
"nan": "^2.18.0",
"prebuild-install": "^7.1.1"
}
},
@ -553,9 +553,9 @@
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="
},
"nan": {
"version": "2.17.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz",
"integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ=="
"version": "2.18.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz",
"integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w=="
},
"napi-build-utils": {
"version": "1.0.2",
@ -692,11 +692,11 @@
}
},
"tree-sitter": {
"version": "0.20.5",
"resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.20.5.tgz",
"integrity": "sha512-xjxkKCKV7F2F5HWmyRE4bosoxkbxe9lYvFRc/nzmtHNqFNTwYwh0oWVVEt0VnbupZHMirEQW7vDx8ddJn72tjg==",
"version": "0.20.6",
"resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.20.6.tgz",
"integrity": "sha512-GxJodajVpfgb3UREzzIbtA1hyRnTxVbWVXrbC6sk4xTMH5ERMBJk9HJNq4c8jOJeUaIOmLcwg+t6mez/PDvGqg==",
"requires": {
"nan": "^2.17.0",
"nan": "^2.18.0",
"prebuild-install": "^7.1.1"
}
},

View File

@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"tree-sitter": "0.20.5",
"tree-sitter": "0.20.6",
"tree-sitter-cli": "0.20.8"
},
"scripts": {

View File

@ -303,6 +303,23 @@
}
]
},
"_subtype_mark": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "identifier"
},
{
"type": "SYMBOL",
"name": "selected_component"
},
{
"type": "SYMBOL",
"name": "_attribute_reference"
}
]
},
"selected_component": {
"type": "PREC_LEFT",
"value": 0,
@ -2771,9 +2788,18 @@
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "_subtype_indication_paren_constraint"
},
{
"type": "SYMBOL",
"name": "qualified_expression"
}
]
}
]
},
@ -2793,15 +2819,32 @@
]
},
{
"type": "FIELD",
"name": "subtype_mark",
"content": {
"type": "SYMBOL",
"name": "_name"
"name": "_subtype_mark"
}
},
{
"type": "CHOICE",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "PREC_DYNAMIC",
"value": 1,
"content": {
"type": "SYMBOL",
"name": "discriminant_constraint"
}
},
{
"type": "SYMBOL",
"name": "index_constraint"
}
]
},
{
"type": "BLANK"
@ -3331,20 +3374,20 @@
}
]
},
"_conditional_quantified_expression": {
"_conditional_quantified_declare_expression": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "if_expression"
},
{
"type": "SYMBOL",
"name": "case_expression"
"name": "_conditional_expression"
},
{
"type": "SYMBOL",
"name": "quantified_expression"
},
{
"type": "SYMBOL",
"name": "declare_expression"
}
]
},
@ -4939,6 +4982,18 @@
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "aspect_specification"
},
{
"type": "BLANK"
}
]
}
]
},
@ -7953,8 +8008,12 @@
"value": "entry"
},
{
"type": "FIELD",
"name": "entry_name",
"content": {
"type": "SYMBOL",
"name": "identifier"
}
},
{
"type": "CHOICE",
@ -8041,15 +8100,44 @@
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "("
},
{
"type": "SYMBOL",
"name": "non_empty_entry_body_formal_part"
"name": "entry_index_specification"
},
{
"type": "STRING",
"value": ")"
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "FIELD",
"name": "parameter_profile",
"content": {
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "formal_part"
},
{
"type": "BLANK"
}
]
}
},
{
"type": "CHOICE",
"members": [
@ -8219,6 +8307,18 @@
{
"type": "SYMBOL",
"name": "_discrete_subtype_definition"
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "aspect_specification"
},
{
"type": "BLANK"
}
]
}
]
},
@ -10891,44 +10991,6 @@
}
]
},
"non_empty_entry_body_formal_part": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "("
},
{
"type": "SYMBOL",
"name": "entry_index_specification"
},
{
"type": "STRING",
"value": ")"
}
]
},
{
"type": "BLANK"
}
]
},
{
"type": "FIELD",
"name": "parameter_profile",
"content": {
"type": "SYMBOL",
"name": "formal_part"
}
}
]
},
"_task_item": {
"type": "CHOICE",
"members": [
@ -11287,7 +11349,7 @@
},
{
"type": "SYMBOL",
"name": "_conditional_quantified_expression"
"name": "_conditional_quantified_declare_expression"
}
]
},
@ -14549,6 +14611,18 @@
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "aspect_specification"
},
{
"type": "BLANK"
}
]
}
]
},
@ -15335,6 +15409,10 @@
"_subtype_indication",
"component_choice_list"
],
[
"_name",
"_subtype_mark"
],
[
"attribute_definition_clause",
"_attribute_reference"

View File

@ -458,10 +458,10 @@
{
"type": "allocator",
"named": true,
"fields": {},
"children": {
"fields": {
"subtype_mark": {
"multiple": true,
"required": true,
"required": false,
"types": [
{
"type": "attribute_designator",
@ -483,14 +483,6 @@
"type": "identifier",
"named": true
},
{
"type": "index_constraint",
"named": true
},
{
"type": "null_exclusion",
"named": true
},
{
"type": "qualified_expression",
"named": true
@ -511,10 +503,6 @@
"type": "string_literal",
"named": true
},
{
"type": "subpool_specification",
"named": true
},
{
"type": "target_name",
"named": true
@ -530,6 +518,33 @@
]
}
},
"children": {
"multiple": true,
"required": false,
"types": [
{
"type": "discriminant_constraint",
"named": true
},
{
"type": "index_constraint",
"named": true
},
{
"type": "null_exclusion",
"named": true
},
{
"type": "qualified_expression",
"named": true
},
{
"type": "subpool_specification",
"named": true
}
]
}
},
{
"type": "array_component_association",
"named": true,
@ -2690,6 +2705,10 @@
"type": "access_definition",
"named": true
},
{
"type": "aspect_specification",
"named": true
},
{
"type": "expression",
"named": true
@ -2883,7 +2902,18 @@
{
"type": "entry_body",
"named": true,
"fields": {},
"fields": {
"parameter_profile": {
"multiple": false,
"required": false,
"types": [
{
"type": "formal_part",
"named": true
}
]
}
},
"children": {
"multiple": true,
"required": true,
@ -2896,6 +2926,10 @@
"type": "entry_barrier",
"named": true
},
{
"type": "entry_index_specification",
"named": true
},
{
"type": "handled_sequence_of_statements",
"named": true
@ -2907,10 +2941,6 @@
{
"type": "non_empty_declarative_part",
"named": true
},
{
"type": "non_empty_entry_body_formal_part",
"named": true
}
]
}
@ -3026,6 +3056,16 @@
"type": "entry_declaration",
"named": true,
"fields": {
"entry_name": {
"multiple": false,
"required": true,
"types": [
{
"type": "identifier",
"named": true
}
]
},
"parameter_profile": {
"multiple": false,
"required": false,
@ -3097,7 +3137,7 @@
},
"children": {
"multiple": true,
"required": true,
"required": false,
"types": [
{
"type": "aspect_specification",
@ -3115,10 +3155,6 @@
"type": "discriminant_constraint",
"named": true
},
{
"type": "identifier",
"named": true
},
{
"type": "index_constraint",
"named": true
@ -3209,6 +3245,10 @@
"multiple": true,
"required": true,
"types": [
{
"type": "aspect_specification",
"named": true
},
{
"type": "delta_constraint",
"named": true
@ -3902,6 +3942,10 @@
"type": "access_definition",
"named": true
},
{
"type": "aspect_specification",
"named": true
},
{
"type": "delta_constraint",
"named": true
@ -7787,32 +7831,6 @@
]
}
},
{
"type": "non_empty_entry_body_formal_part",
"named": true,
"fields": {
"parameter_profile": {
"multiple": false,
"required": true,
"types": [
{
"type": "formal_part",
"named": true
}
]
}
},
"children": {
"multiple": false,
"required": false,
"types": [
{
"type": "entry_index_specification",
"named": true
}
]
}
},
{
"type": "non_empty_mode",
"named": true,
@ -8865,6 +8883,10 @@
"type": "case_expression",
"named": true
},
{
"type": "declare_expression",
"named": true
},
{
"type": "identifier",
"named": true

88975
src/parser.c

File diff suppressed because it is too large Load Diff

474
test/corpus/allocators.txt Normal file
View File

@ -0,0 +1,474 @@
================================================================================
subtype indication (subtype mark: identifier)
================================================================================
procedure P is
begin
A := new T;
end;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(subprogram_body
(procedure_specification
name: (identifier))
(handled_sequence_of_statements
(assignment_statement
variable_name: (identifier)
(expression
(term
(allocator
subtype_mark: (identifier)))))))))
================================================================================
subtype indication (subtype mark: selected component)
================================================================================
procedure P is
begin
A := new X.T;
end;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(subprogram_body
(procedure_specification
name: (identifier))
(handled_sequence_of_statements
(assignment_statement
variable_name: (identifier)
(expression
(term
(allocator
subtype_mark: (selected_component
prefix: (identifier)
selector_name: (identifier))))))))))
================================================================================
subtype indication (subtype mark: attribute reference)
================================================================================
procedure P is
begin
A := new T'Base;
end;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(subprogram_body
(procedure_specification
name: (identifier))
(handled_sequence_of_statements
(assignment_statement
variable_name: (identifier)
(expression
(term
(allocator
subtype_mark: (identifier)
subtype_mark: (tick)
subtype_mark: (attribute_designator
(identifier))))))))))
================================================================================
subtype indication (null exclusion)
================================================================================
procedure P is
begin
A := new not null T;
end;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(subprogram_body
(procedure_specification
name: (identifier))
(handled_sequence_of_statements
(assignment_statement
variable_name: (identifier)
(expression
(term
(allocator
(null_exclusion)
subtype_mark: (identifier)))))))))
================================================================================
subtype indication (constraint: index constraint)
================================================================================
procedure P is
begin
A := new T (1 .. 10, 1 .. 20);
end;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(subprogram_body
(procedure_specification
name: (identifier))
(handled_sequence_of_statements
(assignment_statement
variable_name: (identifier)
(expression
(term
(allocator
subtype_mark: (identifier)
(index_constraint
(range_g
(term
(numeric_literal))
(term
(numeric_literal)))
(range_g
(term
(numeric_literal))
(term
(numeric_literal))))))))))))
================================================================================
subtype indication (constraint: discriminant constraint - numeric literal)
================================================================================
procedure P is
begin
A := new T (100);
end;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(subprogram_body
(procedure_specification
name: (identifier))
(handled_sequence_of_statements
(assignment_statement
variable_name: (identifier)
(expression
(term
(allocator
subtype_mark: (identifier)
(discriminant_constraint
(expression
(term
(numeric_literal))))))))))))
================================================================================
subtype indication (constraint: discriminant constraint - discriminant association)
================================================================================
procedure P is
begin
A := new T (F => 100);
end;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(subprogram_body
(procedure_specification
name: (identifier))
(handled_sequence_of_statements
(assignment_statement
variable_name: (identifier)
(expression
(term
(allocator
subtype_mark: (identifier)
(discriminant_constraint
(discriminant_association
(identifier)
(expression
(term
(numeric_literal)))))))))))))
================================================================================
subtype indication (constraint: discriminant constraint - identifier)
================================================================================
procedure P is
begin
A := new T (F);
end;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(subprogram_body
(procedure_specification
name: (identifier))
(handled_sequence_of_statements
(assignment_statement
variable_name: (identifier)
(expression
(term
(allocator
subtype_mark: (identifier)
(discriminant_constraint
(expression
(term
name: (identifier))))))))))))
================================================================================
qualified expression (aggregate: positional array aggregate)
================================================================================
procedure P is
begin
A := new T'(0, 255, 0);
end;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(subprogram_body
(procedure_specification
name: (identifier))
(handled_sequence_of_statements
(assignment_statement
variable_name: (identifier)
(expression
(term
(allocator
(qualified_expression
subtype_name: (identifier)
(tick)
(positional_array_aggregate
(expression
(term
(numeric_literal)))
(expression
(term
(numeric_literal)))
(expression
(term
(numeric_literal)))))))))))))
================================================================================
qualified expression (aggregate: record aggregate)
================================================================================
procedure P is
begin
A := new T'(F => 1);
end;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(subprogram_body
(procedure_specification
name: (identifier))
(handled_sequence_of_statements
(assignment_statement
variable_name: (identifier)
(expression
(term
(allocator
(qualified_expression
subtype_name: (identifier)
(tick)
(record_aggregate
(record_component_association_list
(component_choice_list
(identifier))
(expression
(term
(numeric_literal))))))))))))))
================================================================================
qualified expression (aggregate: named array aggregate)
================================================================================
procedure P is
begin
A := new T'(1 .. 10 => (1 .. 20 => 0.0));
end;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(subprogram_body
(procedure_specification
name: (identifier))
(handled_sequence_of_statements
(assignment_statement
variable_name: (identifier)
(expression
(term
(allocator
(qualified_expression
subtype_name: (identifier)
(tick)
(named_array_aggregate
(array_component_association
(discrete_choice_list
(discrete_choice
(range_g
(term
(numeric_literal))
(term
(numeric_literal)))))
(expression
(term
(named_array_aggregate
(array_component_association
(discrete_choice_list
(discrete_choice
(range_g
(term
(numeric_literal))
(term
(numeric_literal)))))
(expression
(term
(numeric_literal))))))))))))))))))
================================================================================
qualified expression (expression: numeric literal)
================================================================================
procedure P is
begin
A := new T'(55);
end;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(subprogram_body
(procedure_specification
name: (identifier))
(handled_sequence_of_statements
(assignment_statement
variable_name: (identifier)
(expression
(term
(allocator
(qualified_expression
subtype_name: (identifier)
(tick)
(expression
(term
(numeric_literal))))))))))))
================================================================================
qualified expression (expression: identifier)
================================================================================
procedure P is
begin
A := new T'(F);
end;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(subprogram_body
(procedure_specification
name: (identifier))
(handled_sequence_of_statements
(assignment_statement
variable_name: (identifier)
(expression
(term
(allocator
(qualified_expression
subtype_name: (identifier)
(tick)
(expression
(term
name: (identifier))))))))))))
================================================================================
qualified expression (subtype mark: attribute reference)
================================================================================
procedure P is
begin
A := new T'Base'(5);
end;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(subprogram_body
(procedure_specification
name: (identifier))
(handled_sequence_of_statements
(assignment_statement
variable_name: (identifier)
(expression
(term
(allocator
(qualified_expression
subtype_name: (identifier)
subtype_name: (tick)
subtype_name: (attribute_designator
(identifier))
(tick)
(expression
(term
(numeric_literal))))))))))))
================================================================================
subpool specification
================================================================================
procedure P is
begin
A := new (pkg.pool) T;
A := new (pkg.pool) T'(55);
end;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(subprogram_body
(procedure_specification
name: (identifier))
(handled_sequence_of_statements
(assignment_statement
variable_name: (identifier)
(expression
(term
(allocator
(subpool_specification
subpool_handle_name: (selected_component
prefix: (identifier)
selector_name: (identifier)))
subtype_mark: (identifier)))))
(assignment_statement
variable_name: (identifier)
(expression
(term
(allocator
(subpool_specification
subpool_handle_name: (selected_component
prefix: (identifier)
selector_name: (identifier)))
(qualified_expression
subtype_name: (identifier)
(tick)
(expression
(term
(numeric_literal))))))))))))

View File

@ -129,3 +129,38 @@ end;
(expression
(term
(identifier))))))))))
================================================================================
declare expression in pragma
================================================================================
package P is
pragma Assert
(declare
E : constant Integer := 123;
begin
E = 123);
end P;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(package_declaration
(identifier)
(pragma_g
(identifier)
(declare_expression
(object_declaration
(identifier)
(identifier)
(expression
(term
(numeric_literal))))
(expression
(term
(identifier))
(relational_operator)
(term
(numeric_literal)))))
(identifier))))

View File

@ -8,6 +8,7 @@ package body P is
function Func return Boolean;
entry E;
entry E2 (Color)(A : Integer);
entry E3 (1 .. 1);
private
Field : Integer;
end Obj;
@ -23,6 +24,10 @@ package body P is
begin
null;
end E2;
entry E3 (for I in 1 .. 1 with Import) when True is
begin
null;
end E3;
end Obj;
end;
@ -54,6 +59,13 @@ end;
(parameter_specification
(identifier)
(identifier))))
(entry_declaration
(identifier)
(range_g
(term
(numeric_literal))
(term
(numeric_literal))))
(component_declaration
(identifier)
(component_definition
@ -92,14 +104,33 @@ end;
(identifier))
(entry_body
(identifier)
(non_empty_entry_body_formal_part
(entry_index_specification
(identifier)
(identifier))
(formal_part
(parameter_specification
(identifier)
(identifier)))
(entry_barrier
(expression
(term
(identifier))))
(handled_sequence_of_statements
(null_statement))
(identifier))
(entry_body
(identifier)
(entry_index_specification
(identifier)
(range_g
(term
(numeric_literal))
(term
(numeric_literal)))
(aspect_specification
(aspect_mark_list
(aspect_association
(identifier)))))
(entry_barrier
(expression
(term

View File

@ -109,7 +109,7 @@ Discriminated
================================================================================
package P is
type R (A : Integer; B : Integer) is record
type R (A : Integer; B : Integer with Import) is record
F : Float;
end record;
end;
@ -129,7 +129,11 @@ end;
(identifier))
(discriminant_specification
(identifier)
(identifier))))
(identifier)
(aspect_specification
(aspect_mark_list
(aspect_association
(identifier)))))))
(record_type_definition
(record_definition
(component_list

View File

@ -157,6 +157,11 @@ begin
return A : My_Rec := (F => 1) do
null;
end return;
return Y : Integer
with Address => X'Address
do
null;
end return;
end F;
--------------------------------------------------------------------------------
@ -186,6 +191,22 @@ end F;
(expression
(term
(numeric_literal))))))))
(handled_sequence_of_statements
(null_statement)))
(extended_return_statement
(extended_return_object_declaration
(identifier)
(identifier)
(aspect_specification
(aspect_mark_list
(aspect_association
(identifier)
(expression
(term
(identifier)
(tick)
(attribute_designator
(identifier))))))))
(handled_sequence_of_statements
(null_statement))))
(identifier))))
@ -414,52 +435,6 @@ end;
(character_literal)))))
(null_statement)))))))
================================================================================
Allocators
================================================================================
procedure P is
begin
A := new T;
A := new (pkg.pool) T'((F => 1));
end;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(subprogram_body
(procedure_specification
(identifier))
(handled_sequence_of_statements
(assignment_statement
(identifier)
(expression
(term
(allocator
(identifier)))))
(assignment_statement
(identifier)
(expression
(term
(allocator
(subpool_specification
(selected_component
(identifier)
(identifier)))
(qualified_expression
(identifier)
(tick)
(expression
(term
(record_aggregate
(record_component_association_list
(component_choice_list
(identifier))
(expression
(term
(numeric_literal))))))))))))))))
================================================================================
Filtered for loops
================================================================================