Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Grammar keywords as strings in an unrelated part of an input file.
Grammar keywords as strings in an unrelated part of an input file. [message #1017521] Tue, 12 March 2013 01:38 Go to next message
Robert Heath is currently offline Robert HeathFriend
Messages: 12
Registered: October 2012
Location: San Mateo
Junior Member
Hi, I have what I hope will be a simple question.

In my grammar file I have 'clock' as a keyword in one of my rules. In an unrelated part of the grammar I take a string as valid input and clock is should be valid in this portion. Currently when clock is used as a string, and not in quotes, it is highlighted as a keyword and produces an error. Is there an easy way around this? Thanks.

Edited to clarify a bit.

[Updated on: Tue, 12 March 2013 01:49]

Report message to a moderator

Re: Grammar keywords as strings in an unrelated part of an input file. [message #1017591 is a reply to message #1017521] Tue, 12 March 2013 06:49 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13322
Registered: July 2009
Senior Member
Hi use a data type rule:

ID_PLUS: "mykeyword" | ID;

Some rule: name=ID_PLUS;

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Grammar keywords as strings in an unrelated part of an input file. [message #1018430 is a reply to message #1017591] Wed, 13 March 2013 20:43 Go to previous messageGo to next message
Robert Heath is currently offline Robert HeathFriend
Messages: 12
Registered: October 2012
Location: San Mateo
Junior Member
Thanks Christian, that solves most of my problem. Is there a way for the keyword to not be colored when it's being used as a string? Thanks.
Re: Grammar keywords as strings in an unrelated part of an input file. [message #1018433 is a reply to message #1018430] Wed, 13 March 2013 20:49 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13322
Registered: July 2009
Senior Member
Hi,

guess you have to use semantic highlighting for that


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Grammar keywords as strings in an unrelated part of an input file. [message #1027337 is a reply to message #1018433] Tue, 26 March 2013 21:49 Go to previous message
Robert Heath is currently offline Robert HeathFriend
Messages: 12
Registered: October 2012
Location: San Mateo
Junior Member
Thanks for the help, got the keywords handled, forgot to create a value converter. Still haven't worked out how to selectively disable syntax highlighting of keywords, but it's not a high priority.
Previous Topic:Proxies
Next Topic:Conflicting content assist handlers
Goto Forum:
  


Current Time: Tue Jan 28 23:28:59 GMT 2020

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

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

Back to the top