Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Ambiguous rules and Predicate behavior
Ambiguous rules and Predicate behavior [message #1861641] Tue, 24 October 2023 23:25
Sohaib Hamioud is currently offline Sohaib HamioudFriend
Messages: 4
Registered: September 2023
Junior Member
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?
Previous Topic:How to customize the scope of a reference
Next Topic:Content validation depending on file extension
Goto Forum:

Current Time: Thu Dec 07 16:20:51 GMT 2023

Powered by FUDForum. Page generated in 0.01530 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top