langs.xml: Distinguish between range and 'range (apostrophe!)
-
This questions refers to #8511.
Is there a way to make a different coloring for
range
and
'range
or any other keyword once with and the other time without apostrophe <'> .
When I enter the two versions to different keyword types in langs.xml both are colored the same way.
Any idea how to do to get different coloring?
-
In my experience, the keywords (whether default or user-defined) for a given language’s styler (lexer) all must be composed of ASCII “word” characters (
A
-Z
,a
-z
,0
-9
, and_
underscore). Some of the lexer’s might manually override that, but I don’t know of any off the top of my head.In case that’s not clear: as far as I know, what you want cannot be done natively in Notepad++ without a source-code change.
However, you can add extra highlighting to a builtin lexer (like the VHDL lexer) using regexes via the script
EnhanceAnyLexer.py
that @Ekopalypse shares in his github repo – since it’s regex based, it should be fairly easy to set up a regex like'(range|length)
which would recognize'range
or'length
, and color those separately from the builtin non-apostrophe versions(Interesting: in the VHDL definition, the
range
keyword is in both the INSTRUCTION (name="instre1"
) and in the ATTRIBUTE (name="type1"
) lists. The INSTRUCTION formatting takes precedence.) -
@PeterJones Thanks a lot for that very good information!
I´ll see how to deal with this.