Alternatives can never be matched [message #1838868] |
Sun, 07 March 2021 09:40  |
Eclipse User |
|
|
|
Hi all,
I am having some issues with Xtext.
Lets say that I have the following rules.
Node:
Circle | Square | Triangle
Circle:
Name = ID ;
Square:
Name = ID ;
Triangle:
Name=ID
I get an error saying:
Decision can match input such as "RULE_ID" using multiple alternatives: 1, 2, 3. Alternatives 2,3 can never be matched.
I understand why this happens. being that the name is ID in all of them while creating a node there will be no way to know if it is a circle, square or triangle.
I know that I can add a keyword before the name to distinct them, but I do not want to do that because I have the following statement:
circle+=Circle ("," circle+=Circle)* ";" )*
And if I add a keyword I will get:
Circle c1;
Circle c2;
while I want
Circle c1, c2;
And I also do not want to change ID.
Any way around this?
Many thanks!
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.10371 seconds