Initial support for subprograms
This commit is contained in:
parent
5e5c9f5bc6
commit
8e44c8bc3b
|
|
@ -26,9 +26,9 @@ records
|
||||||
|
|
||||||
package P is
|
package P is
|
||||||
type R2 is record
|
type R2 is record
|
||||||
A : Integer;
|
A : aliased Integer;
|
||||||
-- B : Integer range 0 .. 2;
|
B : Integer range 0 .. 2;
|
||||||
-- null;
|
C, D : not null access Integer;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
for R2 use record
|
for R2 use record
|
||||||
|
|
@ -57,9 +57,39 @@ end;
|
||||||
(component_definition
|
(component_definition
|
||||||
(subtype_indication
|
(subtype_indication
|
||||||
(name
|
(name
|
||||||
(identifier)))))))
|
(identifier))))))
|
||||||
(comment)
|
(component_item
|
||||||
(comment))))))
|
(component_declaration
|
||||||
|
(defining_identifier_list
|
||||||
|
(identifier))
|
||||||
|
(component_definition
|
||||||
|
(subtype_indication
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(constraint
|
||||||
|
(scalar_constraint
|
||||||
|
(range_constraint
|
||||||
|
(range_g
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(numeric_literal)))))
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(numeric_literal)))))))))))))
|
||||||
|
(component_item
|
||||||
|
(component_declaration
|
||||||
|
(defining_identifier_list
|
||||||
|
(identifier)
|
||||||
|
(identifier))
|
||||||
|
(component_definition
|
||||||
|
(access_definition
|
||||||
|
(null_exclusion)
|
||||||
|
(name
|
||||||
|
(identifier))))))))))))
|
||||||
(aspect_clause
|
(aspect_clause
|
||||||
(record_representation_clause
|
(record_representation_clause
|
||||||
(name
|
(name
|
||||||
|
|
@ -225,7 +255,7 @@ end;
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(compilation
|
(compilation
|
||||||
(compilation_unit
|
(compilation_unit
|
||||||
(package_specification
|
(package_specification
|
||||||
(name
|
(name
|
||||||
|
|
@ -286,7 +316,6 @@ end;
|
||||||
(identifier)))))
|
(identifier)))))
|
||||||
(component_list)))))))))))))
|
(component_list)))))))))))))
|
||||||
|
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
interface
|
interface
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
@ -299,7 +328,7 @@ end;
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(compilation
|
(compilation
|
||||||
(compilation_unit
|
(compilation_unit
|
||||||
(package_specification
|
(package_specification
|
||||||
(name
|
(name
|
||||||
|
|
|
||||||
448
corpus/subprograms.txt
Normal file
448
corpus/subprograms.txt
Normal file
|
|
@ -0,0 +1,448 @@
|
||||||
|
================================================================================
|
||||||
|
null procedure
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
package P is
|
||||||
|
procedure A is null;
|
||||||
|
overriding procedure B is null;
|
||||||
|
procedure B is null with Inline;
|
||||||
|
end;
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(compilation
|
||||||
|
(compilation_unit
|
||||||
|
(package_specification
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(null_procedure_declaration
|
||||||
|
(procedure_specification
|
||||||
|
(name
|
||||||
|
(identifier))))
|
||||||
|
(null_procedure_declaration
|
||||||
|
(overriding_indicator)
|
||||||
|
(procedure_specification
|
||||||
|
(name
|
||||||
|
(identifier))))
|
||||||
|
(null_procedure_declaration
|
||||||
|
(procedure_specification
|
||||||
|
(name
|
||||||
|
(identifier)))
|
||||||
|
(aspect_specification
|
||||||
|
(aspect_mark_list
|
||||||
|
(aspect_association
|
||||||
|
(aspect_mark
|
||||||
|
(identifier)))))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
procedures
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
package P is
|
||||||
|
procedure A (P1, P2 : Integer; P3 : Float)
|
||||||
|
with Inline;
|
||||||
|
procedure B is abstract;
|
||||||
|
procedure C is abstract with Inline;
|
||||||
|
end;
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(compilation
|
||||||
|
(compilation_unit
|
||||||
|
(package_specification
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(subprogram_declaration
|
||||||
|
(subprogram_specification
|
||||||
|
(procedure_specification
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(non_empty_parameter_profile
|
||||||
|
(formal_part
|
||||||
|
(parameter_specification_list
|
||||||
|
(parameter_specification
|
||||||
|
(defining_identifier_list
|
||||||
|
(identifier)
|
||||||
|
(identifier))
|
||||||
|
(name
|
||||||
|
(identifier)))
|
||||||
|
(parameter_specification
|
||||||
|
(defining_identifier_list
|
||||||
|
(identifier))
|
||||||
|
(name
|
||||||
|
(identifier))))))))
|
||||||
|
(aspect_specification
|
||||||
|
(aspect_mark_list
|
||||||
|
(aspect_association
|
||||||
|
(aspect_mark
|
||||||
|
(identifier))))))
|
||||||
|
(abstract_subprogram_declaration
|
||||||
|
(subprogram_specification
|
||||||
|
(procedure_specification
|
||||||
|
(name
|
||||||
|
(identifier)))))
|
||||||
|
(abstract_subprogram_declaration
|
||||||
|
(subprogram_specification
|
||||||
|
(procedure_specification
|
||||||
|
(name
|
||||||
|
(identifier))))
|
||||||
|
(aspect_specification
|
||||||
|
(aspect_mark_list
|
||||||
|
(aspect_association
|
||||||
|
(aspect_mark
|
||||||
|
(identifier)))))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
functions
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
package P is
|
||||||
|
function F (A, B : Integer) return not null access Integer
|
||||||
|
with Inline, Convention => C;
|
||||||
|
end;
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(compilation
|
||||||
|
(compilation_unit
|
||||||
|
(package_specification
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(subprogram_declaration
|
||||||
|
(subprogram_specification
|
||||||
|
(function_specification
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(parameter_and_result_profile
|
||||||
|
(formal_part
|
||||||
|
(parameter_specification_list
|
||||||
|
(parameter_specification
|
||||||
|
(defining_identifier_list
|
||||||
|
(identifier)
|
||||||
|
(identifier))
|
||||||
|
(name
|
||||||
|
(identifier)))))
|
||||||
|
(result_profile
|
||||||
|
(access_definition
|
||||||
|
(null_exclusion)
|
||||||
|
(name
|
||||||
|
(identifier)))))))
|
||||||
|
(aspect_specification
|
||||||
|
(aspect_mark_list
|
||||||
|
(aspect_association
|
||||||
|
(aspect_mark
|
||||||
|
(identifier)))
|
||||||
|
(aspect_association
|
||||||
|
(aspect_mark
|
||||||
|
(identifier))
|
||||||
|
(aspect_definition
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(name
|
||||||
|
(identifier))))))))))))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
subprogram body
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
package body P is
|
||||||
|
procedure A (B : Integer) is
|
||||||
|
V : Integer;
|
||||||
|
begin
|
||||||
|
null;
|
||||||
|
end A;
|
||||||
|
end;
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(compilation
|
||||||
|
(compilation_unit
|
||||||
|
(proper_body
|
||||||
|
(package_body
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(non_empty_declarative_part
|
||||||
|
(declarative_item_pragma
|
||||||
|
(proper_body
|
||||||
|
(subprogram_body
|
||||||
|
(subprogram_specification
|
||||||
|
(procedure_specification
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(non_empty_parameter_profile
|
||||||
|
(formal_part
|
||||||
|
(parameter_specification_list
|
||||||
|
(parameter_specification
|
||||||
|
(defining_identifier_list
|
||||||
|
(identifier))
|
||||||
|
(name
|
||||||
|
(identifier))))))))
|
||||||
|
(non_empty_declarative_part
|
||||||
|
(declarative_item_pragma
|
||||||
|
(object_declaration
|
||||||
|
(defining_identifier_list
|
||||||
|
(identifier))
|
||||||
|
(subtype_indication
|
||||||
|
(name
|
||||||
|
(identifier))))))
|
||||||
|
(handled_sequence_of_statements
|
||||||
|
(sequence_of_statements
|
||||||
|
(statement
|
||||||
|
(simple_statement
|
||||||
|
(null_statement)))))
|
||||||
|
(name
|
||||||
|
(identifier))))))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
expression function membership
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
function F2 (A : Integer) return Boolean
|
||||||
|
is (A not in Small_Integer);
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(compilation
|
||||||
|
(compilation_unit
|
||||||
|
(expression_function_declaration
|
||||||
|
(function_specification
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(parameter_and_result_profile
|
||||||
|
(formal_part
|
||||||
|
(parameter_specification_list
|
||||||
|
(parameter_specification
|
||||||
|
(defining_identifier_list
|
||||||
|
(identifier))
|
||||||
|
(name
|
||||||
|
(identifier)))))
|
||||||
|
(result_profile
|
||||||
|
(name
|
||||||
|
(identifier)))))
|
||||||
|
(aggregate
|
||||||
|
(array_aggregate
|
||||||
|
(positional_array_aggregate
|
||||||
|
(expression_list
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(name
|
||||||
|
(identifier))))))
|
||||||
|
(membership_choice_list
|
||||||
|
(membership_choice
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(name
|
||||||
|
(identifier)))))))))))))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Expression function raise
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
function F3 return Boolean
|
||||||
|
is (raise Constraint_Error);
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(compilation
|
||||||
|
(compilation_unit
|
||||||
|
(expression_function_declaration
|
||||||
|
(function_specification
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(parameter_and_result_profile
|
||||||
|
(result_profile
|
||||||
|
(name
|
||||||
|
(identifier)))))
|
||||||
|
(aggregate
|
||||||
|
(array_aggregate
|
||||||
|
(positional_array_aggregate
|
||||||
|
(expression_list
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(raise_expression
|
||||||
|
(name
|
||||||
|
(identifier))))))))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Expression function simple
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
function F4 return Boolean is (True);
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(compilation
|
||||||
|
(compilation_unit
|
||||||
|
(expression_function_declaration
|
||||||
|
(function_specification
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(parameter_and_result_profile
|
||||||
|
(result_profile
|
||||||
|
(name
|
||||||
|
(identifier)))))
|
||||||
|
(aggregate
|
||||||
|
(array_aggregate
|
||||||
|
(positional_array_aggregate
|
||||||
|
(expression_list
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(name
|
||||||
|
(identifier)))))))))))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Expression function if
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
function F (A : Integer) return Boolean
|
||||||
|
is (if A = 0 or A = 1 then True else False);
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(compilation
|
||||||
|
(compilation_unit
|
||||||
|
(expression_function_declaration
|
||||||
|
(function_specification
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(parameter_and_result_profile
|
||||||
|
(formal_part
|
||||||
|
(parameter_specification_list
|
||||||
|
(parameter_specification
|
||||||
|
(defining_identifier_list
|
||||||
|
(identifier))
|
||||||
|
(name
|
||||||
|
(identifier)))))
|
||||||
|
(result_profile
|
||||||
|
(name
|
||||||
|
(identifier)))))
|
||||||
|
(aggregate
|
||||||
|
(conditional_expression
|
||||||
|
(if_expression
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(name
|
||||||
|
(identifier))))))
|
||||||
|
(relational_operator)
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(numeric_literal))))))
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(name
|
||||||
|
(identifier))))))
|
||||||
|
(relational_operator)
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(numeric_literal)))))))
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(name
|
||||||
|
(identifier))))))))
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(name
|
||||||
|
(identifier))))))))))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Expression function if extra parenthesis
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
function F5 (A : Integer) return Boolean
|
||||||
|
is ((if A = 0 then True else False));
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(compilation
|
||||||
|
(compilation_unit
|
||||||
|
(expression_function_declaration
|
||||||
|
(function_specification
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(parameter_and_result_profile
|
||||||
|
(formal_part
|
||||||
|
(parameter_specification_list
|
||||||
|
(parameter_specification
|
||||||
|
(defining_identifier_list
|
||||||
|
(identifier))
|
||||||
|
(name
|
||||||
|
(identifier)))))
|
||||||
|
(result_profile
|
||||||
|
(name
|
||||||
|
(identifier)))))
|
||||||
|
(aggregate
|
||||||
|
(array_aggregate
|
||||||
|
(positional_array_aggregate
|
||||||
|
(expression_list
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(aggregate
|
||||||
|
(conditional_expression
|
||||||
|
(if_expression
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(name
|
||||||
|
(identifier))))))
|
||||||
|
(relational_operator)
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(numeric_literal)))))))
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(name
|
||||||
|
(identifier))))))))
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(name
|
||||||
|
(identifier))))))))))))))))))))))))
|
||||||
145
grammar.js
145
grammar.js
|
|
@ -75,6 +75,10 @@ module.exports = grammar({
|
||||||
// 'for' name 'use' '(' 'for' identifier 'in' name . 'use'
|
// 'for' name 'use' '(' 'for' identifier 'in' name . 'use'
|
||||||
[$.iterator_specification, $.subtype_indication],
|
[$.iterator_specification, $.subtype_indication],
|
||||||
|
|
||||||
|
// 'type' identifier 'is' 'mod' 'raise' name . 'with' ...
|
||||||
|
// ??? This appears legal Ada per the grammar, but doesn't make sense.
|
||||||
|
// ??? This results in a large slowdown of the parser
|
||||||
|
[$.raise_expression],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
@ -326,11 +330,23 @@ module.exports = grammar({
|
||||||
$.proper_body,
|
$.proper_body,
|
||||||
),
|
),
|
||||||
proper_body: $ => choice(
|
proper_body: $ => choice(
|
||||||
// $.subprogram_body,
|
$.subprogram_body,
|
||||||
$.package_body,
|
$.package_body,
|
||||||
// $.task_body,
|
// $.task_body,
|
||||||
// $.protected_body,
|
// $.protected_body,
|
||||||
),
|
),
|
||||||
|
subprogram_body: $ => seq(
|
||||||
|
optional($.overriding_indicator),
|
||||||
|
$.subprogram_specification,
|
||||||
|
optional($.aspect_specification),
|
||||||
|
reservedWord('is'),
|
||||||
|
optional($.non_empty_declarative_part),
|
||||||
|
reservedWord('begin'),
|
||||||
|
$.handled_sequence_of_statements,
|
||||||
|
reservedWord('end'),
|
||||||
|
optional($.name),
|
||||||
|
';'
|
||||||
|
),
|
||||||
package_body: $ => seq(
|
package_body: $ => seq(
|
||||||
reservedWord('package'),
|
reservedWord('package'),
|
||||||
reservedWord('body'),
|
reservedWord('body'),
|
||||||
|
|
@ -380,12 +396,11 @@ module.exports = grammar({
|
||||||
comma_separated_list_of($.expression),
|
comma_separated_list_of($.expression),
|
||||||
),
|
),
|
||||||
expression: $ => choice(
|
expression: $ => choice(
|
||||||
$.relation,
|
list_of(reservedWord('and'), $.relation),
|
||||||
seq($.relation, $.AND_relation_list),
|
list_of(seq(reservedWord('and'), reservedWord('then')), $.relation),
|
||||||
seq($.relation, $.AND_THEN_relation_list),
|
list_of(reservedWord('or'), $.relation),
|
||||||
seq($.relation, $.OR_relation_list),
|
list_of(seq(reservedWord('or'), reservedWord('else')), $.relation),
|
||||||
seq($.relation, $.OR_ELSE_relation_list),
|
list_of(reservedWord('xor'), $.relation),
|
||||||
seq($.relation, $.XOR_relation_list),
|
|
||||||
),
|
),
|
||||||
assoc_expression: $ => seq(
|
assoc_expression: $ => seq(
|
||||||
'=>',
|
'=>',
|
||||||
|
|
@ -394,43 +409,36 @@ module.exports = grammar({
|
||||||
'<>',
|
'<>',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
AND_relation_list: $ => repeat1(seq(
|
|
||||||
reservedWord('and'),
|
|
||||||
$.relation,
|
|
||||||
)),
|
|
||||||
AND_THEN_relation_list: $ => repeat1(seq(
|
|
||||||
reservedWord('and'),
|
|
||||||
reservedWord('then'),
|
|
||||||
$.relation,
|
|
||||||
)),
|
|
||||||
OR_relation_list: $ => repeat1(seq(
|
|
||||||
reservedWord('or'),
|
|
||||||
$.relation,
|
|
||||||
)),
|
|
||||||
OR_ELSE_relation_list: $ => repeat1(seq(
|
|
||||||
reservedWord('or'),
|
|
||||||
reservedWord('else'),
|
|
||||||
$.relation,
|
|
||||||
)),
|
|
||||||
XOR_relation_list: $ => repeat1(seq(
|
|
||||||
reservedWord('xor'),
|
|
||||||
$.relation,
|
|
||||||
)),
|
|
||||||
relation: $ => choice(
|
relation: $ => choice(
|
||||||
seq(
|
seq(
|
||||||
$.simple_expression,
|
$.simple_expression,
|
||||||
optional(seq(
|
optional(seq(
|
||||||
$.relational_operator,
|
$.relational_operator,
|
||||||
$.simple_expression,
|
$.simple_expression,
|
||||||
))
|
)),
|
||||||
),
|
),
|
||||||
// seq(
|
seq(
|
||||||
// $.simple_expression,
|
$.simple_expression,
|
||||||
// optional(reservedWord('not')),
|
optional(reservedWord('not')),
|
||||||
// reservedWord('in'),
|
reservedWord('in'),
|
||||||
// $.membership_choice_list,
|
$.membership_choice_list,
|
||||||
// ),
|
),
|
||||||
// $.raise_expression,
|
$.raise_expression,
|
||||||
|
),
|
||||||
|
raise_expression: $ => seq(
|
||||||
|
reservedWord('raise'),
|
||||||
|
$.name,
|
||||||
|
optional(seq(
|
||||||
|
reservedWord('with'),
|
||||||
|
$.simple_expression,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
membership_choice_list: $ => prec.right(
|
||||||
|
list_of('|', $.membership_choice),
|
||||||
|
),
|
||||||
|
membership_choice: $ => choice(
|
||||||
|
$.simple_expression,
|
||||||
|
$.range_g,
|
||||||
),
|
),
|
||||||
simple_expression: $ => seq(
|
simple_expression: $ => seq(
|
||||||
optional($.unary_adding_operator),
|
optional($.unary_adding_operator),
|
||||||
|
|
@ -495,7 +503,7 @@ module.exports = grammar({
|
||||||
'(',
|
'(',
|
||||||
choice(
|
choice(
|
||||||
comma_separated_list_of($.parameter_association),
|
comma_separated_list_of($.parameter_association),
|
||||||
// $.conditional_expression,
|
$.conditional_expression,
|
||||||
// $.quantified_expression,
|
// $.quantified_expression,
|
||||||
// $.declare_expression,
|
// $.declare_expression,
|
||||||
),
|
),
|
||||||
|
|
@ -509,28 +517,26 @@ module.exports = grammar({
|
||||||
$.expression,
|
$.expression,
|
||||||
'<>',
|
'<>',
|
||||||
),
|
),
|
||||||
component_choice_list: $ => choice(
|
conditional_expression: $ => choice(
|
||||||
$.selector_name,
|
$.if_expression,
|
||||||
seq(
|
// $.case_expression,
|
||||||
$.component_choice_list,
|
|
||||||
'|',
|
|
||||||
$.selector_name,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
component_choice_list: $ =>
|
||||||
|
list_of('|', $.selector_name),
|
||||||
aggregate: $ => choice(
|
aggregate: $ => choice(
|
||||||
$.record_aggregate,
|
$.record_aggregate,
|
||||||
// $.extension_aggregate,
|
// $.extension_aggregate,
|
||||||
$.array_aggregate,
|
$.array_aggregate,
|
||||||
// $.delta_aggregate,
|
// $.delta_aggregate,
|
||||||
// seq(
|
seq(
|
||||||
// '(',
|
'(',
|
||||||
// choice(
|
choice(
|
||||||
// $.conditional_expression,
|
$.conditional_expression,
|
||||||
// $.quantified_expression,
|
// $.quantified_expression,
|
||||||
// $.declare_expression,
|
// $.declare_expression,
|
||||||
// ),
|
),
|
||||||
// ')',
|
')',
|
||||||
// ),
|
),
|
||||||
),
|
),
|
||||||
record_aggregate: $ => seq(
|
record_aggregate: $ => seq(
|
||||||
'(',
|
'(',
|
||||||
|
|
@ -787,7 +793,7 @@ module.exports = grammar({
|
||||||
optional(reservedWord('aliased')),
|
optional(reservedWord('aliased')),
|
||||||
choice(
|
choice(
|
||||||
$.subtype_indication,
|
$.subtype_indication,
|
||||||
// $.access_definition,
|
$.access_definition,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
abstract_subprogram_declaration: $ => seq(
|
abstract_subprogram_declaration: $ => seq(
|
||||||
|
|
@ -795,7 +801,7 @@ module.exports = grammar({
|
||||||
$.subprogram_specification,
|
$.subprogram_specification,
|
||||||
reservedWord('is'),
|
reservedWord('is'),
|
||||||
reservedWord('abstract'),
|
reservedWord('abstract'),
|
||||||
$.aspect_specification,
|
optional($.aspect_specification),
|
||||||
';',
|
';',
|
||||||
),
|
),
|
||||||
array_aggregate: $ => choice(
|
array_aggregate: $ => choice(
|
||||||
|
|
@ -982,9 +988,7 @@ module.exports = grammar({
|
||||||
optional($.overriding_indicator),
|
optional($.overriding_indicator),
|
||||||
$.function_specification,
|
$.function_specification,
|
||||||
reservedWord('is'),
|
reservedWord('is'),
|
||||||
'(',
|
$.aggregate,
|
||||||
$.expression,
|
|
||||||
')',
|
|
||||||
optional($.aspect_specification),
|
optional($.aspect_specification),
|
||||||
';',
|
';',
|
||||||
),
|
),
|
||||||
|
|
@ -1100,7 +1104,8 @@ module.exports = grammar({
|
||||||
$.procedure_specification,
|
$.procedure_specification,
|
||||||
reservedWord('is'),
|
reservedWord('is'),
|
||||||
reservedWord('null'),
|
reservedWord('null'),
|
||||||
// optional($.aspect_specification),
|
optional($.aspect_specification),
|
||||||
|
';',
|
||||||
),
|
),
|
||||||
null_statement: $ => seq(
|
null_statement: $ => seq(
|
||||||
reservedWord('null'),
|
reservedWord('null'),
|
||||||
|
|
@ -1161,12 +1166,34 @@ module.exports = grammar({
|
||||||
'(',
|
'(',
|
||||||
choice(
|
choice(
|
||||||
// $.pragma_argument_association_list,
|
// $.pragma_argument_association_list,
|
||||||
// $.conditional_quantified_expression,
|
$.conditional_quantified_expression,
|
||||||
),
|
),
|
||||||
')',
|
')',
|
||||||
)),
|
)),
|
||||||
';'
|
';'
|
||||||
),
|
),
|
||||||
|
conditional_quantified_expression: $ => choice(
|
||||||
|
$.if_expression,
|
||||||
|
// $.case_expression,
|
||||||
|
// $.quantified_expression,
|
||||||
|
),
|
||||||
|
if_expression: $ => seq(
|
||||||
|
reservedWord('if'),
|
||||||
|
field('condition', $.expression),
|
||||||
|
reservedWord('then'),
|
||||||
|
$.expression,
|
||||||
|
repeat($.elsif_expression_item),
|
||||||
|
optional(seq(
|
||||||
|
reservedWord('else'),
|
||||||
|
$.expression,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
elsif_expression_item: $ => seq(
|
||||||
|
reservedWord('elsif'),
|
||||||
|
field('condition', $.expression),
|
||||||
|
reservedWord('then'),
|
||||||
|
$.expression,
|
||||||
|
),
|
||||||
procedure_specification: $ => seq(
|
procedure_specification: $ => seq(
|
||||||
reservedWord('procedure'),
|
reservedWord('procedure'),
|
||||||
$.name,
|
$.name,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user