Skip to main content



      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 08:15 Go to next message
Eclipse UserFriend
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 08:20 Go to previous messageGo to next message
Eclipse UserFriend
hi is ATX a keyword in your grammar?
Re: terminal ID is not accepting only upper case letters [message #1470614 is a reply to message #1470597] Wed, 12 November 2014 08:31 Go to previous messageGo to next message
Eclipse UserFriend
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 08:34 Go to previous messageGo to next message
Eclipse UserFriend
do you have any other terminals defined? can you share a minimal grammar?
Re: terminal ID is not accepting only upper case letters [message #1471530 is a reply to message #1470617] Thu, 13 November 2014 01:27 Go to previous messageGo to next message
Eclipse UserFriend
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 01:28] by Moderator

Re: terminal ID is not accepting only upper case letters [message #1471735 is a reply to message #1470614] Thu, 13 November 2014 04:46 Go to previous messageGo to next message
Eclipse UserFriend
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 05:04 Go to previous message
Eclipse UserFriend
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: Sat Jul 12 10:21:52 EDT 2025

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

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

Back to the top