Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » NMToken Terminal(Define NMToken terminal)
NMToken Terminal [message #942245] Sat, 13 October 2012 09:53 Go to next message
Evangelos Haleplidis is currently offline Evangelos HaleplidisFriend
Messages: 3
Registered: October 2012
Junior Member
Greetings,

I'm trying to define an NMToken Terminal for an Xtext 2.3 DSL.

I guess the correct definition is something like this:

terminal NMTOKEN:
('a'..'z' | 'A'..'Z' | '_' | '0'..'9' | '.' | '-' | ':')+;

However that rule has a problem when generating Xtext artifacts:
"The following token definitions can never be matched because prior tokens match the same input: RULE_INT"

And i guess it's true as an NMTOKEN may be an INT as well.

Is there a way to properly define an NMTOKEN terminal or any other way i can incorporate it into my DSL?

Thank you.
Re: NMToken Terminal [message #942255 is a reply to message #942245] Sat, 13 October 2012 10:03 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi use a dataype rule instead

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: NMToken Terminal [message #942562 is a reply to message #942255] Sat, 13 October 2012 16:39 Go to previous messageGo to next message
Evangelos Haleplidis is currently offline Evangelos HaleplidisFriend
Messages: 3
Registered: October 2012
Junior Member
Thanks for the quick response.

I guess you mean i write something like this:

(i didn't write all letters just to test)

NMToken:
('a' | 'b' | 'c' | 'd' | 'e' | 'z' | 'A' | 'B' | 'C' | 'D' | 'E' | 'Z' | '_' | '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '.' | '-' | ':')+;


I tried this after you mentioned it and it creates problem. It affects the RULE_INT and i get errors when i write my files.

Any ideas?
Re: NMToken Terminal [message #942569 is a reply to message #942562] Sat, 13 October 2012 16:51 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
I mean

NMToken: (ID | INT | '.' | '-' | ':')+


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: NMToken Terminal [message #942653 is a reply to message #942569] Sat, 13 October 2012 18:59 Go to previous message
Evangelos Haleplidis is currently offline Evangelos HaleplidisFriend
Messages: 3
Registered: October 2012
Junior Member
Thank you very much, that worked perfectly!
Previous Topic:Xtext maven generation
Next Topic:How to use Xtext(M2M with Xtend) and GMF to create diagramm? (Beginner)
Goto Forum:
  


Current Time: Thu Apr 18 23:42:41 GMT 2024

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

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

Back to the top