Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Mark Keywords within a String terminal
Mark Keywords within a String terminal [message #717742] Mon, 22 August 2011 08:38 Go to next message
Timo Missing name is currently offline Timo Missing nameFriend
Messages: 12
Registered: March 2011
Junior Member
Hi there,

I was wondering if it is possible to mark words within a String, without completely rewriting my grammar.

Example:
sql:="SELECT ''Name'' FROM Person WHERE ''Reference'' IS NOT NULL";


These are very common assignments in my DSL. the double-singlequotes are replaced according to the current database escape char.
All my Strings are blue, but for better readability I'd like to mark everything between '' in a different color.

I'm doing something similar for EObjects using ISemanticHighlightingCalculator, but is it also possible for terminals?

Thanks for input!
Timo
Re: Mark Keywords within a String terminal [message #717749 is a reply to message #717742] Mon, 22 August 2011 08:44 Go to previous message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

there is no reason, not to do that via semantic highlighting as well. If you want to highlight the whole string differently, it is quite simple, if you want to highlight certain sections only, you have to parse the string yourself in order to calculate the regions.

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:How to generate code using Xtext and Xtend?
Next Topic:Xtend2 Codegen in running Eclipse instance
Goto Forum:
  


Current Time: Wed Apr 14 08:19:43 GMT 2021

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

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

Back to the top