• Login
Community
  • Login

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

Scheduled Pinned Locked Moved General Discussion
6 Posts 2 Posters 3.5k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M
    Mikhail Nikitin
    last edited by Nov 7, 2016, 9:26 AM

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

    1 Reply Last reply Reply Quote 0
    • P
      PeterJones
      last edited by Nov 7, 2016, 3:33 PM

      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)

      1 Reply Last reply Reply Quote 0
      • M
        Mikhail Nikitin
        last edited by Nov 8, 2016, 7:43 AM

        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 :-(

        1 Reply Last reply Reply Quote 0
        • P
          PeterJones
          last edited by Nov 8, 2016, 2:02 PM

          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.)

          1 Reply Last reply Reply Quote 0
          • P
            PeterJones
            last edited by Nov 8, 2016, 2:06 PM

            … 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.

            1 Reply Last reply Reply Quote 0
            • M
              Mikhail Nikitin
              last edited by Nov 8, 2016, 2:57 PM

              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 :-)

              1 Reply Last reply Reply Quote 1
              6 out of 6
              • First post
                6/6
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors