Minor cleanups

This commit is contained in:
Emmanuel Briot 2022-10-25 09:53:24 +02:00
parent 464ba8c3da
commit e06723eee2
2 changed files with 129 additions and 93 deletions

View File

@ -1,6 +1,6 @@
======== ================================================================================
access types access types
======== ================================================================================
package P is package P is
type A is access Integer; type A is access Integer;
@ -11,7 +11,7 @@ package P is
type F is access protected function return Boolean; type F is access protected function return Boolean;
end; end;
------- --------------------------------------------------------------------------------
(compilation (compilation
(compilation_unit (compilation_unit
@ -77,3 +77,60 @@ end;
(result_profile (result_profile
(name (name
(identifier)))))))))))) (identifier))))))))))))
================================================================================
Dereference
================================================================================
procedure P is
begin
A := Acc.all;
Proc.all (1);
end;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(proper_body
(subprogram_body
(subprogram_specification
(procedure_specification
(name
(identifier))))
(handled_sequence_of_statements
(sequence_of_statements
(statement
(simple_statement
(assignment_statement
(name
(identifier))
(assign_value
(expression
(relation
(simple_expression
(term
(factor
(primary
(name
(identifier)
(name
(identifier)))))))))))))
(statement
(simple_statement
(procedure_call_statement
(name
(function_call
(name
(identifier)
(name
(identifier)))
(actual_parameter_part
(parameter_association
(expression
(relation
(simple_expression
(term
(factor
(primary
(numeric_literal))))))))))))))))))))

View File

@ -143,19 +143,9 @@ module.exports = grammar({
'\'', // But is not the start of a character_literal '\'', // But is not the start of a character_literal
), ),
// Simpler definition for games than the standard grammer
// name: $ => choice(
// $.explicit_dereference,
// $.selected_component,
// ),
// _direct_name: $ => choice(
// $.identifier,
// $.string_literal,
// ),
_direct_name: $ => $.identifier, _direct_name: $ => $.identifier,
name: $ => choice( name: $ => choice(
seq( seq( // inline selected_component from ada-mode
$._direct_name, $._direct_name,
optional(seq( optional(seq(
'.', '.',
@ -166,6 +156,7 @@ module.exports = grammar({
$.function_call, $.function_call,
$.qualified_expression, $.qualified_expression,
'@', '@',
//$.explicit_dereference, // covered by the first rule above
//$.character_literal, // from adamode, seems wrong. //$.character_literal, // from adamode, seems wrong.
//$.string_literal, // from ada-mode, but seems wrong. //$.string_literal, // from ada-mode, but seems wrong.
// // Added to primary instead // // Added to primary instead
@ -174,18 +165,6 @@ module.exports = grammar({
name_list: $ => comma_separated_list_of($.name), name_list: $ => comma_separated_list_of($.name),
defining_identifier_list: $ => comma_separated_list_of($.identifier), defining_identifier_list: $ => comma_separated_list_of($.identifier),
explicit_dereference: $ => seq(
$.name,
'.',
reservedWord('all'),
),
// ??? Seems to allow 'name.others' as a component
selected_component: $ => seq(
$.name,
'.',
$.selector_name,
),
selector_name: $ => choice( selector_name: $ => choice(
$._direct_name, $._direct_name,
// $.character_literal, // was in ada-mode, moved to primary instead // $.character_literal, // was in ada-mode, moved to primary instead