UDL Multiple Styles/Colors for Operators
tldr; Is it possible to have two groups of operators, each one having their own style?
I’m not a coder, I’m using npp for translating games, there is some code tinkering involved, but I mostly work on normal text. That’s why default Languages don’t really work for me so I’ve decided to define my own.
I’ve pretty much got everything how I wanted, but I would like to have some symbols highlight with different colors: " ( ) with one, and . , ? ! with the other. Is this possible e.g. through editing UDL file?
No, UDL only has one style associated with both the Operators1 and Operators2 fields, so all operators will use the same color, if using only the UDL feature set. Sorry.
But you can add extra highlighting to a User Defined Language (UDL) using regexes via the PythonScript plugin in conjunction with the script
EnhanceAnyLexer.pythat @Ekopalypse shares in his github repo – the comments in the script explain how to install and customize it. If you give it a go, and need help, feel free to show what you’ve got so far, and @Ekopalypse or one of the regulars here will probably be able to nudge you in the right direction.
In addition to what Peter has mentioned, you could get a different color for the parenthesis by using them as delimiters of which there are 8 slots to put them and style them.
Open: ( ?
Close: ) !
Other than that, Peters right that you can’t style the operators 1 or 2 differently than the one style. Good Luck.
Well, now I feel dumb.
Somehow I didn’t realised what Nesting is for. Eh.
I was able to rearrange everything and make it work.
Thanks for help guys.