support for discrete_range constraints
This commit is contained in:
parent
6f6cac7c84
commit
184f9ca9b8
|
|
@ -256,3 +256,72 @@ end P;
|
|||
(numeric_literal))))))))))))))
|
||||
(name
|
||||
(identifier)))))
|
||||
|
||||
================================================================================
|
||||
Subtypes
|
||||
================================================================================
|
||||
|
||||
package P is
|
||||
subtype T is Integer range 1 .. 2;
|
||||
subtype Arr is MyArray (1 .. 2, 3 .. 4);
|
||||
end P;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(compilation
|
||||
(compilation_unit
|
||||
(package_specification
|
||||
(name
|
||||
(identifier))
|
||||
(subtype_declaration
|
||||
(identifier)
|
||||
(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)))))))))))
|
||||
(subtype_declaration
|
||||
(identifier)
|
||||
(subtype_indication
|
||||
(name
|
||||
(identifier))
|
||||
(constraint
|
||||
(index_constraint
|
||||
(discrete_range
|
||||
(range_g
|
||||
(simple_expression
|
||||
(term
|
||||
(factor
|
||||
(primary
|
||||
(numeric_literal)))))
|
||||
(simple_expression
|
||||
(term
|
||||
(factor
|
||||
(primary
|
||||
(numeric_literal)))))))
|
||||
(discrete_range
|
||||
(range_g
|
||||
(simple_expression
|
||||
(term
|
||||
(factor
|
||||
(primary
|
||||
(numeric_literal)))))
|
||||
(simple_expression
|
||||
(term
|
||||
(factor
|
||||
(primary
|
||||
(numeric_literal)))))))))))
|
||||
(name
|
||||
(identifier)))))
|
||||
|
|
|
|||
|
|
@ -730,7 +730,7 @@ module.exports = grammar({
|
|||
),
|
||||
index_constraint: $ => seq(
|
||||
'(',
|
||||
// comma_separated_list_of($.discrete_range),
|
||||
comma_separated_list_of($.discrete_range),
|
||||
')',
|
||||
),
|
||||
digits_constraint: $ => seq(
|
||||
|
|
@ -875,6 +875,10 @@ module.exports = grammar({
|
|||
$.subtype_indication,
|
||||
$.range_g,
|
||||
),
|
||||
discrete_range: $ => choice( // same as discrete_subtype_definition
|
||||
$.subtype_indication,
|
||||
$.range_g,
|
||||
),
|
||||
_index_subtype_definition_list: $ =>
|
||||
comma_separated_list_of($.index_subtype_definition),
|
||||
index_subtype_definition: $ => seq(
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user