Support for loop statements
This commit is contained in:
parent
ad302a74a2
commit
2db1b28fb6
|
|
@ -16,7 +16,8 @@ use Ada.Text_IO, System;
|
||||||
(name_list
|
(name_list
|
||||||
(name
|
(name
|
||||||
(identifier)
|
(identifier)
|
||||||
(identifier))
|
(name
|
||||||
|
(identifier)))
|
||||||
(name
|
(name
|
||||||
(identifier)))))
|
(identifier)))))
|
||||||
(comment)
|
(comment)
|
||||||
|
|
@ -41,13 +42,14 @@ use Ada.Text_IO, System;
|
||||||
(name_list
|
(name_list
|
||||||
(name
|
(name
|
||||||
(identifier)
|
(identifier)
|
||||||
(identifier))
|
(name
|
||||||
|
(identifier)))
|
||||||
(name
|
(name
|
||||||
(identifier))))))
|
(identifier))))))
|
||||||
|
|
||||||
=====
|
================================================================================
|
||||||
Case insensitive
|
Case insensitive
|
||||||
=====
|
================================================================================
|
||||||
|
|
||||||
PACkaGe P1 Is
|
PACkaGe P1 Is
|
||||||
enD;
|
enD;
|
||||||
|
|
@ -58,7 +60,7 @@ enD;
|
||||||
(compilation_unit
|
(compilation_unit
|
||||||
(package_specification
|
(package_specification
|
||||||
(name
|
(name
|
||||||
(identifier)))))
|
(identifier)))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
multiple compilation units
|
multiple compilation units
|
||||||
|
|
@ -91,12 +93,13 @@ end;
|
||||||
(package_specification
|
(package_specification
|
||||||
(name
|
(name
|
||||||
(identifier)
|
(identifier)
|
||||||
(identifier))
|
(name
|
||||||
|
(identifier)))
|
||||||
(comment))))
|
(comment))))
|
||||||
|
|
||||||
=========
|
================================================================================
|
||||||
body
|
body
|
||||||
=========
|
================================================================================
|
||||||
|
|
||||||
package body Child.P2 is
|
package body Child.P2 is
|
||||||
package body Nested is
|
package body Nested is
|
||||||
|
|
@ -107,14 +110,16 @@ begin
|
||||||
null;
|
null;
|
||||||
end Child.P2;
|
end Child.P2;
|
||||||
|
|
||||||
---
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(compilation
|
(compilation
|
||||||
(compilation_unit
|
(compilation_unit
|
||||||
(proper_body
|
(proper_body
|
||||||
(package_body
|
(package_body
|
||||||
(name
|
(name
|
||||||
(identifier)
|
(identifier)
|
||||||
(identifier))
|
(name
|
||||||
|
(identifier)))
|
||||||
(non_empty_declarative_part
|
(non_empty_declarative_part
|
||||||
(declarative_item_pragma
|
(declarative_item_pragma
|
||||||
(proper_body
|
(proper_body
|
||||||
|
|
@ -135,7 +140,8 @@ end Child.P2;
|
||||||
(null_statement)))))
|
(null_statement)))))
|
||||||
(name
|
(name
|
||||||
(identifier)
|
(identifier)
|
||||||
(identifier))))))
|
(name
|
||||||
|
(identifier)))))))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
separate
|
separate
|
||||||
|
|
@ -147,18 +153,18 @@ end;
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(compilation
|
(compilation
|
||||||
(compilation_unit
|
(compilation_unit
|
||||||
(subunit
|
(subunit
|
||||||
(name
|
(name
|
||||||
(identifier))
|
(identifier))
|
||||||
(proper_body
|
(proper_body
|
||||||
(package_body
|
(package_body
|
||||||
(name
|
(name
|
||||||
(identifier)))))))
|
(identifier)))))))
|
||||||
|
|
||||||
==========================
|
================================================================================
|
||||||
private types
|
private types
|
||||||
=========================
|
================================================================================
|
||||||
|
|
||||||
package P is
|
package P is
|
||||||
type A is private;
|
type A is private;
|
||||||
|
|
@ -166,42 +172,42 @@ package P is
|
||||||
type C is abstract tagged limited private with Size => 8;
|
type C is abstract tagged limited private with Size => 8;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
-----------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(compilation
|
(compilation
|
||||||
(compilation_unit
|
(compilation_unit
|
||||||
(package_specification
|
(package_specification
|
||||||
(name
|
(name
|
||||||
(identifier))
|
(identifier))
|
||||||
(type_declaration
|
(type_declaration
|
||||||
(private_type_declaration
|
(private_type_declaration
|
||||||
(identifier)))
|
(identifier)))
|
||||||
(type_declaration
|
(type_declaration
|
||||||
(private_extension_declaration
|
(private_extension_declaration
|
||||||
(identifier)
|
(identifier)
|
||||||
(subtype_indication
|
(subtype_indication
|
||||||
(name
|
(name
|
||||||
(identifier)))))
|
(identifier)))))
|
||||||
(type_declaration
|
(type_declaration
|
||||||
(private_type_declaration
|
(private_type_declaration
|
||||||
(identifier)
|
(identifier)
|
||||||
(aspect_specification
|
(aspect_specification
|
||||||
(aspect_mark_list
|
(aspect_mark_list
|
||||||
(aspect_association
|
(aspect_association
|
||||||
(aspect_mark
|
(aspect_mark
|
||||||
(identifier))
|
(identifier))
|
||||||
(aspect_definition
|
(aspect_definition
|
||||||
(expression
|
(expression
|
||||||
(relation
|
(relation
|
||||||
(simple_expression
|
(simple_expression
|
||||||
(term
|
(term
|
||||||
(factor
|
(factor
|
||||||
(primary
|
(primary
|
||||||
(numeric_literal))))))))))))))))
|
(numeric_literal))))))))))))))))
|
||||||
|
|
||||||
==========
|
================================================================================
|
||||||
incomplete types
|
incomplete types
|
||||||
==========
|
================================================================================
|
||||||
|
|
||||||
package P is
|
package P is
|
||||||
private
|
private
|
||||||
|
|
@ -211,33 +217,32 @@ private
|
||||||
type T is tagged;
|
type T is tagged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
--------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
(compilation
|
|
||||||
(compilation_unit
|
|
||||||
(package_specification
|
|
||||||
(name
|
|
||||||
(identifier))
|
|
||||||
(type_declaration
|
|
||||||
(incomplete_type_declaration
|
|
||||||
(identifier)))
|
|
||||||
(type_declaration
|
|
||||||
(incomplete_type_declaration
|
|
||||||
(identifier)
|
|
||||||
(discriminant_part
|
|
||||||
(known_discriminant_part
|
|
||||||
(discriminant_specification_list
|
|
||||||
(discriminant_specification
|
|
||||||
(defining_identifier_list
|
|
||||||
(identifier))
|
|
||||||
(name
|
|
||||||
(identifier))))))))
|
|
||||||
(type_declaration
|
|
||||||
(incomplete_type_declaration
|
|
||||||
(identifier)
|
|
||||||
(discriminant_part
|
|
||||||
(unknown_discriminant_part))))
|
|
||||||
(type_declaration
|
|
||||||
(incomplete_type_declaration
|
|
||||||
(identifier))))))
|
|
||||||
|
|
||||||
|
(compilation
|
||||||
|
(compilation_unit
|
||||||
|
(package_specification
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(type_declaration
|
||||||
|
(incomplete_type_declaration
|
||||||
|
(identifier)))
|
||||||
|
(type_declaration
|
||||||
|
(incomplete_type_declaration
|
||||||
|
(identifier)
|
||||||
|
(discriminant_part
|
||||||
|
(known_discriminant_part
|
||||||
|
(discriminant_specification_list
|
||||||
|
(discriminant_specification
|
||||||
|
(defining_identifier_list
|
||||||
|
(identifier))
|
||||||
|
(name
|
||||||
|
(identifier))))))))
|
||||||
|
(type_declaration
|
||||||
|
(incomplete_type_declaration
|
||||||
|
(identifier)
|
||||||
|
(discriminant_part
|
||||||
|
(unknown_discriminant_part))))
|
||||||
|
(type_declaration
|
||||||
|
(incomplete_type_declaration
|
||||||
|
(identifier))))))
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,8 @@ end P;
|
||||||
(identifier))
|
(identifier))
|
||||||
(name
|
(name
|
||||||
(identifier)
|
(identifier)
|
||||||
(identifier)))))
|
(name
|
||||||
|
(identifier))))))
|
||||||
(declarative_item_pragma
|
(declarative_item_pragma
|
||||||
(renaming_declaration
|
(renaming_declaration
|
||||||
(subprogram_renaming_declaration
|
(subprogram_renaming_declaration
|
||||||
|
|
|
||||||
263
corpus/statements.txt
Normal file
263
corpus/statements.txt
Normal file
|
|
@ -0,0 +1,263 @@
|
||||||
|
================================================================================
|
||||||
|
While
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
procedure P is
|
||||||
|
begin
|
||||||
|
while True loop
|
||||||
|
exit;
|
||||||
|
exit when A > 0;
|
||||||
|
end loop;
|
||||||
|
end;
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(compilation
|
||||||
|
(compilation_unit
|
||||||
|
(proper_body
|
||||||
|
(subprogram_body
|
||||||
|
(subprogram_specification
|
||||||
|
(procedure_specification
|
||||||
|
(name
|
||||||
|
(identifier))))
|
||||||
|
(handled_sequence_of_statements
|
||||||
|
(sequence_of_statements
|
||||||
|
(statement
|
||||||
|
(compound_statement
|
||||||
|
(loop_statement
|
||||||
|
(iteration_scheme
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(name
|
||||||
|
(identifier)))))))))
|
||||||
|
(sequence_of_statements
|
||||||
|
(statement
|
||||||
|
(simple_statement
|
||||||
|
(exit_statement)))
|
||||||
|
(statement
|
||||||
|
(simple_statement
|
||||||
|
(exit_statement
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(name
|
||||||
|
(identifier))))))
|
||||||
|
(relational_operator)
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(numeric_literal))))))))))))))))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
For loops
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
procedure P is
|
||||||
|
begin
|
||||||
|
for E in Pkg.Arr'Range loop
|
||||||
|
goto end_loop;
|
||||||
|
|
||||||
|
<<end_loop>>
|
||||||
|
end loop;
|
||||||
|
|
||||||
|
for E of reverse Arr loop
|
||||||
|
delay 1.0;
|
||||||
|
end loop;
|
||||||
|
end P;
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(compilation
|
||||||
|
(compilation_unit
|
||||||
|
(proper_body
|
||||||
|
(subprogram_body
|
||||||
|
(subprogram_specification
|
||||||
|
(procedure_specification
|
||||||
|
(name
|
||||||
|
(identifier))))
|
||||||
|
(handled_sequence_of_statements
|
||||||
|
(sequence_of_statements
|
||||||
|
(statement
|
||||||
|
(compound_statement
|
||||||
|
(loop_statement
|
||||||
|
(iteration_scheme
|
||||||
|
(iterator_specification
|
||||||
|
(identifier)
|
||||||
|
(name
|
||||||
|
(attribute_reference
|
||||||
|
(name
|
||||||
|
(identifier)
|
||||||
|
(name
|
||||||
|
(identifier)))
|
||||||
|
(tick)
|
||||||
|
(attribute_designator
|
||||||
|
(identifier))))))
|
||||||
|
(sequence_of_statements
|
||||||
|
(statement
|
||||||
|
(simple_statement
|
||||||
|
(goto_statement
|
||||||
|
(name
|
||||||
|
(identifier)))))
|
||||||
|
(label
|
||||||
|
(identifier))))))
|
||||||
|
(statement
|
||||||
|
(compound_statement
|
||||||
|
(loop_statement
|
||||||
|
(iteration_scheme
|
||||||
|
(iterator_specification
|
||||||
|
(identifier)
|
||||||
|
(name
|
||||||
|
(identifier))))
|
||||||
|
(sequence_of_statements
|
||||||
|
(statement
|
||||||
|
(simple_statement
|
||||||
|
(delay_statement
|
||||||
|
(delay_relative_statement
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(numeric_literal)))))))))))))))))
|
||||||
|
(name
|
||||||
|
(identifier))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Named loop
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
procedure P is
|
||||||
|
begin
|
||||||
|
Main:
|
||||||
|
loop
|
||||||
|
exit Main;
|
||||||
|
end loop Main;
|
||||||
|
end;
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(compilation
|
||||||
|
(compilation_unit
|
||||||
|
(proper_body
|
||||||
|
(subprogram_body
|
||||||
|
(subprogram_specification
|
||||||
|
(procedure_specification
|
||||||
|
(name
|
||||||
|
(identifier))))
|
||||||
|
(handled_sequence_of_statements
|
||||||
|
(sequence_of_statements
|
||||||
|
(statement
|
||||||
|
(compound_statement
|
||||||
|
(loop_statement
|
||||||
|
(loop_label
|
||||||
|
(identifier))
|
||||||
|
(sequence_of_statements
|
||||||
|
(statement
|
||||||
|
(simple_statement
|
||||||
|
(exit_statement
|
||||||
|
(name
|
||||||
|
(identifier))))))
|
||||||
|
(identifier))))))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Return
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
function F return Boolean is
|
||||||
|
begin
|
||||||
|
return True;
|
||||||
|
end F;
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(compilation
|
||||||
|
(compilation_unit
|
||||||
|
(proper_body
|
||||||
|
(subprogram_body
|
||||||
|
(subprogram_specification
|
||||||
|
(function_specification
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(parameter_and_result_profile
|
||||||
|
(result_profile
|
||||||
|
(name
|
||||||
|
(identifier))))))
|
||||||
|
(handled_sequence_of_statements
|
||||||
|
(sequence_of_statements
|
||||||
|
(statement
|
||||||
|
(simple_statement
|
||||||
|
(simple_return_statement
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(name
|
||||||
|
(identifier)))))))))))))
|
||||||
|
(name
|
||||||
|
(identifier))))))
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
Procedure call
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
procedure P (A : Integer) is
|
||||||
|
begin
|
||||||
|
P2 (1, False);
|
||||||
|
end P;
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(compilation
|
||||||
|
(compilation_unit
|
||||||
|
(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))))))))
|
||||||
|
(handled_sequence_of_statements
|
||||||
|
(sequence_of_statements
|
||||||
|
(statement
|
||||||
|
(simple_statement
|
||||||
|
(procedure_call_statement
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(actual_parameter_part
|
||||||
|
(parameter_association
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(numeric_literal))))))))
|
||||||
|
(parameter_association
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(name
|
||||||
|
(identifier)))))))))))))))
|
||||||
|
(name
|
||||||
|
(identifier))))))
|
||||||
142
grammar.js
142
grammar.js
|
|
@ -66,9 +66,17 @@ module.exports = grammar({
|
||||||
|
|
||||||
[$.attribute_definition_clause, $.attribute_reference],
|
[$.attribute_definition_clause, $.attribute_reference],
|
||||||
|
|
||||||
|
// _direct_name '.' name . '''
|
||||||
|
// Could be either _direct_name '.' (attribute_reference name . tick
|
||||||
|
// or (name _direct_name '.' name) . '''
|
||||||
|
[$.name, $.attribute_reference],
|
||||||
|
|
||||||
// identifier . ':' ...
|
// identifier . ':' ...
|
||||||
[$.defining_identifier_list, $.object_renaming_declaration,
|
[$.defining_identifier_list, $.object_renaming_declaration,
|
||||||
$.exception_renaming_declaration],
|
$.exception_renaming_declaration],
|
||||||
|
[$.defining_identifier_list, $.object_renaming_declaration,
|
||||||
|
$.exception_renaming_declaration, $._direct_name],
|
||||||
|
[$.defining_identifier_list, $._direct_name],
|
||||||
|
|
||||||
// 'generic' . 'package' ...
|
// 'generic' . 'package' ...
|
||||||
[$.generic_formal_part, $.generic_renaming_declaration],
|
[$.generic_formal_part, $.generic_renaming_declaration],
|
||||||
|
|
@ -143,13 +151,21 @@ module.exports = grammar({
|
||||||
// ),
|
// ),
|
||||||
|
|
||||||
_direct_name: $ => $.identifier,
|
_direct_name: $ => $.identifier,
|
||||||
name: $ => seq(
|
name: $ => choice(
|
||||||
$._direct_name,
|
seq(
|
||||||
repeat(seq(
|
$._direct_name,
|
||||||
'.',
|
optional(seq(
|
||||||
$.identifier,
|
'.',
|
||||||
)),
|
$.name,
|
||||||
|
)),
|
||||||
|
// repeat(seq(
|
||||||
|
// '.',
|
||||||
|
// $.identifier,
|
||||||
|
// )),
|
||||||
|
),
|
||||||
|
$.attribute_reference,
|
||||||
),
|
),
|
||||||
|
|
||||||
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),
|
||||||
|
|
||||||
|
|
@ -244,7 +260,7 @@ module.exports = grammar({
|
||||||
),
|
),
|
||||||
iterator_filter: $ => seq(
|
iterator_filter: $ => seq(
|
||||||
reservedWord('when'),
|
reservedWord('when'),
|
||||||
$.condition,
|
field('condition', $.expression),
|
||||||
),
|
),
|
||||||
iterator_specification: $ => seq(
|
iterator_specification: $ => seq(
|
||||||
$.identifier,
|
$.identifier,
|
||||||
|
|
@ -261,7 +277,7 @@ module.exports = grammar({
|
||||||
optional($.iterator_filter),
|
optional($.iterator_filter),
|
||||||
),
|
),
|
||||||
attribute_designator: $ => choice(
|
attribute_designator: $ => choice(
|
||||||
$.identifier,
|
$.identifier, // missing function_call
|
||||||
reservedWord('access'),
|
reservedWord('access'),
|
||||||
reservedWord('delta'),
|
reservedWord('delta'),
|
||||||
reservedWord('digits'),
|
reservedWord('digits'),
|
||||||
|
|
@ -409,10 +425,6 @@ module.exports = grammar({
|
||||||
reservedWord('range'),
|
reservedWord('range'),
|
||||||
$.range_g,
|
$.range_g,
|
||||||
),
|
),
|
||||||
condition: $ => seq(
|
|
||||||
$.expression,
|
|
||||||
';',
|
|
||||||
),
|
|
||||||
expression_list: $ => prec.left(
|
expression_list: $ => prec.left(
|
||||||
comma_separated_list_of($.expression),
|
comma_separated_list_of($.expression),
|
||||||
),
|
),
|
||||||
|
|
@ -1249,6 +1261,10 @@ module.exports = grammar({
|
||||||
$.exception_handler_list,
|
$.exception_handler_list,
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
|
loop_label: $ => seq( // matches label_opt in ada-mode grammar
|
||||||
|
field('statement_identifier', $._direct_name),
|
||||||
|
':',
|
||||||
|
),
|
||||||
label: $ => seq(
|
label: $ => seq(
|
||||||
'<<',
|
'<<',
|
||||||
field('statement_identifier', $._direct_name),
|
field('statement_identifier', $._direct_name),
|
||||||
|
|
@ -1476,12 +1492,12 @@ module.exports = grammar({
|
||||||
simple_statement: $ => choice(
|
simple_statement: $ => choice(
|
||||||
$.null_statement,
|
$.null_statement,
|
||||||
$.assignment_statement,
|
$.assignment_statement,
|
||||||
// $.exit_statement,
|
$.exit_statement,
|
||||||
// $.goto_statement,
|
$.goto_statement,
|
||||||
// $.procedure_call_statement,
|
$.procedure_call_statement,
|
||||||
// $.simple_return_statement,
|
$.simple_return_statement,
|
||||||
// $.requeue_statement,
|
// $.requeue_statement,
|
||||||
// $.delay_statement,
|
$.delay_statement,
|
||||||
// $.abort_statement,
|
// $.abort_statement,
|
||||||
// $.raise_statement,
|
// $.raise_statement,
|
||||||
$.pragma_g,
|
$.pragma_g,
|
||||||
|
|
@ -1490,9 +1506,99 @@ module.exports = grammar({
|
||||||
repeat($.label),
|
repeat($.label),
|
||||||
choice(
|
choice(
|
||||||
$.simple_statement,
|
$.simple_statement,
|
||||||
// $.compound_statement,
|
$.compound_statement,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
compound_statement: $ => choice(
|
||||||
|
// $.if_statement,
|
||||||
|
// $.case_statement,
|
||||||
|
$.loop_statement,
|
||||||
|
// $.block_statement,
|
||||||
|
// $.extended_return_statement,
|
||||||
|
// $.parallel_block_statement,
|
||||||
|
// $.accept_statement,
|
||||||
|
// $.select_statement,
|
||||||
|
),
|
||||||
|
exit_statement: $ => seq(
|
||||||
|
reservedWord('exit'),
|
||||||
|
optional($.name),
|
||||||
|
optional(seq(
|
||||||
|
reservedWord('when'),
|
||||||
|
field('condition', $.expression),
|
||||||
|
)),
|
||||||
|
';',
|
||||||
|
),
|
||||||
|
goto_statement: $ => seq(
|
||||||
|
reservedWord('goto'),
|
||||||
|
$.name,
|
||||||
|
';',
|
||||||
|
),
|
||||||
|
delay_statement: $ => choice(
|
||||||
|
$.delay_until_statement,
|
||||||
|
$.delay_relative_statement,
|
||||||
|
),
|
||||||
|
delay_until_statement: $ => seq(
|
||||||
|
reservedWord('delay'),
|
||||||
|
reservedWord('until'),
|
||||||
|
$.expression,
|
||||||
|
';',
|
||||||
|
),
|
||||||
|
delay_relative_statement: $ => seq(
|
||||||
|
reservedWord('delay'),
|
||||||
|
$.expression,
|
||||||
|
';',
|
||||||
|
),
|
||||||
|
simple_return_statement: $ => seq(
|
||||||
|
reservedWord('return'),
|
||||||
|
optional($.expression),
|
||||||
|
';',
|
||||||
|
),
|
||||||
|
procedure_call_statement: $ => seq(
|
||||||
|
$.name,
|
||||||
|
optional($.actual_parameter_part),
|
||||||
|
';',
|
||||||
|
),
|
||||||
|
loop_statement: $ => seq(
|
||||||
|
optional($.loop_label),
|
||||||
|
optional($.iteration_scheme),
|
||||||
|
reservedWord('loop'),
|
||||||
|
$.sequence_of_statements,
|
||||||
|
reservedWord('end'),
|
||||||
|
reservedWord('loop'),
|
||||||
|
optional($.identifier),
|
||||||
|
';',
|
||||||
|
),
|
||||||
|
iteration_scheme: $ => choice(
|
||||||
|
seq(
|
||||||
|
reservedWord('while'),
|
||||||
|
field('condition', $.expression),
|
||||||
|
),
|
||||||
|
seq(
|
||||||
|
reservedWord('for'),
|
||||||
|
choice(
|
||||||
|
$.loop_parameter_specification,
|
||||||
|
$.iterator_specification,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// seq(
|
||||||
|
// optional(reservedWord('parallel')),
|
||||||
|
// reservedWord('for'),
|
||||||
|
// $.procedural_iterator,
|
||||||
|
// ),
|
||||||
|
// seq(
|
||||||
|
// reservedWord('parallel'),
|
||||||
|
// optional(seq(
|
||||||
|
// '(',
|
||||||
|
// $.chunk_specification,
|
||||||
|
// ')',
|
||||||
|
// )),
|
||||||
|
// reservedWord('for'),
|
||||||
|
// choice(
|
||||||
|
// $.loop_parameter_specification,
|
||||||
|
// $.iterator_specification,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
),
|
||||||
assignment_statement: $ => seq(
|
assignment_statement: $ => seq(
|
||||||
$.name,
|
$.name,
|
||||||
$.assign_value,
|
$.assign_value,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user