Community
    • Login

    Prefixes for numbers don't work with letters, when using own syntax

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 4 Posters 2.7k 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.
    • Сергей ЧепцовС
      Сергей Чепцов
      last edited by

      I make my own syntax for Atmel AVR Assembler, because one’s Studio is too heavy for a netbook, so I write code with NP++.

      I’ve set prefixes for numbers: 0b, 0x, and $. And colors for numbers too.
      Problem is, that NP++ doesn’t want to highlight numbers with letters, e.g. 0xFF, 0xA1 and so on.
      Numbers with digits only are highlighted and everything is ok.

      Built-in syntaxes (I’ve tested on C#) work without problems.

      What am I doing wrong?

      1 Reply Last reply Reply Quote 0
      • Ruslan LivanskyR
        Ruslan Livansky
        last edited by

        Сергей, а что если сделать 0x ключевым словом с префикс-режимом?

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

          @Сергей-Чепцов, UDL 2.1 does have the feature you’re looking for, documented at http://ivan-radic.github.io/udl-documentation/numbers/ . The first time I read through, I misunderstood, so it took me some experimenting.

          1. If you want a prefix to only allow decimal digits (0-9) after the prefix, use the Prefix 1 box to define the prefix. (That’s useful for binary, octal, and decimal prefixes)

          2. If you want a prefix to also accept other characters, put the prefix in Prefix 2 box, and then put the other characters that you want it to highlight as “numbers” in the Extras 1 box. Yes, it’s confusing that Prefix 2 is associated with Extras 1, but that’s the way it is.

          So, in your example, I am assuming you want 0b to refer to BINARY numbers (which allow “0,1”, which are both included in the automatic set of “decimal digits”), and you want 0x to refer to HEXADECIMAL numbers (which allow “0-9,A,a,B,b,C,c,D,d,E,e,F,f”). Thus, set Prefix 1 = 0b, set Prefix 2 = 0x, and set Extras 1 = A B C D E F a b c d e f. (The 0-9 are allowed after any prefix, so you don’t have to include them in the list)

          Сергей Чепцов68С 1 Reply Last reply Reply Quote 2
          • Сергей Чепцов68С
            Сергей Чепцов68 @PeterJones
            last edited by

            @PeterCJ-AtWork Thanks a lot! It works - prefix 2 and extras 1. Really confusing…

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