I am stuck with the following ambiguous rules in Xtext:
UnaryExpression returns ExpressionAtom:
..................
| EXISTS? '(' SelectStatement ')'
| '(' Expressions ')'
//nestedExpression
;
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?