Support for tasks
This commit is contained in:
parent
779bebba99
commit
f32b258652
142
corpus/tasking.txt
Normal file
142
corpus/tasking.txt
Normal file
|
|
@ -0,0 +1,142 @@
|
||||||
|
================================================================================
|
||||||
|
tasks
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
package body P is
|
||||||
|
task T is
|
||||||
|
entry E (A : Integer);
|
||||||
|
private
|
||||||
|
entry E2;
|
||||||
|
end T;
|
||||||
|
|
||||||
|
task body T is
|
||||||
|
A : Integer;
|
||||||
|
begin
|
||||||
|
accept E (A : Integer) do
|
||||||
|
null;
|
||||||
|
end E;
|
||||||
|
|
||||||
|
select
|
||||||
|
Call (1);
|
||||||
|
or
|
||||||
|
delay 1.0;
|
||||||
|
end select;
|
||||||
|
|
||||||
|
select
|
||||||
|
Call (1);
|
||||||
|
else
|
||||||
|
null;
|
||||||
|
end select;
|
||||||
|
end T;
|
||||||
|
end P;
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(compilation
|
||||||
|
(compilation_unit
|
||||||
|
(proper_body
|
||||||
|
(package_body
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(non_empty_declarative_part
|
||||||
|
(declarative_item_pragma
|
||||||
|
(object_declaration
|
||||||
|
(single_task_declaration
|
||||||
|
(identifier)
|
||||||
|
(task_definition
|
||||||
|
(task_item
|
||||||
|
(entry_declaration
|
||||||
|
(identifier)
|
||||||
|
(formal_part
|
||||||
|
(parameter_specification_list
|
||||||
|
(parameter_specification
|
||||||
|
(defining_identifier_list
|
||||||
|
(identifier))
|
||||||
|
(name
|
||||||
|
(identifier)))))))
|
||||||
|
(task_item
|
||||||
|
(entry_declaration
|
||||||
|
(identifier)))
|
||||||
|
(identifier)))))
|
||||||
|
(declarative_item_pragma
|
||||||
|
(proper_body
|
||||||
|
(task_body
|
||||||
|
(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
|
||||||
|
(compound_statement
|
||||||
|
(accept_statement
|
||||||
|
(identifier)
|
||||||
|
(formal_part
|
||||||
|
(parameter_specification_list
|
||||||
|
(parameter_specification
|
||||||
|
(defining_identifier_list
|
||||||
|
(identifier))
|
||||||
|
(name
|
||||||
|
(identifier)))))
|
||||||
|
(handled_sequence_of_statements
|
||||||
|
(sequence_of_statements
|
||||||
|
(statement
|
||||||
|
(simple_statement
|
||||||
|
(null_statement)))))
|
||||||
|
(identifier))))
|
||||||
|
(statement
|
||||||
|
(compound_statement
|
||||||
|
(select_statement
|
||||||
|
(timed_entry_call
|
||||||
|
(entry_call_alternative
|
||||||
|
(procedure_call_statement
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(actual_parameter_part
|
||||||
|
(parameter_association
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(numeric_literal)))))))))))
|
||||||
|
(delay_alternative
|
||||||
|
(delay_statement
|
||||||
|
(delay_relative_statement
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(numeric_literal))))))))))))))
|
||||||
|
(statement
|
||||||
|
(compound_statement
|
||||||
|
(select_statement
|
||||||
|
(conditional_entry_call
|
||||||
|
(entry_call_alternative
|
||||||
|
(procedure_call_statement
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(actual_parameter_part
|
||||||
|
(parameter_association
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(numeric_literal)))))))))))
|
||||||
|
(sequence_of_statements
|
||||||
|
(statement
|
||||||
|
(simple_statement
|
||||||
|
(null_statement))))))))))
|
||||||
|
(identifier)))))
|
||||||
|
(name
|
||||||
|
(identifier))))))
|
||||||
135
grammar.js
135
grammar.js
|
|
@ -370,7 +370,7 @@ module.exports = grammar({
|
||||||
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(
|
subprogram_body: $ => seq(
|
||||||
|
|
@ -1154,6 +1154,19 @@ module.exports = grammar({
|
||||||
optional($.aspect_specification),
|
optional($.aspect_specification),
|
||||||
';',
|
';',
|
||||||
),
|
),
|
||||||
|
task_body: $ => seq(
|
||||||
|
reservedWord('task'),
|
||||||
|
reservedWord('body'),
|
||||||
|
$.identifier,
|
||||||
|
optional($.aspect_specification),
|
||||||
|
reservedWord('is'),
|
||||||
|
optional($.non_empty_declarative_part),
|
||||||
|
reservedWord('begin'),
|
||||||
|
$.handled_sequence_of_statements,
|
||||||
|
reservedWord('end'),
|
||||||
|
optional($.identifier),
|
||||||
|
';',
|
||||||
|
),
|
||||||
task_body_stub: $ => seq(
|
task_body_stub: $ => seq(
|
||||||
reservedWord('task'),
|
reservedWord('task'),
|
||||||
reservedWord('body'),
|
reservedWord('body'),
|
||||||
|
|
@ -1542,9 +1555,50 @@ module.exports = grammar({
|
||||||
optional($.aspect_specification),
|
optional($.aspect_specification),
|
||||||
';',
|
';',
|
||||||
),
|
),
|
||||||
// $.single_task_declaration,
|
$.single_task_declaration,
|
||||||
// $.single_protected_declaration,
|
// $.single_protected_declaration,
|
||||||
),
|
),
|
||||||
|
single_task_declaration: $ => seq(
|
||||||
|
reservedWord('task'),
|
||||||
|
$.identifier,
|
||||||
|
optional($.aspect_specification),
|
||||||
|
optional(seq(
|
||||||
|
reservedWord('is'),
|
||||||
|
optional(seq(
|
||||||
|
reservedWord('new'),
|
||||||
|
$.interface_list,
|
||||||
|
reservedWord('with'),
|
||||||
|
)),
|
||||||
|
$.task_definition,
|
||||||
|
)),
|
||||||
|
';',
|
||||||
|
),
|
||||||
|
entry_declaration: $ => seq(
|
||||||
|
optional($.overriding_indicator),
|
||||||
|
reservedWord('entry'),
|
||||||
|
$.identifier,
|
||||||
|
optional(seq(
|
||||||
|
'(',
|
||||||
|
$.discrete_subtype_definition,
|
||||||
|
')',
|
||||||
|
)),
|
||||||
|
field('parameter_profile', optional($.formal_part)),
|
||||||
|
optional($.aspect_specification),
|
||||||
|
';',
|
||||||
|
),
|
||||||
|
task_item: $ => choice(
|
||||||
|
$.entry_declaration,
|
||||||
|
$.aspect_clause,
|
||||||
|
),
|
||||||
|
task_definition: $ => seq(
|
||||||
|
repeat1($.task_item),
|
||||||
|
optional(seq(
|
||||||
|
reservedWord('private'),
|
||||||
|
repeat1($.task_item),
|
||||||
|
)),
|
||||||
|
reservedWord('end'),
|
||||||
|
optional($.identifier),
|
||||||
|
),
|
||||||
overriding_indicator: $ => seq(
|
overriding_indicator: $ => seq(
|
||||||
optional(reservedWord('not')),
|
optional(reservedWord('not')),
|
||||||
reservedWord('overriding'),
|
reservedWord('overriding'),
|
||||||
|
|
@ -1747,8 +1801,81 @@ module.exports = grammar({
|
||||||
$.block_statement,
|
$.block_statement,
|
||||||
$.extended_return_statement,
|
$.extended_return_statement,
|
||||||
// $.parallel_block_statement,
|
// $.parallel_block_statement,
|
||||||
// $.accept_statement,
|
$.accept_statement,
|
||||||
// $.select_statement,
|
$.select_statement,
|
||||||
|
),
|
||||||
|
select_statement: $ => choice(
|
||||||
|
$.selective_accept,
|
||||||
|
$.timed_entry_call,
|
||||||
|
$.conditional_entry_call,
|
||||||
|
// $.asynchronous_select,
|
||||||
|
),
|
||||||
|
entry_call_alternative: $ => seq(
|
||||||
|
$.procedure_call_statement,
|
||||||
|
optional($.sequence_of_statements),
|
||||||
|
),
|
||||||
|
conditional_entry_call: $ => seq(
|
||||||
|
reservedWord('select'),
|
||||||
|
$.entry_call_alternative,
|
||||||
|
reservedWord('else'),
|
||||||
|
$.sequence_of_statements,
|
||||||
|
reservedWord('end'),
|
||||||
|
reservedWord('select'),
|
||||||
|
';',
|
||||||
|
),
|
||||||
|
delay_alternative: $ => seq(
|
||||||
|
$.delay_statement,
|
||||||
|
optional($.sequence_of_statements)
|
||||||
|
),
|
||||||
|
timed_entry_call: $ => seq(
|
||||||
|
reservedWord('select'),
|
||||||
|
$.entry_call_alternative,
|
||||||
|
reservedWord('or'),
|
||||||
|
$.delay_alternative,
|
||||||
|
reservedWord('end'),
|
||||||
|
reservedWord('select'),
|
||||||
|
';',
|
||||||
|
),
|
||||||
|
guard: $ => seq(
|
||||||
|
reservedWord('when'),
|
||||||
|
field('condition', $.expression),
|
||||||
|
'=>',
|
||||||
|
),
|
||||||
|
guard_select: $ => seq(
|
||||||
|
$.guard,
|
||||||
|
$.select_alternative,
|
||||||
|
),
|
||||||
|
select_alternative: $ => seq(
|
||||||
|
$.accept_statement,
|
||||||
|
optional($.sequence_of_statements),
|
||||||
|
),
|
||||||
|
selective_accept: $ => seq(
|
||||||
|
reservedWord('select'),
|
||||||
|
list_of(reservedWord('or'), $.guard_select),
|
||||||
|
optional(seq(
|
||||||
|
reservedWord('else'),
|
||||||
|
$.sequence_of_statements,
|
||||||
|
)),
|
||||||
|
reservedWord('end'),
|
||||||
|
reservedWord('select'),
|
||||||
|
reservedWord(';'),
|
||||||
|
),
|
||||||
|
accept_statement: $ => seq(
|
||||||
|
reservedWord('accept'),
|
||||||
|
$._direct_name,
|
||||||
|
optional(seq(
|
||||||
|
'(',
|
||||||
|
field('entry_index', $.expression),
|
||||||
|
')',
|
||||||
|
)),
|
||||||
|
field('parameter_profile', optional($.formal_part)),
|
||||||
|
optional(seq(
|
||||||
|
reservedWord('do'),
|
||||||
|
$.handled_sequence_of_statements,
|
||||||
|
reservedWord('end'),
|
||||||
|
optional($.identifier),
|
||||||
|
)),
|
||||||
|
';',
|
||||||
),
|
),
|
||||||
case_statement_alternative: $ => seq(
|
case_statement_alternative: $ => seq(
|
||||||
reservedWord('when'),
|
reservedWord('when'),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user