Support for allocators
This commit is contained in:
parent
d440b2e820
commit
6f6cac7c84
|
|
@ -624,3 +624,91 @@ end;
|
||||||
(statement
|
(statement
|
||||||
(simple_statement
|
(simple_statement
|
||||||
(null_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))))))))))))))))))))))))))))))))))))))))))
|
||||||
|
|
|
||||||
25
grammar.js
25
grammar.js
|
|
@ -110,6 +110,7 @@ module.exports = grammar({
|
||||||
[$.selector_name, $.primary],
|
[$.selector_name, $.primary],
|
||||||
[$.formal_derived_type_definition],
|
[$.formal_derived_type_definition],
|
||||||
[$._direct_name, $.aspect_mark],
|
[$._direct_name, $.aspect_mark],
|
||||||
|
[$.name, $.attribute_reference, $.qualified_expression],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
@ -145,10 +146,6 @@ module.exports = grammar({
|
||||||
// name: $ => choice(
|
// name: $ => choice(
|
||||||
// $.explicit_dereference,
|
// $.explicit_dereference,
|
||||||
// $.selected_component,
|
// $.selected_component,
|
||||||
// $.function_call,
|
|
||||||
// $.character_literal,
|
|
||||||
// $.qualified_expression,
|
|
||||||
// '@',
|
|
||||||
// ),
|
// ),
|
||||||
// _direct_name: $ => choice(
|
// _direct_name: $ => choice(
|
||||||
// $.identifier,
|
// $.identifier,
|
||||||
|
|
@ -166,6 +163,9 @@ module.exports = grammar({
|
||||||
),
|
),
|
||||||
$.attribute_reference,
|
$.attribute_reference,
|
||||||
$.function_call,
|
$.function_call,
|
||||||
|
$.qualified_expression,
|
||||||
|
'@',
|
||||||
|
//$.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
|
||||||
),
|
),
|
||||||
|
|
@ -517,7 +517,22 @@ module.exports = grammar({
|
||||||
$.name,
|
$.name,
|
||||||
$.string_literal, // ada-mode puts this in name instead
|
$.string_literal, // ada-mode puts this in name instead
|
||||||
$.character_literal,
|
$.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(
|
access_type_definition: $ => seq(
|
||||||
optional($.null_exclusion),
|
optional($.null_exclusion),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user