Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » lexer of Xtext (antlr)(how to negate?)
lexer of Xtext (antlr) [message #725856] Fri, 16 September 2011 01:26 Go to next message
alex.ren2006 is currently offline alex.ren2006Friend
Messages: 46
Registered: June 2011
Member
Hi all,

The document says that we can negate a token like !'a'. In this way we specify a character which is not a. My question is how to specify a character which is neither a nor b. I tried !'ab'. It doesn't work. Any suggestion is highly appreciated.
Re: lexer of Xtext (antlr) [message #725890 is a reply to message #725856] Fri, 16 September 2011 05:54 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

have a look at the org.eclipse.xtext.common.Terminals grammar: !('\n'|'\r')

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: lexer of Xtext (antlr) [message #725891 is a reply to message #725856] Fri, 16 September 2011 05:58 Go to previous message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

the default terminal grammar should contain an example for that. Something like !('a'|'b') should work.

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:Linking and MWE2 creation
Next Topic:CODE GENERATION WITH XTEXT: Someone please help
Goto Forum:
  


Current Time: Fri Apr 19 18:16:08 GMT 2024

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

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

Back to the top