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, $.component_choice_list],
|
||||
[$.attribute_definition_clause, $._attribute_reference],
|
||||
[$.component_choice_list, $.discrete_choice],
|
||||
[$.component_choice_list, $.positional_array_aggregate],
|
||||
],
|
||||
inline: $ => [
|
||||
$._name_not_function_call,
|
||||
|
|
@ -666,8 +668,14 @@ module.exports = grammar({
|
|||
'=>',
|
||||
$.expression,
|
||||
),
|
||||
component_choice_list: $ =>
|
||||
list_of('|', $.identifier),
|
||||
component_choice_list: $ => choice( // RM 4.3.1
|
||||
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
|
||||
$.record_aggregate,
|
||||
$.extension_aggregate,
|
||||
|
|
|
|||
|
|
@ -3397,27 +3397,74 @@
|
|||
]
|
||||
},
|
||||
"component_choice_list": {
|
||||
"type": "SEQ",
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "identifier"
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
"type": "TOKEN",
|
||||
"content": {
|
||||
"type": "PREC",
|
||||
"value": 2,
|
||||
"content": {
|
||||
"type": "PATTERN",
|
||||
"value": "[oO][tT][hH][eE][rR][sS]"
|
||||
}
|
||||
}
|
||||
},
|
||||
"named": false,
|
||||
"value": "others"
|
||||
},
|
||||
{
|
||||
"type": "REPEAT",
|
||||
"content": {
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "|"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "identifier"
|
||||
"type": "SEQ",
|
||||
"members": [
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"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_reference"
|
||||
],
|
||||
[
|
||||
"component_choice_list",
|
||||
"discrete_choice"
|
||||
],
|
||||
[
|
||||
"component_choice_list",
|
||||
"positional_array_aggregate"
|
||||
]
|
||||
],
|
||||
"precedences": [],
|
||||
"externals": [],
|
||||
"inline": [],
|
||||
"inline": [
|
||||
"_name_not_function_call"
|
||||
],
|
||||
"supertypes": []
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1599,11 +1599,19 @@
|
|||
"fields": {},
|
||||
"children": {
|
||||
"multiple": true,
|
||||
"required": true,
|
||||
"required": false,
|
||||
"types": [
|
||||
{
|
||||
"type": "identifier",
|
||||
"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
|
||||
(numeric_literal))))
|
||||
(parameter_association
|
||||
(component_choice_list
|
||||
(identifier))))))
|
||||
(component_choice_list)))))
|
||||
(formal_subprogram_declaration
|
||||
(formal_concrete_subprogram_declaration
|
||||
(procedure_specification
|
||||
|
|
|
|||
|
|
@ -522,26 +522,26 @@ Subprogram and field access
|
|||
(numeric_literal))))))
|
||||
(identifier)))))))
|
||||
|
||||
===============================
|
||||
================================================================================
|
||||
Parameterless Procedure call
|
||||
===============================
|
||||
================================================================================
|
||||
|
||||
Proc;
|
||||
|
||||
------
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(procedure_call_statement
|
||||
(identifier))))
|
||||
|
||||
===============================
|
||||
================================================================================
|
||||
Parameterless Function call
|
||||
===============================
|
||||
================================================================================
|
||||
|
||||
A := Func;
|
||||
|
||||
------
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
|
|
@ -550,3 +550,33 @@ A := Func;
|
|||
(expression
|
||||
(term
|
||||
(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