Skip to content

Commit

Permalink
syntax: remove the numeric error matches
Browse files Browse the repository at this point in the history
Remove the numeric error matches, because the regular expression
patterns are incredibly difficult to get right and will likely never be
fully correct. They are also of limited value given the correct
highlighting of the valid numeric matches. Additionally, the errors are
not flagged by `gopls` w/ the diagnostic text properties and building
also identifies any problems.
  • Loading branch information
bhcleek committed Apr 15, 2022
1 parent ac9c362 commit 6db2fcb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ IMPROVEMENTS:
[[GH-3391]](https://github.com/fatih/vim-go/pull/3391)
* Add syntax support for generics.
[[GH-3397]](https://github.com/fatih/vim-go/pull/3397)
* Remove invalid numeric literal highlighting.
[[GH-3404]](https://github.com/fatih/vim-go/pull/3404)

BUG FIXES:
* Handle terminating parenthesis on hexadecimal values.
Expand Down Expand Up @@ -96,8 +98,6 @@ BUG FIXES:
[[GH-3386]](https://github.com/fatih/vim-go/pull/3386)
* Fix `:GoDebugConnect` argument handling.
[[GH-3400]](https://github.com/fatih/vim-go/pull/3400)
* Fix syntax highlighting of some numeric error matches.
[[GH-3403]](https://github.com/fatih/vim-go/pull/3403)

## v1.25 - (April 18, 2021)

Expand Down
8 changes: 4 additions & 4 deletions syntax/go.vim
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ syn match goSingleDecl /\%(import\|var\|const\) [^(]\@=/ contains=g

" Integers
syn match goDecimalInt "\<-\=\(0\|[1-9]_\?\(\d\|\d\+_\?\d\+\)*\)\%([Ee][-+]\=\d\+\)\=\>"
syn match goDecimalError "\<-\=\(_\(\d\+_*\)\+\|\([1-9]\d*_*\)\+__\(\d\+_*\)\+\|\([1-9]\d*_*\)\+_\+\)\%([Ee][-+]\=\d\+\)\=\>"
"syn match goDecimalError "\<-\=\(_\(\d\+_*\)\+\|\([1-9]\d*_*\)\+__\(\d\+_*\)\+\|\([1-9]\d*_*\)\+_\+\)\%([Ee][-+]\=\d\+\)\=\>"
syn match goHexadecimalInt "\<-\=0[xX]_\?\(\x\+_\?\)\+\>"
syn match goHexadecimalError "\<-\=0[xX]_\?\(\x\+_\?\)*\(\([^-+%&|^*/ \t0-9A-Fa-f_)]\|__\)\S*\|_\)\>"
"syn match goHexadecimalError "\<-\=0[xX]_\?\(\x\+_\?\)*\(\([^-+%&|^*/ \t0-9A-Fa-f_)]\|__\)\S*\|_\)\>"
syn match goOctalInt "\<-\=0[oO]\?_\?\(\o\+_\?\)\+\>"
syn match goOctalError "\<-\=0[0-7oO_]*\(\([^-+%&|^*/ \t0-7oOxX_/)\]\}\:;]\|[oO]\{2,\}\|__\)\S*\|_\|[oOxX]\)\>"
"syn match goOctalError "\<-\=0[0-7oO_]*\(\([^-+%&|^*/ \t0-7oOxX_/)\]\}\:;]\|[oO]\{2,\}\|__\)\S*\|_\|[oOxX]\)\>"
syn match goBinaryInt "\<-\=0[bB]_\?\([01]\+_\?\)\+\>"
syn match goBinaryError "\<-\=0[bB]_\?[01_]*\([^-+%&|^*/ \t01_)]\S*\|__\S*\|_\)\>"
"syn match goBinaryError "\<-\=0[bB]_\?[01_]*\([^-+%&|^*/ \t01_)]\S*\|__\S*\|_\)\>"

hi def link goDecimalInt Integer
hi def link goDecimalError Error
Expand Down

0 comments on commit 6db2fcb

Please sign in to comment.