Community
    • Login

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

    Scheduled Pinned Locked Moved General Discussion
    6 Posts 2 Posters 3.9k Views 1 Watching
    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.
    • Mikhail NikitinM Offline
      Mikhail Nikitin
      last edited by

      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
      • PeterJonesP Offline
        PeterJones
        last edited by

        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
        • Mikhail NikitinM Offline
          Mikhail Nikitin
          last edited by

          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
          • PeterJonesP Offline
            PeterJones
            last edited by

            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
            • PeterJonesP Offline
              PeterJones
              last edited by

              … 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
              • Mikhail NikitinM Offline
                Mikhail Nikitin
                last edited by

                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

                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
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors