UDL (User-defined language) request 2: extend number style

  • How can I have UDL highlight time constant, which is defined as HH:mm:ss (e.g. 01:30:00)?

  • If the colon (:) is in your UDL > Operators & Delimiters > Operators 1 list, then UDL will parse the 01, 30, and 00 as numbers (though the colon itself will not be shown as part of the number)

  • Yes, it will. But:

    • The colon itself won’t be colourized as a number (but as an operator)
    • In the following construct, the last numerical part is not parsed: <Limit>00:01:00</Limit>

    My definitions are:

    • Operator 1: , ( ) = + - * / % & :
    • Delimiter 3: Open <, Close > (to at least somehow handle XML data)

    As a comment, HEREDOC cannot be set up together with my Delimiter 3 :-(

  • Unfortunately, at some point, the desires for a language-definition outgrow the abilities of the UDL. Fortunately, at that point, there is the potential for writing a custom lexer plugin for NPP. (Sorry, can’t help you there.)

  • … Then you have to ask yourself, “is the 80-90% coverage of what I want that UDL gives good enough, or do I need to invest the time and/or money in developing for myself or having someone else develop a lexer plugin to do exactly what I want?” That’s something only you can answer for yourself. Though there may be other NPP users on this forum who can help you get more out of the UDL than I know how to do.

  • Well, I didn’t expect UDL to be capable of doing it at the moment, as far as I could read the documentation, but it might eventually enhance a constant literal rule from only covering a subset of ASCII numbers (e.g. +1,024.50 or 6.19e-23 won’t be matched either, afaik) to some more complex definitions, where the time definition might find its place :-)

Log in to reply