Skip to main content



      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 11:30 Go to next message
Eclipse UserFriend
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 11:38 Go to previous messageGo to next message
Eclipse UserFriend
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

Re: The following token definitions are unreachable: RULE_ID [message #714301 is a reply to message #714011] Wed, 10 August 2011 05:26 Go to previous message
Eclipse UserFriend
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 05:27] by Moderator

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


Current Time: Tue Jul 01 15:31:12 EDT 2025

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

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

Back to the top