|Ambiguous rules and Predicate behavior [message #1861641]
||Tue, 24 October 2023 23:25
| Sohaib Hamioud
Registered: September 2023
I am stuck with the following ambiguous rules in Xtext:|
UnaryExpression returns ExpressionAtom:
| EXISTS? '(' SelectStatement ')'
| '(' Expressions ')'
When I generate artifacts I get a warning about multiple alternatives. The '(' token is the source of ambiguity.
If I use a predicate "=>" to select the first alternative (i.e., the SelectStatement rule), I ended up with a never-reached alternative2. the SelectStatement rule starts with the 'select' keyword. I thought that if the selected alternative fails, the parser will automatically try the second alternative, but it seems that it is a one-way parsing. What should I do to force the parser to try other alternatives if the chosen one fails?
Powered by FUDForum
. Page generated in 0.01530 seconds