Task types may have no task_item

Based literals may have exponents
This commit is contained in:
Emmanuel Briot 2022-12-14 12:24:09 +01:00
parent fb54a00c16
commit 7b4bf400ab
6 changed files with 29280 additions and 29055 deletions

View File

@ -126,7 +126,7 @@ module.exports = grammar({
numeric_literal: $ => token( numeric_literal: $ => token(
choice( choice(
/[0-9][0-9_]*(\.[0-9_]+)?([eE][+-]?[0-9_]+)?/, /[0-9][0-9_]*(\.[0-9_]+)?([eE][+-]?[0-9_]+)?/,
/[0-9]+#[0-9a-fA-F._-]+#/ /[0-9]+#[0-9a-fA-F._-]+#([eE][+-]?[0-9_]+)?/,
) )
), ),
relational_operator: $ => choice('=', '/=', '<', '<=', '>', '>='), relational_operator: $ => choice('=', '/=', '<', '<=', '>', '>='),
@ -1765,7 +1765,7 @@ module.exports = grammar({
)), )),
';', ';',
), ),
task_type_declaration: $ => seq( task_type_declaration: $ => seq( // RM 9.1
reservedWord('task'), reservedWord('task'),
reservedWord('type'), reservedWord('type'),
$.identifier, $.identifier,
@ -1807,11 +1807,11 @@ module.exports = grammar({
$.entry_declaration, $.entry_declaration,
$._aspect_clause, $._aspect_clause,
), ),
task_definition: $ => seq( task_definition: $ => seq( // RM 9.1
repeat1($._task_item), repeat($._task_item),
optional(seq( optional(seq(
reservedWord('private'), reservedWord('private'),
repeat1($._task_item), repeat($._task_item),
)), )),
reservedWord('end'), reservedWord('end'),
field('endname', optional($.identifier)), field('endname', optional($.identifier)),

View File

@ -54,7 +54,7 @@
}, },
{ {
"type": "PATTERN", "type": "PATTERN",
"value": "[0-9]+#[0-9a-fA-F._-]+#" "value": "[0-9]+#[0-9a-fA-F._-]+#([eE][+-]?[0-9_]+)?"
} }
] ]
} }
@ -10850,7 +10850,7 @@
"type": "SEQ", "type": "SEQ",
"members": [ "members": [
{ {
"type": "REPEAT1", "type": "REPEAT",
"content": { "content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_task_item" "name": "_task_item"
@ -10879,7 +10879,7 @@
"value": "private" "value": "private"
}, },
{ {
"type": "REPEAT1", "type": "REPEAT",
"content": { "content": {
"type": "SYMBOL", "type": "SYMBOL",
"name": "_task_item" "name": "_task_item"

View File

@ -10788,7 +10788,7 @@
}, },
"children": { "children": {
"multiple": true, "multiple": true,
"required": true, "required": false,
"types": [ "types": [
{ {
"type": "at_clause", "type": "at_clause",

58241
src/parser.c

File diff suppressed because it is too large Load Diff

View File

@ -48,3 +48,20 @@ A : Integer := 12_14.12_122E+11_2;
(expression (expression
(term (term
(numeric_literal)))))) (numeric_literal))))))
=======================
Based numerals
=======================
A : Integer := 16#FA01#E+02;
-----
(compilation
(compilation_unit
(object_declaration
(identifier)
(identifier)
(expression
(term
(numeric_literal))))))

View File

@ -233,3 +233,62 @@ end select;
(identifier)))) (identifier))))
(select_alternative (select_alternative
(terminate_alternative))))) (terminate_alternative)))))
================================================================================
Task type with discriminant
================================================================================
package P is
task type T (A : Integer) is
end T;
end;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(package_specification
(identifier)
(full_type_declaration
(task_type_declaration
(identifier)
(known_discriminant_part
(discriminant_specification_list
(discriminant_specification
(identifier)
(identifier))))
(task_definition
(identifier)))))))
================================================================================
Task type with aspect
================================================================================
package P is
task type T (A : Integer) with Priority => 1 is
end T;
end;
--------------------------------------------------------------------------------
(compilation
(compilation_unit
(package_specification
(identifier)
(full_type_declaration
(task_type_declaration
(identifier)
(known_discriminant_part
(discriminant_specification_list
(discriminant_specification
(identifier)
(identifier))))
(aspect_specification
(aspect_mark_list
(aspect_association
(identifier)
(expression
(term
(numeric_literal))))))
(task_definition
(identifier)))))))