Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How can I allow any character for a particular type
How can I allow any character for a particular type [message #707323] Mon, 01 August 2011 13:58 Go to next message
Caner Friend
Messages: 98
Registered: July 2011
Member
Hello!
I have a type Freedom,


For example we have an ordinary type ;

Freedom: ID ;

terminal ID : '^'?('a'..'z'|'A'..'Z'|'_'|'.') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')* ;

I want to allow any character for this type, is there any easy way to do that?

BR
Caner

[Updated on: Mon, 01 August 2011 14:07]

Report message to a moderator

Re: How can I allow any character for a particular type [message #707328 is a reply to message #707323] Mon, 01 August 2011 14:11 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

check out the ANY_OTHER terminal rule in the default grammar.

ALex


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Re: How can I allow any character for a particular type [message #707335 is a reply to message #707328] Mon, 01 August 2011 14:19 Go to previous messageGo to next message
Caner Friend
Messages: 98
Registered: July 2011
Member
Hi Alex

terminal ANY_OTHER : '.' ;

there is no any explanation about this, what it does/ how acn i use it? can you explain or give a link?
Re: How can I allow any character for a particular type [message #707342 is a reply to message #707335] Mon, 01 August 2011 14:24 Go to previous message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

it should be terminal ANY_OTHER : . ;
If no other rule terminal rule matches, ANY_OTHER will match as the dot is a wild card. And you use this terminal rule as any other terminal rule. (non-working illustration)

MyString: (ID|STRING|ANY_OTHER)*;

Alex


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Previous Topic:Sorry for Spamming
Next Topic:Datatype rules
Goto Forum:
  


Current Time: Fri Apr 23 13:50:46 GMT 2021

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

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

Back to the top