Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » The following token definitions are unreachable: RULE_ID
The following token definitions are unreachable: RULE_ID [message #714011] Tue, 09 August 2011 15:30 Go to next message
Robin  is currently offline Robin Friend
Messages: 25
Registered: August 2010
Junior Member
Hi,

maybe someone can help me with a problem I am having.

I have the following grammar:
Content : 
	name=CONTENT_BREAKDOWN;

terminal CONTENT_BREAKDOWN :
	ID PUNCTUATION_OPT;

terminal PUNCTUATION_OPT :
	( '.' | '?' | '!')?;


I have either an ID or an ID that ends with a punctuation. If it ends with the punctuation I also want the punctuation to be matched on the name Variable of the Content object. I tried around with different structures, but I am stuck with the error "The following token definitions are unreachable: RULE_ID".

Any help would be great!

Regards, Robin
Re: The following token definitions are unreachable: RULE_ID [message #714014 is a reply to message #714011] Tue, 09 August 2011 15:38 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13883
Registered: July 2009
Senior Member
hi,

terminal CONTENT_BREAKDOWN :
ID PUNCTUATION_OPT;

hides ID (since PUNCTUATION may be empty), what about using a datatype rule instead

CONTENT_BREAKDOWN :
ID PUNCTUATION_OPT;

~Christian



Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: The following token definitions are unreachable: RULE_ID [message #714301 is a reply to message #714011] Wed, 10 August 2011 09:26 Go to previous message
Robin  is currently offline Robin Friend
Messages: 25
Registered: August 2010
Junior Member
Hi,

of course *facepalms self*! Thanks!! Smile

I ended up with this:
Content : 
	name=ContentBreakdown;
	
ContentBreakdown :
	ID PUNCTUATION?;

terminal PUNCTUATION :
	( '.' | '?' | '!');


I had to move the optional operator ('?') to the ContentBreakdown rule, otherwise it was always expecting a punctuation element.

Regards, Robin

[Updated on: Wed, 10 August 2011 09:27]

Report message to a moderator

Previous Topic:AdditionalProposalInfo for enum rule
Next Topic:[xbase] value coercion
Goto Forum:
  


Current Time: Fri Apr 16 03:30:29 GMT 2021

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

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

Back to the top