Minor cleanups
This commit is contained in:
parent
464ba8c3da
commit
e06723eee2
|
|
@ -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,69 +11,126 @@ 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
|
||||||
(package_specification
|
(package_specification
|
||||||
(name
|
(name
|
||||||
(identifier))
|
(identifier))
|
||||||
(type_declaration
|
(type_declaration
|
||||||
(full_type_declaration
|
(full_type_declaration
|
||||||
(identifier)
|
(identifier)
|
||||||
(type_definition
|
(type_definition
|
||||||
(access_type_definition
|
(access_type_definition
|
||||||
(access_to_object_definition
|
(access_to_object_definition
|
||||||
(subtype_indication
|
(subtype_indication
|
||||||
|
(name
|
||||||
|
(identifier))))))))
|
||||||
|
(type_declaration
|
||||||
|
(full_type_declaration
|
||||||
|
(identifier)
|
||||||
|
(type_definition
|
||||||
|
(access_type_definition
|
||||||
|
(access_to_object_definition
|
||||||
|
(subtype_indication
|
||||||
|
(null_exclusion)
|
||||||
|
(name
|
||||||
|
(identifier))))))))
|
||||||
|
(type_declaration
|
||||||
|
(full_type_declaration
|
||||||
|
(identifier)
|
||||||
|
(type_definition
|
||||||
|
(access_type_definition
|
||||||
|
(access_to_object_definition
|
||||||
|
(general_access_modifier)
|
||||||
|
(subtype_indication
|
||||||
|
(name
|
||||||
|
(identifier))))))))
|
||||||
|
(type_declaration
|
||||||
|
(full_type_declaration
|
||||||
|
(identifier)
|
||||||
|
(type_definition
|
||||||
|
(access_type_definition
|
||||||
|
(access_to_object_definition
|
||||||
|
(general_access_modifier)
|
||||||
|
(subtype_indication
|
||||||
|
(name
|
||||||
|
(identifier))))))))
|
||||||
|
(type_declaration
|
||||||
|
(full_type_declaration
|
||||||
|
(identifier)
|
||||||
|
(type_definition
|
||||||
|
(access_type_definition
|
||||||
|
(access_to_subprogram_definition
|
||||||
|
(parameter_and_result_profile
|
||||||
|
(result_profile
|
||||||
|
(name
|
||||||
|
(identifier)))))))))
|
||||||
|
(type_declaration
|
||||||
|
(full_type_declaration
|
||||||
|
(identifier)
|
||||||
|
(type_definition
|
||||||
|
(access_type_definition
|
||||||
|
(access_to_subprogram_definition
|
||||||
|
(parameter_and_result_profile
|
||||||
|
(result_profile
|
||||||
|
(name
|
||||||
|
(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
|
(name
|
||||||
(identifier))))))))
|
(identifier)
|
||||||
(type_declaration
|
|
||||||
(full_type_declaration
|
|
||||||
(identifier)
|
|
||||||
(type_definition
|
|
||||||
(access_type_definition
|
|
||||||
(access_to_object_definition
|
|
||||||
(subtype_indication
|
|
||||||
(null_exclusion)
|
|
||||||
(name
|
|
||||||
(identifier))))))))
|
|
||||||
(type_declaration
|
|
||||||
(full_type_declaration
|
|
||||||
(identifier)
|
|
||||||
(type_definition
|
|
||||||
(access_type_definition
|
|
||||||
(access_to_object_definition
|
|
||||||
(general_access_modifier)
|
|
||||||
(subtype_indication
|
|
||||||
(name
|
|
||||||
(identifier))))))))
|
|
||||||
(type_declaration
|
|
||||||
(full_type_declaration
|
|
||||||
(identifier)
|
|
||||||
(type_definition
|
|
||||||
(access_type_definition
|
|
||||||
(access_to_object_definition
|
|
||||||
(general_access_modifier)
|
|
||||||
(subtype_indication
|
|
||||||
(name
|
|
||||||
(identifier))))))))
|
|
||||||
(type_declaration
|
|
||||||
(full_type_declaration
|
|
||||||
(identifier)
|
|
||||||
(type_definition
|
|
||||||
(access_type_definition
|
|
||||||
(access_to_subprogram_definition
|
|
||||||
(parameter_and_result_profile
|
|
||||||
(result_profile
|
|
||||||
(name
|
(name
|
||||||
(identifier)))))))))
|
(identifier)))
|
||||||
(type_declaration
|
(actual_parameter_part
|
||||||
(full_type_declaration
|
(parameter_association
|
||||||
(identifier)
|
(expression
|
||||||
(type_definition
|
(relation
|
||||||
(access_type_definition
|
(simple_expression
|
||||||
(access_to_subprogram_definition
|
(term
|
||||||
(parameter_and_result_profile
|
(factor
|
||||||
(result_profile
|
(primary
|
||||||
(name
|
(numeric_literal))))))))))))))))))))
|
||||||
(identifier))))))))))))
|
|
||||||
|
|
|
||||||
35
grammar.js
35
grammar.js
|
|
@ -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,30 +156,19 @@ module.exports = grammar({
|
||||||
$.function_call,
|
$.function_call,
|
||||||
$.qualified_expression,
|
$.qualified_expression,
|
||||||
'@',
|
'@',
|
||||||
//$.character_literal, // from adamode, seems wrong.
|
//$.explicit_dereference, // covered by the first rule above
|
||||||
//$.string_literal, // from ada-mode, but seems wrong.
|
//$.character_literal, // from adamode, seems wrong.
|
||||||
// // Added to primary instead
|
//$.string_literal, // from ada-mode, but seems wrong.
|
||||||
|
// // Added to primary instead
|
||||||
),
|
),
|
||||||
|
|
||||||
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
|
||||||
// reservedWord('others'),
|
// reservedWord('others'),
|
||||||
),
|
),
|
||||||
attribute_reference: $ => choice(
|
attribute_reference: $ => choice(
|
||||||
seq(
|
seq(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user