Remove selector_name rule

Was a choice() with a single alternative
This commit is contained in:
Emmanuel Briot 2022-10-25 09:58:04 +02:00
parent e06723eee2
commit fb5a2b68b0
4 changed files with 167 additions and 183 deletions

View File

@ -58,8 +58,7 @@ end;
(actual_parameter_part
(parameter_association
(component_choice_list
(selector_name
(identifier)))
(identifier))
(assoc_expression
(expression
(relation
@ -70,8 +69,7 @@ end;
(numeric_literal)))))))))
(parameter_association
(component_choice_list
(selector_name
(identifier)))
(identifier))
(assoc_expression)))))))
(generic_formal_parameter_declaration
(formal_subprogram_declaration

View File

@ -357,16 +357,16 @@ end;
(record_extension_part
(record_definition)))))))))
========
================================================================================
record aggregates
========
================================================================================
procedure P is
begin
A := (F1 => 1, F2 => 2);
end;
-------
--------------------------------------------------------------------------------
(compilation
(compilation_unit
@ -395,8 +395,7 @@ end;
(record_component_association_list
(record_component_association
(component_choice_list
(selector_name
(identifier)))
(identifier))
(assoc_expression
(expression
(relation
@ -407,8 +406,7 @@ end;
(numeric_literal)))))))))
(record_component_association
(component_choice_list
(selector_name
(identifier)))
(identifier))
(assoc_expression
(expression
(relation
@ -418,16 +416,16 @@ end;
(primary
(numeric_literal))))))))))))))))))))))))))))
======
================================================================================
record aggregate extension
======
================================================================================
procedure P is
begin
A := (B with F3 => 2);
end;
---------
--------------------------------------------------------------------------------
(compilation
(compilation_unit
@ -464,8 +462,7 @@ end;
(record_component_association_list
(record_component_association
(component_choice_list
(selector_name
(identifier)))
(identifier))
(assoc_expression
(expression
(relation
@ -475,16 +472,16 @@ end;
(primary
(numeric_literal))))))))))))))))))))))))))))
======
================================================================================
record delta aggregate
======
================================================================================
procedure P is
begin
A := (B with delta F3 => 2);
end;
-------
--------------------------------------------------------------------------------
(compilation
(compilation_unit
@ -522,8 +519,7 @@ end;
(record_component_association_list
(record_component_association
(component_choice_list
(selector_name
(identifier)))
(identifier))
(assoc_expression
(expression
(relation

View File

@ -228,8 +228,7 @@ end F;
(record_component_association_list
(record_component_association
(component_choice_list
(selector_name
(identifier)))
(identifier))
(assoc_expression
(expression
(relation
@ -390,8 +389,7 @@ end;
(actual_parameter_part
(parameter_association
(component_choice_list
(selector_name
(identifier)))
(identifier))
(assoc_expression
(expression
(relation
@ -574,8 +572,7 @@ end;
(actual_parameter_part
(parameter_association
(component_choice_list
(selector_name
(identifier)))
(identifier))
(assoc_expression
(expression
(relation
@ -702,8 +699,7 @@ end;
(record_component_association_list
(record_component_association
(component_choice_list
(selector_name
(identifier)))
(identifier))
(assoc_expression
(expression
(relation

View File

@ -50,9 +50,9 @@ module.exports = grammar({
// specified in at_clause.
[$.at_clause, $.name],
// name ':=' '(' _direct_name . '=>'
// Where the direct_name could be a name or selector_name
[$.name, $.selector_name],
// 'case' '(' _direct_name . '=>' ...
// ??? Invalid Ada
[$.name, $.component_choice_list],
// name ':=' '(' expression . ',' ...
[$.expression_list, $.record_component_association],
@ -111,7 +111,6 @@ module.exports = grammar({
[$.function_call, $.procedure_call_statement],
[$.function_call, $.name],
[$.selector_name, $.primary],
[$.formal_derived_type_definition],
[$._direct_name, $.aspect_mark],
[$.name, $.attribute_reference, $.qualified_expression],
@ -165,11 +164,6 @@ module.exports = grammar({
name_list: $ => comma_separated_list_of($.name),
defining_identifier_list: $ => comma_separated_list_of($.identifier),
selector_name: $ => choice(
$._direct_name,
// $.character_literal, // was in ada-mode, moved to primary instead
// reservedWord('others'),
),
attribute_reference: $ => choice(
seq(
$.name,
@ -641,7 +635,7 @@ module.exports = grammar({
$._non_default_assoc_expression,
),
component_choice_list: $ =>
list_of('|', $.selector_name),
list_of('|', $._direct_name),
aggregate: $ => choice(
$.record_aggregate,
$.extension_aggregate,