Community
    • Login

    Range Comand of Numbers in UDLdidn't work

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 406 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.
    • hans gerchH
      hans gerch
      last edited by hans gerch

      Hi Guys,
      I’m working long time with Notepad++ and it’s a great tool. Today I’ve started do define an UDL for an internal used skript.
      It all works fine until I want to define the Numbers…

      The goal is to highlight all Numbers without 0 in RED

      • So Highlight all in RED (this is easy and was done by define the Style in the section Numbers)
      • Don’t Highlight 0 (that’s the hard one…)
        I’ve used the Range to advice unsing only a special area, but wihtout sucsess. It seem to me that this command didn’t work anyway (see screenshoot of a test)
        b5e8220e-f2ef-44a5-8be6-45d5f1653bbf-image.png
        I’ve tried as well 1::5 or 1->5 like deskripted by Ivan (https://ivan-radic.github.io/udl-documentation/numbers/) but without sucsess
        The other stuff like Präfix or Suffix works…

      scond level would be If I would be able to have all Numbers in RED and the 0 in GREEN. I tried to use Keywords (like I’ve done it before for some comands), but It looks like this didn’t work with Numbers.

      I hope someone can show me an easy solution for this

      Thanks in advance

      1 Reply Last reply Reply Quote 0
      • guy038G
        guy038
        last edited by guy038

        Hello, @hans-gerch and All,

        The Range field ( Bereich ) is not intended to define the range of numbers

        It’s just a kind of suffix-prefix symbol(s) which will be highlighted, like the numbers placed right before and, possibly, the numbers located right after

        For instance, if that Range zone contains - :: __ ( a single dash, a double colon or a double underscore chars ), this means that, for instance, all the strings, below, will be highlighted in red

        2-0.5
        100::47
        0.003__7.785
        0000::
        

        Now, I’m not very acquainted with UDL and I don’t see an obvious way to distinguish the digit 0 from the other digits ! I’m afraid that it cannot be do with the native N++ UDL feature.

        However, you could use an enhanced UDL lexer, which could manage, differently, the 0 digit from the others. Two conditions :

        • Firstly, install the PythonScript plugin ( last version 1.5.4, using Python v2.7.18 )

        • Secondly, use the EnhanceUDLLexer.py Python script, created by @ekopalypse, from that post :

          • https://notepad-plus-plus.org/community/topic/17134/enhance-udl-lexer/31

        Best Regards,

        guy038

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