Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    UDL - User Defined Languages has some very silly limits

    General Discussion
    9
    11
    10092
    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.
    • NeatNit Gralporit
      NeatNit Gralporit last edited by

      I’ve just discovered something terrible. Numbers don’t get detected unless they’re COMPLETELY separate. That means:
      array[200] no number detected
      array[20, 30] no number detected
      array[ 20, 30] no numbers detected
      array[ 20 , 30 ] both numbers detected and colored

      WTF?!

      tomas-chrastina 1 Reply Last reply Reply Quote 1
      • sanastasiou
        sanastasiou last edited by

        Just write your own lexer, way simpler and efficient ;)

        1 Reply Last reply Reply Quote 0
        • NeatNit Gralporit
          NeatNit Gralporit last edited by

          How do I do that?

          1 Reply Last reply Reply Quote 0
          • tomas-chrastina
            tomas-chrastina @NeatNit Gralporit last edited by tomas-chrastina

            @NeatNit-Gralporit
            For number detection of your example, you need to define Operators 1 as:

            [ ] ,
            
            1 Reply Last reply Reply Quote 0
            • Ebm Dendermonde
              Ebm Dendermonde last edited by

              Hi NeatNit,

              To detect the numbers you can try the method Claudia-Frank mentioned in my topic. It worked for me!
              https://notepad-plus-plus.org/community/topic/11187/need-help-defining-udl

              1 Reply Last reply Reply Quote 0
              • Tim Jarrett
                Tim Jarrett last edited by

                I have just discovered the exact same problem. It’s all very well defining special operators but when the operators are already defined, it doesn’t work for numbers. The problem is that the number identifier in NotePad++ expects whitespace before and after; when other items are used the detection fails. I have many files that have numbers delimited by commas and brackets and colons and a multitude of other characters, and NP++ misses them all. A better method of detecting a number would probably be whitespace or non-alpha characters as delimiters, so ,4152, [11:22:33], *115454, and [0xffff] would all be detected correctly.

                1 Reply Last reply Reply Quote 0
                • donho
                  donho last edited by

                  @NeatNit-Gralporit The fact UDL doesn’t meet your needs doesn’t mean that it has “silly limit”.
                  Notepad++ source code can be accessed by everyone, so if there are any part doesn’t match your needs, you are welcome to submit the pull request of your modification :
                  https://github.com/notepad-plus-plus/notepad-plus-plus

                  Keep one thing in mind that a lot of people work hard for contributing to this project/product, that you’re using with no charge. We don’t ask you to be grateful, we ask you only having a decent attitude when you do your feature request or bug report. I don’t think it’s too much to ask for it.

                  1 Reply Last reply Reply Quote 1
                  • WildCactuar
                    WildCactuar last edited by

                    I have a similar issue, I want to pain any 6 digit number in a specific color, and any phone number ###-###-#### in another color. Any idea how to do that?

                    1 Reply Last reply Reply Quote 0
                    • PeterJones
                      PeterJones last edited by

                      @WildCactuar said:

                      I have a similar issue

                      It still would have been better to start a new topic for your question than to re-vivify a 4-year-old topic that’s only vaguely related. However, since my comments would apply to any customization/add-on of the UDL highlighting capability, not just your one specific use, it’s still on-topic for this thread.

                      AFAIK, UDL isn’t equipped for distinguishing between real numbers and number-like things (like phone or SSN or similar).

                      However, @ekopalypse has published his PythonScript-plugin-based EnhanceUDLLexer.py or the more-generic EnhanceAnyBuiltinLexer.py, which can be used to add regex-based highlighting to any UDL or any builtin lexer (I don’t know whether the latter also works on UDL, or whether you have to use the former for UDL – but Eko could chime in).

                      1 Reply Last reply Reply Quote 2
                      • Ekopalypse
                        Ekopalypse last edited by

                        Correct, the EnhanceUDLLexer.py is optimized for UDLs whereas
                        EnhanceAnyBuiltinLexer.py should be used for builtin lexers.

                        @WildCactuar - if you are using a recent npp version, like npp 7.7 onwards then
                        pythonscript plugin can only be used if you are using a 32bit version. 64bit is broken.
                        If it is only about to get the telephone numbers highlighted, then you might think of using
                        a regular expression like \d{3}-\d{3}-\d{4} and using mark feature from find dialog.
                        Record a macro if you want to reuse it more often.

                        1 Reply Last reply Reply Quote 2
                        • First post
                          Last post
                        Copyright © 2014 NodeBB Forums | Contributors