Community
    • Login

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

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

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

        1 Reply Last reply Reply Quote 0
        • PeterJonesP Offline
          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С Offline
            Сергей Чепцов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

            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