Support for protected types
This commit is contained in:
parent
e5245e8283
commit
b0f3476851
183
corpus/protected.txt
Normal file
183
corpus/protected.txt
Normal file
|
|
@ -0,0 +1,183 @@
|
||||||
|
================================================================================
|
||||||
|
protected objects
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
package body P is
|
||||||
|
protected Obj is
|
||||||
|
procedure Proc;
|
||||||
|
function Func return Boolean;
|
||||||
|
entry E;
|
||||||
|
entry E2 (Color)(A : Integer);
|
||||||
|
private
|
||||||
|
Field : Integer;
|
||||||
|
end Obj;
|
||||||
|
|
||||||
|
protected body Obj is
|
||||||
|
procedure Proc is begin abort T; end;
|
||||||
|
function Func return Boolean is begin return False; end;
|
||||||
|
entry E when Field > 0 is
|
||||||
|
begin
|
||||||
|
requeue E with abort;
|
||||||
|
end E;
|
||||||
|
entry E2 (for C in Color)(A : Integer) when True is
|
||||||
|
begin
|
||||||
|
null;
|
||||||
|
end E2;
|
||||||
|
end Obj;
|
||||||
|
end;
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(compilation
|
||||||
|
(compilation_unit
|
||||||
|
(proper_body
|
||||||
|
(package_body
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(non_empty_declarative_part
|
||||||
|
(declarative_item_pragma
|
||||||
|
(object_declaration
|
||||||
|
(single_protected_declaration
|
||||||
|
(identifier)
|
||||||
|
(protected_definition
|
||||||
|
(protected_operation_declaration
|
||||||
|
(subprogram_declaration
|
||||||
|
(subprogram_specification
|
||||||
|
(procedure_specification
|
||||||
|
(name
|
||||||
|
(identifier))))))
|
||||||
|
(protected_operation_declaration
|
||||||
|
(subprogram_declaration
|
||||||
|
(subprogram_specification
|
||||||
|
(function_specification
|
||||||
|
(name
|
||||||
|
(identifier))
|
||||||
|
(parameter_and_result_profile
|
||||||
|
(result_profile
|
||||||
|
(name
|
||||||
|
(identifier))))))))
|
||||||
|
(protected_operation_declaration
|
||||||
|
(entry_declaration
|
||||||
|
(identifier)))
|
||||||
|
(protected_operation_declaration
|
||||||
|
(entry_declaration
|
||||||
|
(identifier)
|
||||||
|
(discrete_subtype_definition
|
||||||
|
(subtype_indication
|
||||||
|
(name
|
||||||
|
(identifier))))
|
||||||
|
(formal_part
|
||||||
|
(parameter_specification_list
|
||||||
|
(parameter_specification
|
||||||
|
(defining_identifier_list
|
||||||
|
(identifier))
|
||||||
|
(name
|
||||||
|
(identifier)))))))
|
||||||
|
(protected_element_declaration
|
||||||
|
(component_declaration
|
||||||
|
(defining_identifier_list
|
||||||
|
(identifier))
|
||||||
|
(component_definition
|
||||||
|
(subtype_indication
|
||||||
|
(name
|
||||||
|
(identifier))))))
|
||||||
|
(identifier)))))
|
||||||
|
(declarative_item_pragma
|
||||||
|
(proper_body
|
||||||
|
(protected_body
|
||||||
|
(identifier)
|
||||||
|
(protected_operation_item
|
||||||
|
(subprogram_body
|
||||||
|
(subprogram_specification
|
||||||
|
(procedure_specification
|
||||||
|
(name
|
||||||
|
(identifier))))
|
||||||
|
(handled_sequence_of_statements
|
||||||
|
(sequence_of_statements
|
||||||
|
(statement
|
||||||
|
(simple_statement
|
||||||
|
(abort_statement
|
||||||
|
(name
|
||||||
|
(identifier)))))))))
|
||||||
|
(protected_operation_item
|
||||||
|
(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)))))))))))))))
|
||||||
|
(protected_operation_item
|
||||||
|
(entry_body
|
||||||
|
(identifier)
|
||||||
|
(entry_barrier
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(name
|
||||||
|
(identifier))))))
|
||||||
|
(relational_operator)
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(numeric_literal))))))))
|
||||||
|
(handled_sequence_of_statements
|
||||||
|
(sequence_of_statements
|
||||||
|
(statement
|
||||||
|
(simple_statement
|
||||||
|
(requeue_statement
|
||||||
|
(name
|
||||||
|
(identifier)))))))
|
||||||
|
(identifier)))
|
||||||
|
(protected_operation_item
|
||||||
|
(entry_body
|
||||||
|
(identifier)
|
||||||
|
(non_empty_entry_body_formal_part
|
||||||
|
(entry_index_specification
|
||||||
|
(identifier)
|
||||||
|
(discrete_subtype_definition
|
||||||
|
(subtype_indication
|
||||||
|
(name
|
||||||
|
(identifier)))))
|
||||||
|
(formal_part
|
||||||
|
(parameter_specification_list
|
||||||
|
(parameter_specification
|
||||||
|
(defining_identifier_list
|
||||||
|
(identifier))
|
||||||
|
(name
|
||||||
|
(identifier))))))
|
||||||
|
(entry_barrier
|
||||||
|
(expression
|
||||||
|
(relation
|
||||||
|
(simple_expression
|
||||||
|
(term
|
||||||
|
(factor
|
||||||
|
(primary
|
||||||
|
(name
|
||||||
|
(identifier)))))))))
|
||||||
|
(handled_sequence_of_statements
|
||||||
|
(sequence_of_statements
|
||||||
|
(statement
|
||||||
|
(simple_statement
|
||||||
|
(null_statement)))))
|
||||||
|
(identifier)))
|
||||||
|
(identifier)))))))))
|
||||||
140
grammar.js
140
grammar.js
|
|
@ -371,7 +371,7 @@ module.exports = grammar({
|
||||||
$.subprogram_body,
|
$.subprogram_body,
|
||||||
$.package_body,
|
$.package_body,
|
||||||
$.task_body,
|
$.task_body,
|
||||||
// $.protected_body,
|
$.protected_body,
|
||||||
),
|
),
|
||||||
subprogram_body: $ => seq(
|
subprogram_body: $ => seq(
|
||||||
optional($.overriding_indicator),
|
optional($.overriding_indicator),
|
||||||
|
|
@ -764,7 +764,7 @@ module.exports = grammar({
|
||||||
';',
|
';',
|
||||||
),
|
),
|
||||||
$.task_type_declaration,
|
$.task_type_declaration,
|
||||||
// $.protected_type_declaration,
|
$.protected_type_declaration,
|
||||||
),
|
),
|
||||||
private_type_declaration: $ => seq(
|
private_type_declaration: $ => seq(
|
||||||
reservedWord('type'),
|
reservedWord('type'),
|
||||||
|
|
@ -1179,21 +1179,70 @@ module.exports = grammar({
|
||||||
optional($.aspect_specification),
|
optional($.aspect_specification),
|
||||||
';',
|
';',
|
||||||
),
|
),
|
||||||
task_type_declaration: $ => seq(
|
protected_operation_declaration: $ => choice(
|
||||||
reservedWord('task'),
|
$.subprogram_declaration,
|
||||||
|
$.pragma_g,
|
||||||
|
$.entry_declaration,
|
||||||
|
$.aspect_clause,
|
||||||
|
),
|
||||||
|
protected_element_declaration: $ => choice(
|
||||||
|
$.protected_operation_declaration,
|
||||||
|
$.component_declaration,
|
||||||
|
),
|
||||||
|
protected_operation_item: $ => choice(
|
||||||
|
$.subprogram_declaration,
|
||||||
|
$.subprogram_body,
|
||||||
|
$.null_procedure_declaration,
|
||||||
|
$.expression_function_declaration,
|
||||||
|
$.entry_body,
|
||||||
|
$.aspect_clause,
|
||||||
|
),
|
||||||
|
protected_definition: $ => seq(
|
||||||
|
repeat($.protected_operation_declaration),
|
||||||
|
optional(seq(
|
||||||
|
reservedWord('private'),
|
||||||
|
repeat($.protected_element_declaration),
|
||||||
|
)),
|
||||||
|
reservedWord('end'),
|
||||||
|
optional($.identifier),
|
||||||
|
),
|
||||||
|
protected_type_declaration: $ => seq(
|
||||||
|
reservedWord('protected'),
|
||||||
reservedWord('type'),
|
reservedWord('type'),
|
||||||
$.identifier,
|
$.identifier,
|
||||||
optional($.known_discriminant_part),
|
optional($.known_discriminant_part),
|
||||||
optional($.aspect_specification),
|
optional($.aspect_specification),
|
||||||
|
reservedWord('is'),
|
||||||
optional(seq(
|
optional(seq(
|
||||||
reservedWord('is'),
|
reservedWord('new'),
|
||||||
optional(seq(
|
$.interface_list,
|
||||||
reservedWord('new'),
|
reservedWord('with'),
|
||||||
$.interface_list,
|
|
||||||
reservedWord('with'),
|
|
||||||
)),
|
|
||||||
$.task_definition,
|
|
||||||
)),
|
)),
|
||||||
|
$.protected_definition,
|
||||||
|
';',
|
||||||
|
),
|
||||||
|
single_protected_declaration: $ => seq(
|
||||||
|
reservedWord('protected'),
|
||||||
|
$.identifier,
|
||||||
|
optional($.aspect_specification),
|
||||||
|
reservedWord('is'),
|
||||||
|
optional(seq(
|
||||||
|
reservedWord('new'),
|
||||||
|
$.interface_list,
|
||||||
|
reservedWord('with'),
|
||||||
|
)),
|
||||||
|
$.protected_definition,
|
||||||
|
';',
|
||||||
|
),
|
||||||
|
protected_body: $ => seq(
|
||||||
|
reservedWord('protected'),
|
||||||
|
reservedWord('body'),
|
||||||
|
$.identifier,
|
||||||
|
optional($.aspect_specification),
|
||||||
|
reservedWord('is'),
|
||||||
|
repeat($.protected_operation_item),
|
||||||
|
reservedWord('end'),
|
||||||
|
optional($.identifier),
|
||||||
';',
|
';',
|
||||||
),
|
),
|
||||||
protected_body_stub: $ => seq(
|
protected_body_stub: $ => seq(
|
||||||
|
|
@ -1236,6 +1285,30 @@ module.exports = grammar({
|
||||||
optional($.aspect_specification),
|
optional($.aspect_specification),
|
||||||
';',
|
';',
|
||||||
),
|
),
|
||||||
|
entry_body: $ => seq(
|
||||||
|
reservedWord('entry'),
|
||||||
|
$.identifier,
|
||||||
|
optional($.non_empty_entry_body_formal_part),
|
||||||
|
optional($.aspect_specification),
|
||||||
|
$.entry_barrier,
|
||||||
|
reservedWord('is'),
|
||||||
|
optional($.non_empty_declarative_part),
|
||||||
|
reservedWord('begin'),
|
||||||
|
$.handled_sequence_of_statements,
|
||||||
|
reservedWord('end'),
|
||||||
|
optional($.identifier),
|
||||||
|
';',
|
||||||
|
),
|
||||||
|
entry_barrier: $ => seq(
|
||||||
|
reservedWord('when'),
|
||||||
|
field('condition', $.expression),
|
||||||
|
),
|
||||||
|
entry_index_specification: $ => seq(
|
||||||
|
reservedWord('for'),
|
||||||
|
$.identifier,
|
||||||
|
reservedWord('in'),
|
||||||
|
$.discrete_subtype_definition,
|
||||||
|
),
|
||||||
enumeration_aggregate: $ => $.array_aggregate, // ??? inline
|
enumeration_aggregate: $ => $.array_aggregate, // ??? inline
|
||||||
enumeration_representation_clause: $ => seq(
|
enumeration_representation_clause: $ => seq(
|
||||||
reservedWord('for'),
|
reservedWord('for'),
|
||||||
|
|
@ -1579,7 +1652,7 @@ module.exports = grammar({
|
||||||
';',
|
';',
|
||||||
),
|
),
|
||||||
$.single_task_declaration,
|
$.single_task_declaration,
|
||||||
// $.single_protected_declaration,
|
$.single_protected_declaration,
|
||||||
),
|
),
|
||||||
single_task_declaration: $ => seq(
|
single_task_declaration: $ => seq(
|
||||||
reservedWord('task'),
|
reservedWord('task'),
|
||||||
|
|
@ -1596,6 +1669,31 @@ module.exports = grammar({
|
||||||
)),
|
)),
|
||||||
';',
|
';',
|
||||||
),
|
),
|
||||||
|
task_type_declaration: $ => seq(
|
||||||
|
reservedWord('task'),
|
||||||
|
reservedWord('type'),
|
||||||
|
$.identifier,
|
||||||
|
optional($.known_discriminant_part),
|
||||||
|
optional($.aspect_specification),
|
||||||
|
optional(seq(
|
||||||
|
reservedWord('is'),
|
||||||
|
optional(seq(
|
||||||
|
reservedWord('new'),
|
||||||
|
$.interface_list,
|
||||||
|
reservedWord('with'),
|
||||||
|
)),
|
||||||
|
$.task_definition,
|
||||||
|
)),
|
||||||
|
';',
|
||||||
|
),
|
||||||
|
non_empty_entry_body_formal_part: $ => seq(
|
||||||
|
optional(seq(
|
||||||
|
'(',
|
||||||
|
$.entry_index_specification,
|
||||||
|
')',
|
||||||
|
)),
|
||||||
|
field('parameter_profile', $.formal_part),
|
||||||
|
),
|
||||||
entry_declaration: $ => seq(
|
entry_declaration: $ => seq(
|
||||||
optional($.overriding_indicator),
|
optional($.overriding_indicator),
|
||||||
reservedWord('entry'),
|
reservedWord('entry'),
|
||||||
|
|
@ -1804,9 +1902,9 @@ module.exports = grammar({
|
||||||
$.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,
|
||||||
),
|
),
|
||||||
|
|
@ -1883,6 +1981,20 @@ module.exports = grammar({
|
||||||
reservedWord('select'),
|
reservedWord('select'),
|
||||||
reservedWord(';'),
|
reservedWord(';'),
|
||||||
),
|
),
|
||||||
|
abort_statement: $ => seq(
|
||||||
|
reservedWord('abort'),
|
||||||
|
comma_separated_list_of($.name),
|
||||||
|
';',
|
||||||
|
),
|
||||||
|
requeue_statement: $ => seq(
|
||||||
|
reservedWord('requeue'),
|
||||||
|
$.name,
|
||||||
|
optional(seq(
|
||||||
|
reservedWord('with'),
|
||||||
|
reservedWord('abort'),
|
||||||
|
)),
|
||||||
|
';',
|
||||||
|
),
|
||||||
accept_statement: $ => seq(
|
accept_statement: $ => seq(
|
||||||
reservedWord('accept'),
|
reservedWord('accept'),
|
||||||
$._direct_name,
|
$._direct_name,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user