Range attribute
This commit is contained in:
parent
434dc1a695
commit
464ba8c3da
89
corpus/attributes.txt
Normal file
89
corpus/attributes.txt
Normal file
|
|
@ -0,0 +1,89 @@
|
||||||
|
================================================================================
|
||||||
|
Range attribute
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
procedure P is
|
||||||
|
A : MyArray (B'Range (1));
|
||||||
|
begin
|
||||||
|
for E in Arr'Range loop
|
||||||
|
null;
|
||||||
|
end loop;
|
||||||
|
for E in Arr'Range (1) loop
|
||||||
|
null;
|
||||||
|
end loop;
|
||||||
|
end;
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(compilation
|
||||||
|
(compilation_unit
|
||||||
|
(proper_body
|
||||||
|
(subprogram_body
|
||||||
|
(subprogram_specification
|
||||||
|
(procedure_specification
|
||||||
|
(name
|
||||||
|
(identifier))))
|
||||||
|
(non_empty_declarative_part
|
||||||
|
(declarative_item_pragma
|
||||||
|
(object_declaration
|
||||||
|
(defining_identifier_list
|
||||||
|
(identifier))
|
||||||
|
(subtype_indication
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(constraint
|
||||||
|
(index_constraint
|
||||||
|
(discrete_range
|
||||||
|
(range_g
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(tick)
|
||||||
|
(range_attribute_designator
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(numeric_literal))))))))))))))))
|
||||||
|
(handled_sequence_of_statements
|
||||||
|
(sequence_of_statements
|
||||||
|
(statement
|
||||||
|
(compound_statement
|
||||||
|
(loop_statement
|
||||||
|
(iteration_scheme
|
||||||
|
(loop_parameter_specification
|
||||||
|
(identifier)
|
||||||
|
(discrete_subtype_definition
|
||||||
|
(range_g
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(tick)
|
||||||
|
(range_attribute_designator)))))
|
||||||
|
(sequence_of_statements
|
||||||
|
(statement
|
||||||
|
(simple_statement
|
||||||
|
(null_statement)))))))
|
||||||
|
(statement
|
||||||
|
(compound_statement
|
||||||
|
(loop_statement
|
||||||
|
(iteration_scheme
|
||||||
|
(loop_parameter_specification
|
||||||
|
(identifier)
|
||||||
|
(discrete_subtype_definition
|
||||||
|
(range_g
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(tick)
|
||||||
|
(range_attribute_designator
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(numeric_literal))))))))))))
|
||||||
|
(sequence_of_statements
|
||||||
|
(statement
|
||||||
|
(simple_statement
|
||||||
|
(null_statement)))))))))))))
|
||||||
|
|
@ -91,15 +91,15 @@ end P;
|
||||||
(iteration_scheme
|
(iteration_scheme
|
||||||
(iterator_specification
|
(iterator_specification
|
||||||
(identifier)
|
(identifier)
|
||||||
(name
|
|
||||||
(attribute_reference
|
|
||||||
(name
|
(name
|
||||||
(identifier)
|
(identifier)
|
||||||
(name
|
(name
|
||||||
(identifier)))
|
(attribute_reference
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
(tick)
|
(tick)
|
||||||
(attribute_designator
|
(attribute_designator
|
||||||
(identifier))))))
|
(identifier)))))))
|
||||||
(sequence_of_statements
|
(sequence_of_statements
|
||||||
(statement
|
(statement
|
||||||
(simple_statement
|
(simple_statement
|
||||||
|
|
|
||||||
60
grammar.js
60
grammar.js
|
|
@ -105,6 +105,10 @@ module.exports = grammar({
|
||||||
// 'type' identifier 'is' 'new' subtype_indication . 'with' .
|
// 'type' identifier 'is' 'new' subtype_indication . 'with' .
|
||||||
[$.private_extension_declaration, $.derived_type_definition],
|
[$.private_extension_declaration, $.derived_type_definition],
|
||||||
|
|
||||||
|
// subprogram_specification
|
||||||
|
// 'with' aspect_mark '=>' 'do' name '(' name . ')'
|
||||||
|
[$.primary, $.dispatching_operation_specifier],
|
||||||
|
|
||||||
[$.function_call, $.procedure_call_statement],
|
[$.function_call, $.procedure_call_statement],
|
||||||
[$.function_call, $.name],
|
[$.function_call, $.name],
|
||||||
[$.selector_name, $.primary],
|
[$.selector_name, $.primary],
|
||||||
|
|
@ -418,13 +422,25 @@ module.exports = grammar({
|
||||||
$.delta_constraint,
|
$.delta_constraint,
|
||||||
),
|
),
|
||||||
range_g: $ => choice(
|
range_g: $ => choice(
|
||||||
// $.range_attribute_reference,
|
field('range_attribute_reference', seq(
|
||||||
|
$.name,
|
||||||
|
$.tick,
|
||||||
|
$.range_attribute_designator,
|
||||||
|
)),
|
||||||
seq(
|
seq(
|
||||||
$.simple_expression,
|
$.simple_expression,
|
||||||
'..',
|
'..',
|
||||||
$.simple_expression,
|
$.simple_expression,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
range_attribute_designator: $ => seq(
|
||||||
|
reservedWord('range'),
|
||||||
|
optional(seq(
|
||||||
|
'(',
|
||||||
|
$.expression,
|
||||||
|
')',
|
||||||
|
)),
|
||||||
|
),
|
||||||
range_constraint: $ => seq(
|
range_constraint: $ => seq(
|
||||||
reservedWord('range'),
|
reservedWord('range'),
|
||||||
$.range_g,
|
$.range_g,
|
||||||
|
|
@ -1561,12 +1577,50 @@ module.exports = grammar({
|
||||||
optional($.aspect_specification),
|
optional($.aspect_specification),
|
||||||
';',
|
';',
|
||||||
),
|
),
|
||||||
|
formal_group_designator: $ => choice(
|
||||||
|
'null',
|
||||||
|
'all',
|
||||||
|
),
|
||||||
|
extended_global_aspect_definition: $ => choice(
|
||||||
|
seq(
|
||||||
|
reservedWord('use'),
|
||||||
|
field('formal_parameter_designator', choice(
|
||||||
|
$.formal_group_designator,
|
||||||
|
$.name,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
seq(
|
||||||
|
reservedWord('do'),
|
||||||
|
$.dispatching_operation_specifier,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
disaptching_operation_set: $ =>
|
||||||
|
comma_separated_list_of($.dispatching_operation_specifier),
|
||||||
|
dispatching_operation_specifier: $ => seq(
|
||||||
|
$.name,
|
||||||
|
'(',
|
||||||
|
$.name,
|
||||||
|
')',
|
||||||
|
),
|
||||||
|
extended_global_aspect_element: $ => choice(
|
||||||
|
seq(
|
||||||
|
reservedWord('use'),
|
||||||
|
field('formal_parameter_set', choice(
|
||||||
|
$.formal_group_designator,
|
||||||
|
comma_separated_list_of($.name),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
seq(
|
||||||
|
reservedWord('do'),
|
||||||
|
comma_separated_list_of($.dispatching_operation_specifier),
|
||||||
|
),
|
||||||
|
),
|
||||||
global_aspect_definition: $ => choice(
|
global_aspect_definition: $ => choice(
|
||||||
seq(
|
seq(
|
||||||
$.global_mode,
|
$.global_mode,
|
||||||
// $.global_designator,
|
// $.global_designator,
|
||||||
),
|
),
|
||||||
// $.extended_global_aspect_definition,
|
$.extended_global_aspect_definition,
|
||||||
seq(
|
seq(
|
||||||
'(',
|
'(',
|
||||||
comma_separated_list_of($.global_aspect_element),
|
comma_separated_list_of($.global_aspect_element),
|
||||||
|
|
@ -1578,7 +1632,7 @@ module.exports = grammar({
|
||||||
$.global_mode,
|
$.global_mode,
|
||||||
$.global_set,
|
$.global_set,
|
||||||
),
|
),
|
||||||
// $.extended_global_aspect_definition,
|
$.extended_global_aspect_definition,
|
||||||
),
|
),
|
||||||
global_mode: $ => choice(
|
global_mode: $ => choice(
|
||||||
$.non_empty_mode,
|
$.non_empty_mode,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user