-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
syntax: Fix hex and octal int and errors highlight #2584
Changes from 8 commits
eb587eb
3da87d6
7a7a5df
c5ad443
3a23084
b30bb2d
fb643bf
f6ed8b6
67e76b8
2c6b985
cf661f5
fc8cef8
cc54040
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -162,15 +162,17 @@ endif | |
syn match goSingleDecl /\%(import\|var\|const\) [^(]\@=/ contains=goImport,goVar,goConst | ||
|
||
" Integers | ||
syn match goDecimalInt "\<-\=\(0\|[1-9]\d*\)\%([Ee][-+]\=\d\+\)\=\>" | ||
syn match goHexadecimalInt "\<-\=0[xX]\x\+\>" | ||
syn match goHexadecimalError "\<-\=0[xX]\x*[^ \t0-9A-Fa-f]\S*\>" | ||
syn match goOctalInt "\<-\=0\o\+\>" | ||
syn match goOctalError "\<-\=0[XxBb\]]\@!\o*[^ \t0-7]\S*\>" | ||
syn match goBinaryInt "\<-\=0[bB][01]\+\>" | ||
syn match goBinaryError "\<-\=0[bB][01]*[^ \t01]\S*\>" | ||
syn match goDecimalInt "\<-\=\(0\|[1-9]_\?\(\d\+_\?\)*\)\%([Ee][-+]\=\d\+\)\=\>" | ||
syn match goDecimalErrorInt "\<-\=\(_\(\d\+_*\)\+\|\([1-9]\d*_*\)\+_\{2,\}\(\d\+_*\)\+\|\([1-9]\d*_*\)\+_\+\)\%([Ee][-+]\=\d\+\)\=\>" | ||
syn match goHexadecimalInt "\<-\=0[xX]_\?\(\x\+_\?\)\+\>" | ||
syn match goHexadecimalError "\<-\=0[xX]_\?\(\x\+_\?\)*\(\([^ \t0-9A-Fa-f_]\|_\{2,\}\)\S*\|_\)\>" | ||
syn match goOctalInt "\<-\=0[oO]\?_\?\(\o\+_\?\)\+\>" | ||
syn match goOctalError "\<-\=0[0-7oO_]*\(\([^ \t0-7oOxX_/]\|[oO]\{2,\}\|_\{2,\}\)\S*\|_\|[oO]\)\>" | ||
syn match goBinaryInt "\<-\=0[bB]_\?\([01]\+_\?\)\+\>" | ||
syn match goBinaryError "\<-\=0[bB]_\?\([01]\+_\?\)*\([^ \t01_]\S*\|_\{2,\}\S*\|_\)\>" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for both goBinaryInt and goBinaryError, wouldn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it's syntactically in incorrect, but that's what There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gotcha. Technically no, cuz it doesn't match on |
||
|
||
hi def link goDecimalInt Integer | ||
hi def link goDecimalErrorInt Error | ||
hi def link goHexadecimalInt Integer | ||
hi def link goHexadecimalError Error | ||
hi def link goOctalInt Integer | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What value does this add over octalErrorTrailing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For checking a specific subgroup that matches on "oO". We need this group cuz we allow 'oO' in this subgroup
[^ \t0-7oOxX_/]
. And just realized that we need to expand that specific subgroup to [oOxX] to match on0123x
.