Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Coloring all rule occurrences
Coloring all rule occurrences [message #840823] Tue, 10 April 2012 14:55
Mikko Korpela is currently offline Mikko KorpelaFriend
Messages: 9
Registered: April 2012
Junior Member
Hi,

I've used the example in 2.1.0 documentation (semantic higlight) [would have link to documentation here but I've not yet posted 25 times..] to highlight different parts of my dsl.

The code I've made is ugly. I have different kinds of crossreferences and I would like to have different colorings based on the rule they match to.

For example:
INode n = ..
if (n.getGrammarElement() instanceof CrossReference) {
if(((RuleCall) ((CrossReference) n.getGrammarElement()).getTerminal()).getRule().getName().equals("MacroName")) {
do the coloring for MacroName rule..
... More bad code

Could someone show how to do the thing in a nice way (a link to an example code would be nice) ? I'm hoping for something declarative that I can just say that whenever I have some MacroName use the specified color for MacroName.

Kind Regards,
Mikko Korpela
Previous Topic:Xtext snippets
Next Topic:Problem with 'Five simple steps...'
Goto Forum:
  


Current Time: Fri Apr 19 22:29:36 GMT 2024

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

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

Back to the top