Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » keyword in another scope as an ID?
keyword in another scope as an ID? [message #830328] Tue, 27 March 2012 13:42 Go to next message
Phil R is currently offline Phil RFriend
Messages: 99
Registered: September 2011
Member
Hi,

When a keyword is defined, for example "mykey", which is allowe to be typed at specific locations. How could the word "mykey" be used as an identifier to declare something at other locations. The mykey is always recognized as a keyword when it shouldn't at some places. How to allow this behaviour?

example:
mykey scopekey { // mykey is a keyword
  name = mykey // here mykey should be just a word
}


Regards,
Phil
Re: keyword in another scope as an ID? [message #830337 is a reply to message #830328] Tue, 27 March 2012 13:54 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Introduce a data type rule, and customize highlighting if you need it

MyID: "my keyword" |ID;


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: keyword in another scope as an ID? [message #830495 is a reply to message #830337] Tue, 27 March 2012 18:06 Go to previous messageGo to next message
Phil R is currently offline Phil RFriend
Messages: 99
Registered: September 2011
Member
Hi Christian,

That's what I first created, however I was wondering if there is a better solution if this "problem" occurs for a lot of keywords at a lot of different locations...

Regards,
Phil
Re: keyword in another scope as an ID? [message #830520 is a reply to message #830495] Tue, 27 March 2012 18:44 Go to previous message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

next to excaping keywords (^mykey) where they are to be used as simple IDs (^ is removed automatically be the ID value converter), a data type rule is the default solution.
...In general keywords are keywords for a reason.

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:Build GMF on top of my Xtext Project
Next Topic:setup with multiple xtext files in project
Goto Forum:
  


Current Time: Thu Apr 25 08:14:04 GMT 2024

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

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

Back to the top