I am writing a custom TextMate / Sublime Text 2
bundle for 6502 Assembly language.
Anyway, I want to be able to identify constants, variables, etc.
I have this for HEX
numbers:
<dict>
<key>match</key>
<string>#?\#[0-9a-fA-F]+</string>
<key>name</key>
<string>constant.numeric.decimal</string>
</dict>
But it doesn't really work for the following:
#14 // works
#$2F // works
#coolVariable // doesn't work. The "#c" is caught and colored but the rest is not.
// In this case, I DON'T want any of it to be colored.
Like the code says, it shouldn't color the #coolVariable
but it's grabbing the #c
piece of it.
I want to color variables like that separately. What would be the regex to differentiate between the two patterns?
So that:
#c0 // Caught by one pattern (values in decimal or hexadecimal or binary)
#%10101 // Caught by one pattern (values in decimal or hexadecimal or binary)
#c0BLAH // Caught by another pattern
Thanks
\#[0-9a-fA-F]+\b
To mark that the word must end before any other characters are used.