Color a Pre-Processor Directive

SyntaxEditor for Windows Forms Forum

Posted 14 years ago by Matthew Smith - Australia
Avatar
Hi,

Using a pre-processor directive, I have the following correctly outlining:

Rem

End Rem

What I need is to color that entire section (including any words within the section) the required style - in this case green. Is this possible?

I have looked at the /* */ example in the C# Language definition as a guide to just colorising it, but changing /* to Rem and */ to End Rem will not work - it colors everything from that point on.

Can anyone give any advice?

Comments (1)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
This one is tricky because of the lexical parsing order of patterns:
1) See if a parent scope (outside of the current language) ends the state
2) Look for a child state start
3) Loop through the pattern groups until one is found that matches...
4) See if a parent scope (inside the current language) ends the state

So what's happening here (if you are just changing the C# /* */ sample), is that the MultiLineCommentWordToken and MultiLineCommentDefaultToken patterns (#3 above) are matching before the end scope (#4 above).

You can either remove those patterns, or can make the comment its own child language.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 6 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.