Bram Moolenaar wrote:
Mark Manning wrote:
I saw in the c.vim that there was an error statement for octal numbers.
There isn't one for hex numbers so I made one really quickly. If you
want, just put it into the c.vim file. :-)
The test:
syn region cHexError start="0x\x*[g-zG-Z]" end="\W"
The highlight command:
hi link cHexError cError
Of course, this needs to be approved by Bram first though. :-)
I don't know what the rules are in all kinds of C, but at least things
like 0x0L, 0x0u, 0x0UL are valid.
Using a match instead of region would be simpler.
Actually, I looked through the c.vim file and someone asked me to put
the "ul" on the end. But then I noticed that the part that looked for
underscores was not in c.vim. Here:
"syn match cNumber display contained
"0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"
syn match cHex display contained
"0x\x\+\(u\=l\{0,2}\|ll\=u\)\>\|0x\x\+\(_\x\x\)\+\(u\=l\{0,2}\|ll\=u\)\>"
The commented out line is what is in the c.vim file. I changed the
cNumber to cHex since there is a cOctal I figured "Why not?". However,
I'm still working on consolidating it down. I'm thinking that if I
change the "\+" to a "\*" after the "\(_\x\x\)" that I might be able to
combine the two parts down to just one Like I said though, I'm still
working on it. :-/ Gotta go right now though, going on a job
interview. :-)
PS: In my c.vim file I also made sure to insert the cHex and cHexError
into all of the same places where cOctal and cOctalError were located.
Again, hopefully a diff is coming soon. :-)