Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Error in entering an ID having the same name as a keyword(Runtime error)
Error in entering an ID having the same name as a keyword [message #1800639] Fri, 04 January 2019 04:13 Go to next message
Eclipse UserFriend
Hi,

I have created an Xtext grammar language in which I have a keyword named 'Name'. When I try to enter 'Name' as an ID for another rule in runtime, I get an error stating "mismatched input 'Name' expecting RULE_ID".
Could you please let me know whether it is possible to allow entering the same name as a keyword for an ID?

Regards!

[Updated on: Fri, 04 January 2019 04:13] by Moderator

Re: Error in entering an ID having the same name as a keyword [message #1800640 is a reply to message #1800639] Fri, 04 January 2019 04:14 Go to previous messageGo to next message
Eclipse UserFriend
You can using a datatype rule. This is explained here
https://blogs.itemis.com/en/xtext-hint-identifiers-conflicting-with-keywords
Re: Error in entering an ID having the same name as a keyword [message #1800716 is a reply to message #1800640] Mon, 07 January 2019 02:21 Go to previous messageGo to next message
Eclipse UserFriend
Or you use the out-of-the-box option to prefix a keyword with a "^":

enter "^Name" instead of "Name"
Re: Error in entering an ID having the same name as a keyword [message #1800722 is a reply to message #1800716] Mon, 07 January 2019 04:37 Go to previous message
Eclipse UserFriend
Hi Christian and Uli,

Both of your solutions worked for me. Since I needed the keywords as they are for identifiers, I used Christian's solution.
Thank you both for the support!

Regards!
Previous Topic:Non-Standard import and namespace
Next Topic:How does the XVariableDeclaration rule result in an ecore class that extends JvmIdentifiableElement?
Goto Forum:
  


Current Time: Wed Jun 18 22:57:44 EDT 2025

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

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

Back to the top