Posted 15 years ago by elmogallen
Avatar
I want to highlight all of the labels in the code.
ie.
labelname:

The label name isn't a specific keyword because the user makes it up. The only thing that makes it a label is the colon.

Is there an easy way to do this?

I'm thinking there probably is, and it probably has to do with creating a pattern for it, but I don't know where or what the pattern would be.

Any help would be appreciated.

Dave

Comments (3)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
That is pretty easy, just copy the pattern group for IdentifierToken and duplicate it before IdentifierToken. Then rename it to LabelToken. At the end of the pattern, add a space and then colon.


Actipro Software Support

Posted 15 years ago by elmogallen
Avatar
Oh, that is sweet.

I tried doing that over and over and it kept not working, but now I see why. I had it below IdentifierToken, and it was apparently hitting that first.

Dave
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Right, the NFA parser will match a pattern that is defined first before it matches a pattern defined later. So you have to put your most specific patterns first.


Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.