Fix handling of operator names in parameter_association
This commit is contained in:
parent
15b9745fff
commit
725a32a592
12
grammar.js
12
grammar.js
|
|
@ -105,6 +105,8 @@ module.exports = grammar({
|
||||||
[$._name, $._subtype_indication],
|
[$._name, $._subtype_indication],
|
||||||
[$._name, $._subtype_indication, $.component_choice_list],
|
[$._name, $._subtype_indication, $.component_choice_list],
|
||||||
[$.attribute_definition_clause, $._attribute_reference],
|
[$.attribute_definition_clause, $._attribute_reference],
|
||||||
|
[$.component_choice_list, $.discrete_choice],
|
||||||
|
[$.component_choice_list, $.positional_array_aggregate],
|
||||||
],
|
],
|
||||||
inline: $ => [
|
inline: $ => [
|
||||||
$._name_not_function_call,
|
$._name_not_function_call,
|
||||||
|
|
@ -666,8 +668,14 @@ module.exports = grammar({
|
||||||
'=>',
|
'=>',
|
||||||
$.expression,
|
$.expression,
|
||||||
),
|
),
|
||||||
component_choice_list: $ =>
|
component_choice_list: $ => choice( // RM 4.3.1
|
||||||
list_of('|', $.identifier),
|
reservedWord('others'),
|
||||||
|
list_of('|', choice( // Do not allow slice, function_call,...
|
||||||
|
$.identifier, // as opposed to what the ARM allows
|
||||||
|
$.selected_component,
|
||||||
|
$.string_literal,
|
||||||
|
)),
|
||||||
|
),
|
||||||
_aggregate: $ => choice( // RM 4.3
|
_aggregate: $ => choice( // RM 4.3
|
||||||
$.record_aggregate,
|
$.record_aggregate,
|
||||||
$.extension_aggregate,
|
$.extension_aggregate,
|
||||||
|
|
|
||||||
|
|
@ -3397,27 +3397,74 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"component_choice_list": {
|
"component_choice_list": {
|
||||||
"type": "SEQ",
|
"type": "CHOICE",
|
||||||
"members": [
|
"members": [
|
||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "ALIAS",
|
||||||
"name": "identifier"
|
"content": {
|
||||||
|
"type": "TOKEN",
|
||||||
|
"content": {
|
||||||
|
"type": "PREC",
|
||||||
|
"value": 2,
|
||||||
|
"content": {
|
||||||
|
"type": "PATTERN",
|
||||||
|
"value": "[oO][tT][hH][eE][rR][sS]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"named": false,
|
||||||
|
"value": "others"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "REPEAT",
|
"type": "SEQ",
|
||||||
"content": {
|
"members": [
|
||||||
"type": "SEQ",
|
{
|
||||||
"members": [
|
"type": "CHOICE",
|
||||||
{
|
"members": [
|
||||||
"type": "STRING",
|
{
|
||||||
"value": "|"
|
"type": "SYMBOL",
|
||||||
},
|
"name": "identifier"
|
||||||
{
|
},
|
||||||
"type": "SYMBOL",
|
{
|
||||||
"name": "identifier"
|
"type": "SYMBOL",
|
||||||
|
"name": "selected_component"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "string_literal"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "REPEAT",
|
||||||
|
"content": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "|"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "CHOICE",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "identifier"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "selected_component"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "string_literal"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
@ -14749,11 +14796,21 @@
|
||||||
[
|
[
|
||||||
"attribute_definition_clause",
|
"attribute_definition_clause",
|
||||||
"_attribute_reference"
|
"_attribute_reference"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"component_choice_list",
|
||||||
|
"discrete_choice"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"component_choice_list",
|
||||||
|
"positional_array_aggregate"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"precedences": [],
|
"precedences": [],
|
||||||
"externals": [],
|
"externals": [],
|
||||||
"inline": [],
|
"inline": [
|
||||||
|
"_name_not_function_call"
|
||||||
|
],
|
||||||
"supertypes": []
|
"supertypes": []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1599,11 +1599,19 @@
|
||||||
"fields": {},
|
"fields": {},
|
||||||
"children": {
|
"children": {
|
||||||
"multiple": true,
|
"multiple": true,
|
||||||
"required": true,
|
"required": false,
|
||||||
"types": [
|
"types": [
|
||||||
{
|
{
|
||||||
"type": "identifier",
|
"type": "identifier",
|
||||||
"named": true
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "selected_component",
|
||||||
|
"named": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string_literal",
|
||||||
|
"named": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
60770
src/parser.c
60770
src/parser.c
File diff suppressed because it is too large
Load Diff
|
|
@ -44,8 +44,7 @@ end;
|
||||||
(term
|
(term
|
||||||
(numeric_literal))))
|
(numeric_literal))))
|
||||||
(parameter_association
|
(parameter_association
|
||||||
(component_choice_list
|
(component_choice_list)))))
|
||||||
(identifier))))))
|
|
||||||
(formal_subprogram_declaration
|
(formal_subprogram_declaration
|
||||||
(formal_concrete_subprogram_declaration
|
(formal_concrete_subprogram_declaration
|
||||||
(procedure_specification
|
(procedure_specification
|
||||||
|
|
|
||||||
|
|
@ -522,26 +522,26 @@ Subprogram and field access
|
||||||
(numeric_literal))))))
|
(numeric_literal))))))
|
||||||
(identifier)))))))
|
(identifier)))))))
|
||||||
|
|
||||||
===============================
|
================================================================================
|
||||||
Parameterless Procedure call
|
Parameterless Procedure call
|
||||||
===============================
|
================================================================================
|
||||||
|
|
||||||
Proc;
|
Proc;
|
||||||
|
|
||||||
------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(compilation
|
(compilation
|
||||||
(compilation_unit
|
(compilation_unit
|
||||||
(procedure_call_statement
|
(procedure_call_statement
|
||||||
(identifier))))
|
(identifier))))
|
||||||
|
|
||||||
===============================
|
================================================================================
|
||||||
Parameterless Function call
|
Parameterless Function call
|
||||||
===============================
|
================================================================================
|
||||||
|
|
||||||
A := Func;
|
A := Func;
|
||||||
|
|
||||||
------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(compilation
|
(compilation
|
||||||
(compilation_unit
|
(compilation_unit
|
||||||
|
|
@ -550,3 +550,33 @@ A := Func;
|
||||||
(expression
|
(expression
|
||||||
(term
|
(term
|
||||||
(identifier))))))
|
(identifier))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Parameter association for operators
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
package P is new Pack ("+" => "+", "-" => Imported."+");
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(compilation
|
||||||
|
(compilation_unit
|
||||||
|
(generic_instantiation
|
||||||
|
(identifier)
|
||||||
|
(function_call
|
||||||
|
(identifier)
|
||||||
|
(actual_parameter_part
|
||||||
|
(parameter_association
|
||||||
|
(component_choice_list
|
||||||
|
(string_literal))
|
||||||
|
(expression
|
||||||
|
(term
|
||||||
|
(string_literal))))
|
||||||
|
(parameter_association
|
||||||
|
(component_choice_list
|
||||||
|
(string_literal))
|
||||||
|
(expression
|
||||||
|
(term
|
||||||
|
(selected_component
|
||||||
|
(identifier)
|
||||||
|
(string_literal))))))))))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user