UDL numbers problem



  • Good day to everyone. I managed to somehow add my first UDL in Notepad++ v7.8.9 but one thing still concern me too much to start using it just right now…

    So here’s the deal. I’m using some specified keywords like “ScriptItemActObject1”, “t_OnAnotherItem2” and so on. They are contained a number on their tails. I cannot rename this keywords, so I really need to adapt them for normal work with UDL.
    Still, then I’m trying to do that, Notepad is just giving me huge bag of frustration. Since I read many topics about “How hard to add correct prefix/suffix” to the numbers highlight, I was never expecting to this:
    29d1e14e-1691-4f5e-a9ba-ec5192342a7c-image.png
    As you may see, numbers here got the priority over my keywords, but I can’t really understand why. It seems even more frustrating, since I never added any additional symbols to number highlights (instead of one “.”) at all:
    6b6534f7-330e-42e8-8619-32803ca1415f-image.png

    Any possible recommendations are welcomed.



  • @Ivan-Karpov said in UDL numbers problem:

    I am not sure what difficulty you are having. If I set up those two strings as keywords, and set the numerical colors to something different, I can easily tell the difference between the two:
    67342486-9572-49b4-81c5-226043836456-image.png
    3a3f678b-f938-4989-a4fb-d3f32670df97-image.png

    If you want more help, you will have to give us more information, because I cannot replicate your problem with the simple example I just showed.



  • All right… It might as well be some kind of delimiters problem. You need to add these group of keywords and the numbers inside any delimiter and then it turns out to look like this:
    d8177997-8596-4238-9171-c3d9f5ec6466-image.png
    bb1ab0f6-bd7a-4612-b141-9cc2f30ee57a-image.png

    Same if I clear all unnumbered keywords:
    6dd0a199-91f0-4036-9b08-b1adbbc374fa-image.png



  • @Ivan-Karpov ,

    The UDL definition is not infinitely powerful, nor even a full programming langauge; if you keep looking, you will eventually found its limits – and you appear to have found one. I assume it’s not really inside quotes, but inside a function’s argument-list parentheses, where you want numbers formatted as numbers, and keywords as keywords. Either you need to just not mark the parentheses as delimiters (since you don’t seem to want stuff in the parentheses to be treated differently than the stuff outside), or you need an alternate way of highlighting instead of relying on the UDL syntax.

    So, if you need parentheses as delimiters, I suggest to use the PythonScript plugin, which can be used to add/change formatting from a builtin or UDL lexer using regexes, via the script EnhanceAnyLexer.py that @Ekopalypse shares in his github repo : install the PythonScript plugin, create the script and populate it, then change the regexes to something that matches the “mix-formatted” keywords-with-numbers, and



  • @PeterJones said in UDL numbers problem:

    I suggest to use the PythonScript plugin

    Thanks, but I was looking more common way to fix this npp behavior.
    I’m afraid this script is too much for me to figuring out how it’s works (EnhanceAnyLexer I mean).
    Anyway, will try to check it.



  • In the end I just set up all numbers as keywords with prefix and turn nums off from all delimiters entirely :|
    473dc126-0bce-45db-94c2-5046979a16f9-image.png

    Guess it’s just works for me from now on. The stupid number priority is gone and I’m even still able to use HEX constants like 0x80LOL123.

    Will update this topic if I find any problems with such solution.



  • @PeterJones

    Sorry to bother you once more… But is there any way to add all needed keywords groups from my UDL to automatically hintbox dropdown?
    Maybe some kind of plugin already exist for that purpose?



  • @Ivan-Karpov

    you have to create an autocomplete file like described here.
    Regarding your previous issue about keywords and numbers,
    I’m not sure I understand your solution.
    prefix mode normally means defining a keyword like ScriptItemActObject and get everything colored which start
    with those keywords like ScriptItemActObject1, ScriptItemActObject2
    but also words like ScriptItemActObjectAndWhatEverIsAttached



  • @Ekopalypse said in UDL numbers problem:

    but also words like ScriptItemActObjectAndWhatEverIsAttached

    Sure do. But while I’m using prefix only on number simbols, I most likely, never will fall into 0.1AndWhatEverIsAttached problem, because there’s always some operators on the way ahead this numbers. And since my prefix “numeric” keywords has a lower priority than normal keywords, such a ScriptItemActObject1, it’s highlights only after them which is totally fine for my needs by now.

    Here’s an example of how it looks:
    9342a603-9e1a-4ea7-b54c-a4951e3f8762-image.png

    Too bad, UDL functions are some buggy ad sometimes makes some errors in highlighting system:
    2d0eb698-d57e-492c-a032-8c2eca28d8cb-image.png

    Yet, this is not depends on my “numbers-keywords”, just some regular errors in UDL code.



  • @Ivan-Karpov

    just some regular errors in UDL code.

    Yes - I have also seen other problems like strange folding markers.
    Unfortunately I’m not really a C++ guy and don’t know the code base
    of UDLs enough to understand if this is something that needs to be
    changed because of the introduced scintilla changes.



  • @Ekopalypse said in UDL numbers problem:

    Yes - I have also seen other problems like strange folding markers.

    The most strange about folding markers in UDL is that I can’t use them with stylers. There’s just no options to highlight any groups of keywords or other anything else inside the folding markers. Instead I may create “folding” markers as a delimiter, but then it just refuse to folding anymore :/
    And I can’t just adjust delimiter and folding markers with the same symbols, because delimiters have absolute priority over folding markers.



  • @Ivan-Karpov

    No, what I meant refers to such an issue

    d22dd10b-82a0-4edd-8ef4-23896e3170c2-image.png

    where the folding marker is out of sync with the code block.


Log in to reply