User Defined Lanaguage - creating a style for LABEL names ending with colon ':'
-
Hi
I’m trying to create a User Defined Language,
However have run into a problem with a style I’m trying to implement.
the Language has defined LABELS which end in the ‘:’ colon character.
Much like the Windows Batch files where the label starts with a ‘:’.I cannot get npp to implement this either as a comment or anything else I’ve tried.
Is their any articles out there for this?
-
You just want it to be “any token that ends in a
:should be considered a LABEL”? Yeah, the User Defined Language lexer isn’t designed to be that complicated: it is intended for a specific list of keywordsThe EnhanceAnyLexer plugin will allow you to add a regex to change the foreground of matching text on a per language (per UDL, or per builtin lexer). Assuming that the LABEL has to be the first non-whitespace sequence on a line, and must be only alphanumeric-and-underscore-before-
:, then the following should make your LABEL green.[your_udl_name_here] 0x00CC00 = ^\h*\w+:
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login