Optional elements in Unordered groups are currently not supported #649
-
Hey guys, I ran into this diagnostic when I use optional operator This diagnostic information tells me that such a combination is not allowed, but I am wondering for what reason Langium cannot support the use of optional in unordered group. One reason that I can think of is that, if some tokens can be both matched by rule In my case, parse rule Also, I noticed that the diagnostic says |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Sorry for not reading all the search results before. I found the following explanation in #314 (comment). So lacking underlying tool support is the main reason for this, and this feature may be supported in future.
|
Beta Was this translation helpful? Give feedback.
-
@luan-xiaokun Yep, as mentioned in your other comment, this is due to a limitation of our underlying parser library. However, I'm wondering why you would need such a construct in the first place. In theory |
Beta Was this translation helpful? Give feedback.
@luan-xiaokun Yep, as mentioned in your other comment, this is due to a limitation of our underlying parser library.
However, I'm wondering why you would need such a construct in the first place. In theory
(A? & B)
(which parses (A or B or nothing) in any order) is grammatically the same as(A & B)?
(which parses (A or B in any order) or nothing, but probably works correctly in Chevrotain).