Skip to content

Commit

Permalink
Merge pull request #3404 from bhcleek/syntax/remove-numeric-error
Browse files Browse the repository at this point in the history
syntax: remove the numeric error matches
  • Loading branch information
bhcleek authored Apr 15, 2022
2 parents ac9c362 + 02e4101 commit 687eb72
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 29 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
23 changes: 0 additions & 23 deletions autoload/go/highlight_test.vim
Original file line number Diff line number Diff line change
Expand Up @@ -105,39 +105,16 @@ function! Test_numeric_literal_highlight() abort
\ 'lone zero': {'group': 'goDecimalInt', 'value': '0'},
\ 'integer': {'group': 'goDecimalInt', 'value': '1234567890'},
\ 'integerGrouped': {'group': 'goDecimalInt', 'value': '1_234_567_890'},
\ 'integerErrorLeadingUnderscore': {'group': 'goDecimalError', 'value': '_1234_567_890'},
\ 'integerErrorTrailingUnderscore': {'group': 'goDecimalError', 'value': '1_234_567890_'},
\ 'integerErrorDoubleUnderscore': {'group': 'goDecimalError', 'value': '1_234__567_890'},
\ 'hexadecimal': {'group': 'goHexadecimalInt', 'value': '0x0123456789abdef'},
\ 'hexadecimalGrouped': {'group': 'goHexadecimalInt', 'value': '0x012_345_678_9ab_def'},
\ 'hexadecimalErrorLeading': {'group': 'goHexadecimalError', 'value': '0xg0123456789abdef'},
\ 'hexadecimalErrorTrailing': {'group': 'goHexadecimalError', 'value': '0x0123456789abdefg'},
\ 'hexadecimalErrorDoubleUnderscore': {'group': 'goHexadecimalError', 'value': '0x__0123456789abdef'},
\ 'hexadecimalErrorTrailingUnderscore': {'group': 'goHexadecimalError', 'value': '0x0123456789abdef_'},
\ 'heXadecimal': {'group': 'goHexadecimalInt', 'value': '0X0123456789abdef'},
\ 'heXadecimalErrorLeading': {'group': 'goHexadecimalError', 'value': '0Xg0123456789abdef'},
\ 'heXadecimalErrorTrailing': {'group': 'goHexadecimalError', 'value': '0X0123456789abdefg'},
\ 'octal': {'group': 'goOctalInt', 'value': '01234567'},
\ 'octalPrefix': {'group': 'goOctalInt', 'value': '0o1234567'},
\ 'octalGrouped': {'group': 'goOctalInt', 'value': '0o1_234_567'},
\ 'octalErrorLeading': {'group': 'goOctalError', 'value': '081234567'},
\ 'octalErrorTrailing': {'group': 'goOctalError', 'value': '012345678'},
\ 'octalErrorDoubleUnderscore': {'group': 'goOctalError', 'value': '0o__1234567'},
\ 'octalErrorTrailingUnderscore': {'group': 'goOctalError', 'value': '0o_123456_7_'},
\ 'octalErrorTrailingO': {'group': 'goOctalError', 'value': '0o_123456_7o'},
\ 'octalErrorTrailingX': {'group': 'goOctalError', 'value': '0o_123456_7x'},
\ 'octalErrorTrailingB': {'group': 'goOctalError', 'value': '0o_123456_7b'},
\ 'OctalPrefix': {'group': 'goOctalInt', 'value': '0O1234567'},
\ 'binaryInt': {'group': 'goBinaryInt', 'value': '0b0101'},
\ 'binaryIntGrouped': {'group': 'goBinaryInt', 'value': '0b_01_01'},
\ 'binaryErrorLeading': {'group': 'goBinaryError', 'value': '0b20101'},
\ 'binaryErrorTrailing': {'group': 'goBinaryError', 'value': '0b01012'},
\ 'binaryErrorDoubleUnderscore': {'group': 'goBinaryError', 'value': '0b_01__01'},
\ 'binaryOverrideOctal': {'group': 'goBinaryError', 'value': '0b1234567'},
\ 'binaryErrorTrailingUnderscore': {'group': 'goBinaryError', 'value': '0b_01_01_'},
\ 'BinaryInt': {'group': 'goBinaryInt', 'value': '0B0101'},
\ 'BinaryErrorLeading': {'group': 'goBinaryError', 'value': '0B20101'},
\ 'BinaryErrorTrailing': {'group': 'goBinaryError', 'value': '0B01012'},
\ }

for kv in items(tests)
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 687eb72

Please sign in to comment.