Fix handling of variant records
Having two component_item followed by a variant_part was not accepted
This commit is contained in:
parent
725a32a592
commit
6903869a00
|
|
@ -1015,10 +1015,10 @@ module.exports = grammar({
|
|||
reservedWord('record'),
|
||||
),
|
||||
),
|
||||
component_list: $ => choice(
|
||||
component_list: $ => choice( // RM 3.8
|
||||
repeat1($._component_item),
|
||||
seq(
|
||||
optional($._component_item),
|
||||
repeat($._component_item),
|
||||
$.variant_part,
|
||||
),
|
||||
seq(
|
||||
|
|
|
|||
|
|
@ -5774,16 +5774,11 @@
|
|||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "_component_item"
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
}
|
||||
]
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SYMBOL",
|
||||
"name": "_component_item"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
|
|
|
|||
40161
src/parser.c
40161
src/parser.c
File diff suppressed because it is too large
Load Diff
|
|
@ -355,3 +355,106 @@ end;
|
|||
(expression
|
||||
(term
|
||||
(numeric_literal))))))))))))
|
||||
|
||||
================================================================================
|
||||
Variant records
|
||||
================================================================================
|
||||
|
||||
type R (D : Boolean) is record
|
||||
A : Integer;
|
||||
case D is
|
||||
when True => null;
|
||||
when False =>
|
||||
B : Integer := 1;
|
||||
-- some comment
|
||||
end case;
|
||||
end record;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(known_discriminant_part
|
||||
(discriminant_specification_list
|
||||
(discriminant_specification
|
||||
(identifier)
|
||||
(identifier))))
|
||||
(record_type_definition
|
||||
(record_definition
|
||||
(component_list
|
||||
(component_declaration
|
||||
(identifier)
|
||||
(component_definition
|
||||
(identifier)))
|
||||
(variant_part
|
||||
(identifier)
|
||||
(variant_list
|
||||
(variant
|
||||
(discrete_choice_list
|
||||
(discrete_choice
|
||||
(identifier)))
|
||||
(component_list))
|
||||
(variant
|
||||
(discrete_choice_list
|
||||
(discrete_choice
|
||||
(identifier)))
|
||||
(component_list
|
||||
(component_declaration
|
||||
(identifier)
|
||||
(component_definition
|
||||
(identifier))
|
||||
(expression
|
||||
(term
|
||||
(numeric_literal)))))))
|
||||
(comment))))))))
|
||||
|
||||
================================================================================
|
||||
variants 2
|
||||
================================================================================
|
||||
|
||||
type R (S : Config_Side) is record
|
||||
E : Duration;
|
||||
F : Duration;
|
||||
|
||||
case Side is
|
||||
when Config_Consumer =>
|
||||
C : Duration;
|
||||
end case;
|
||||
end record;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(full_type_declaration
|
||||
(identifier)
|
||||
(known_discriminant_part
|
||||
(discriminant_specification_list
|
||||
(discriminant_specification
|
||||
(identifier)
|
||||
(identifier))))
|
||||
(record_type_definition
|
||||
(record_definition
|
||||
(component_list
|
||||
(component_declaration
|
||||
(identifier)
|
||||
(component_definition
|
||||
(identifier)))
|
||||
(component_declaration
|
||||
(identifier)
|
||||
(component_definition
|
||||
(identifier)))
|
||||
(variant_part
|
||||
(identifier)
|
||||
(variant_list
|
||||
(variant
|
||||
(discrete_choice_list
|
||||
(discrete_choice
|
||||
(identifier)))
|
||||
(component_list
|
||||
(component_declaration
|
||||
(identifier)
|
||||
(component_definition
|
||||
(identifier)))))))))))))
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user