Prefixes for numbers don't work with letters, when using own syntax
Сергей Чепцов 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?
Ruslan Livansky last edited by
Сергей, а что если сделать 0x ключевым словом с префикс-режимом?
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.
If you want a prefix to only allow decimal digits (0-9) after the prefix, use the
Prefix 1box to define the prefix. (That’s useful for binary, octal, and decimal prefixes)
If you want a prefix to also accept other characters, put the prefix in
Prefix 2box, and then put the other characters that you want it to highlight as “numbers” in the
Extras 1box. Yes, it’s confusing that
Prefix 2is associated with
Extras 1, but that’s the way it is.
So, in your example, I am assuming you want
0bto refer to BINARY numbers (which allow “0,1”, which are both included in the automatic set of “decimal digits”), and you want
0xto refer to HEXADECIMAL numbers (which allow “0-9,A,a,B,b,C,c,D,d,E,e,F,f”). Thus, set
0x, and set
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 last edited by
@PeterCJ-AtWork Thanks a lot! It works - prefix 2 and extras 1. Really confusing…