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.
This commit is contained in:
Piotr Trojanek 2024-01-03 16:27:22 +01:00 committed by Emmanuel Briot
parent 5a2bff7cea
commit 4312cfd8ba
5 changed files with 33057 additions and 32898 deletions

View File

@ -2294,6 +2294,7 @@ module.exports = grammar({
optional(reservedWord('constant')), optional(reservedWord('constant')),
$._return_subtype_indication, $._return_subtype_indication,
optional($._assign_value), optional($._assign_value),
optional($.aspect_specification),
), ),
_return_subtype_indication: $ => choice( _return_subtype_indication: $ => choice(
$._subtype_indication, $._subtype_indication,

View File

@ -14549,6 +14549,18 @@
"type": "BLANK" "type": "BLANK"
} }
] ]
},
{
"type": "CHOICE",
"members": [
{
"type": "SYMBOL",
"name": "aspect_specification"
},
{
"type": "BLANK"
}
]
} }
] ]
}, },

View File

@ -3902,6 +3902,10 @@
"type": "access_definition", "type": "access_definition",
"named": true "named": true
}, },
{
"type": "aspect_specification",
"named": true
},
{ {
"type": "delta_constraint", "type": "delta_constraint",
"named": true "named": true

65917
src/parser.c

File diff suppressed because it is too large Load Diff

View File

@ -157,6 +157,11 @@ begin
return A : My_Rec := (F => 1) do return A : My_Rec := (F => 1) do
null; null;
end return; end return;
return Y : Integer
with Address => X'Address
do
null;
end return;
end F; end F;
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@ -186,6 +191,22 @@ end F;
(expression (expression
(term (term
(numeric_literal)))))))) (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 (handled_sequence_of_statements
(null_statement)))) (null_statement))))
(identifier)))) (identifier))))