Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » terminal ID is not accepting only upper case letters
terminal ID is not accepting only upper case letters [message #1470591] Wed, 12 November 2014 13:15 Go to next message
Tobias Wink is currently offline Tobias WinkFriend
Messages: 20
Registered: September 2014
Junior Member
In org.eclipse.xtext.xbase.Xtype.xtext the terminal ID is defined by
terminal ID:
	'^'? ('a'..'z'|'A'..'Z'|'$'|'_') ('a'..'z'|'A'..'Z'|'$'|'_'|'0'..'9')*;


According to the Xtext Documentation:
Quote:
It says that a token ID starts with an optional '^' character (caret), followed by a letter ('a'..'z'|'A'..'Z') or underscore '_' followed by any number of letters, underscores and numbers ('0'..'9').


So far, so good.

But if I want to use "ATX" as ID I got the error "mismatched input 'ATX' expecting RULE_ID". With 'B2' the same. But 'Atx' is fine.

My corresponding rule is:
Entity:
	'entity' name=ID '{'...'}'


Can anybody please explain me what I'm doing wrong?
Re: terminal ID is not accepting only upper case letters [message #1470597 is a reply to message #1470591] Wed, 12 November 2014 13:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
hi is ATX a keyword in your grammar?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: terminal ID is not accepting only upper case letters [message #1470614 is a reply to message #1470597] Wed, 12 November 2014 13:31 Go to previous messageGo to next message
Tobias Wink is currently offline Tobias WinkFriend
Messages: 20
Registered: September 2014
Junior Member
Christian Dietrich wrote on Wed, 12 November 2014 14:20
hi is ATX a keyword in your grammar?


Oh, this I've missed to mention. No ATX is not a keyword, instead I can exchange ATX with ABC with the same result.
Re: terminal ID is not accepting only upper case letters [message #1470617 is a reply to message #1470614] Wed, 12 November 2014 13:34 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
do you have any other terminals defined? can you share a minimal grammar?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: terminal ID is not accepting only upper case letters [message #1471530 is a reply to message #1470617] Thu, 13 November 2014 06:27 Go to previous messageGo to next message
Tobias Wink is currently offline Tobias WinkFriend
Messages: 20
Registered: September 2014
Junior Member
Thanks Christian.

You pushed me in the right direction. The grammar still contained an old, no longer used, terminal definition which caused the problem:
terminal ENUM_NAME:
    ('A'..'Z' | '_') ('A'..'Z' | '_' | '0'..'9')*;


[Updated on: Thu, 13 November 2014 06:28]

Report message to a moderator

Re: terminal ID is not accepting only upper case letters [message #1471735 is a reply to message #1470614] Thu, 13 November 2014 09:46 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Could you provide the complete grammar and maybe a unit test?
I just tried an all uppercase keyword and it works.

Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: terminal ID is not accepting only upper case letters [message #1471757 is a reply to message #1471735] Thu, 13 November 2014 10:04 Go to previous message
Tobias Wink is currently offline Tobias WinkFriend
Messages: 20
Registered: September 2014
Junior Member
Sebastian Zarnekow wrote on Thu, 13 November 2014 10:46
Could you provide the complete grammar and maybe a unit test?
I just tried an all uppercase keyword and it works.



The problem is solved. It was my error because I had the not longer used terminal ENUM_NAME I posted before.
Previous Topic:Interrupt inferring
Next Topic:Xtext to notify the modified Object
Goto Forum:
  


Current Time: Thu Apr 25 16:09:53 GMT 2024

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

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

Back to the top