Open dhuebner opened 1 year ago
Update: Using an optional unordered group element currently leads to a stack overflow. Same problem exists also when an optional alternative is used inside a many group:
( prop1='prop1'? | prop2='prop2')*
Is it the same stack overflow as in #775?
@spoenemann No. Here it is inside the chevrotain-allstart package. Could we address this issue before v1.0.0?
While experimenting with unordered groups, I found out that Chevrotain (or Langium?) treats all options within an unordered group as optional anyway, i.e., ('a' & b')
matches `,
a,
b,
a b,
b a. Therefore, it acts exactly how I would expect
('a'? & 'b'?)to work, which means both expressions are equivalent. Of course, the same applies to
('a'? | 'b'?)vs.
('a' | 'b'), just that these also allow duplicates of
aand
b`.
Maybe you have already known that. If no modification in Chevrotain is made, doesn't that mean that there are the following two options?
('a'? | 'b'?)*
and ('a'? & 'b'?)
with a validation message that recommends using an expression without ?
As described here optional elements inside an unordered group are currently not supported.
We should check how the new Chevrotain implementation affects the current unordered group implementation. Depending on the result remove existing validation, or implement a solution so that unordered groups are handled correctly.