diff --git a/CHANGELOG.md b/CHANGELOG.md index df96eb1115..603ff3d70a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. @@ -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) diff --git a/autoload/go/highlight_test.vim b/autoload/go/highlight_test.vim index afb6fb40d0..ef0e595322 100644 --- a/autoload/go/highlight_test.vim +++ b/autoload/go/highlight_test.vim @@ -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) diff --git a/syntax/go.vim b/syntax/go.vim index aeb233adc8..b765501827 100644 --- a/syntax/go.vim +++ b/syntax/go.vim @@ -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