Support for allocators
This commit is contained in:
parent
d440b2e820
commit
6f6cac7c84
|
|
@ -624,3 +624,91 @@ end;
|
|||
(statement
|
||||
(simple_statement
|
||||
(null_statement))))))))))))))
|
||||
|
||||
================================================================================
|
||||
Allocators
|
||||
================================================================================
|
||||
|
||||
procedure P is
|
||||
begin
|
||||
A := new T;
|
||||
A := new (pkg.pool) T'((F => 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
|
||||
(allocator
|
||||
(subtype_indication_paren_constraint
|
||||
(name
|
||||
(identifier))))))))))))))
|
||||
(statement
|
||||
(simple_statement
|
||||
(assignment_statement
|
||||
(name
|
||||
(identifier))
|
||||
(assign_value
|
||||
(expression
|
||||
(relation
|
||||
(simple_expression
|
||||
(term
|
||||
(factor
|
||||
(primary
|
||||
(allocator
|
||||
(subpool_specification
|
||||
(name
|
||||
(identifier)
|
||||
(name
|
||||
(identifier))))
|
||||
(subtype_indication_paren_constraint
|
||||
(name
|
||||
(qualified_expression
|
||||
(name
|
||||
(identifier))
|
||||
(tick)
|
||||
(aggregate
|
||||
(record_aggregate
|
||||
(record_component_association_list
|
||||
(record_component_association
|
||||
(expression
|
||||
(relation
|
||||
(simple_expression
|
||||
(term
|
||||
(factor
|
||||
(primary
|
||||
(aggregate
|
||||
(record_aggregate
|
||||
(record_component_association_list
|
||||
(record_component_association
|
||||
(component_choice_list
|
||||
(selector_name
|
||||
(identifier)))
|
||||
(assoc_expression
|
||||
(expression
|
||||
(relation
|
||||
(simple_expression
|
||||
(term
|
||||
(factor
|
||||
(primary
|
||||
(numeric_literal))))))))))))))))))))))))))))))))))))))))))
|
||||
|
|
|
|||
29
grammar.js
29
grammar.js
|
|
@ -110,6 +110,7 @@ module.exports = grammar({
|
|||
[$.selector_name, $.primary],
|
||||
[$.formal_derived_type_definition],
|
||||
[$._direct_name, $.aspect_mark],
|
||||
[$.name, $.attribute_reference, $.qualified_expression],
|
||||
|
||||
],
|
||||
|
||||
|
|
@ -145,10 +146,6 @@ module.exports = grammar({
|
|||
// name: $ => choice(
|
||||
// $.explicit_dereference,
|
||||
// $.selected_component,
|
||||
// $.function_call,
|
||||
// $.character_literal,
|
||||
// $.qualified_expression,
|
||||
// '@',
|
||||
// ),
|
||||
// _direct_name: $ => choice(
|
||||
// $.identifier,
|
||||
|
|
@ -166,8 +163,11 @@ module.exports = grammar({
|
|||
),
|
||||
$.attribute_reference,
|
||||
$.function_call,
|
||||
//$.string_literal, // from ada-mode, but seems wrong.
|
||||
// // Added to primary instead
|
||||
$.qualified_expression,
|
||||
'@',
|
||||
//$.character_literal, // from adamode, seems wrong.
|
||||
//$.string_literal, // from ada-mode, but seems wrong.
|
||||
// // Added to primary instead
|
||||
),
|
||||
|
||||
name_list: $ => comma_separated_list_of($.name),
|
||||
|
|
@ -517,7 +517,22 @@ module.exports = grammar({
|
|||
$.name,
|
||||
$.string_literal, // ada-mode puts this in name instead
|
||||
$.character_literal,
|
||||
// $.allocator,
|
||||
$.allocator,
|
||||
),
|
||||
allocator: $ => seq(
|
||||
reservedWord('new'),
|
||||
optional($.subpool_specification),
|
||||
$.subtype_indication_paren_constraint,
|
||||
),
|
||||
subtype_indication_paren_constraint: $ => seq(
|
||||
optional($.null_exclusion),
|
||||
$.name,
|
||||
optional($.index_constraint),
|
||||
),
|
||||
subpool_specification: $ => seq(
|
||||
'(',
|
||||
$.name,
|
||||
')',
|
||||
),
|
||||
access_type_definition: $ => seq(
|
||||
optional($.null_exclusion),
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user