Browse Source

Fix pythonNumberError patterns to exclude legitimate identifiers.

 * "_0" is a valid identifier!
Joongi Kim 8 years ago
parent
commit
eb44ea7304
2 changed files with 2 additions and 2 deletions
  1. 1
    1
      syntax/python.vim
  2. 1
    1
      test.py

+ 1
- 1
syntax/python.vim View File

393
 
393
 
394
   syn match   pythonNumberError	"\<\d[_0-9]*\D\>" display
394
   syn match   pythonNumberError	"\<\d[_0-9]*\D\>" display
395
   syn match   pythonNumberError	"\<0[_0-9]\+\>" display
395
   syn match   pythonNumberError	"\<0[_0-9]\+\>" display
396
-  syn match   pythonNumberError	"\<\%(_[_0-9]\+\|[_0-9]\+_\)\>" display
396
+  syn match   pythonNumberError	"\<\d[_0-9]*_\>" display
397
   syn match   pythonNumber	"\<\d\>" display
397
   syn match   pythonNumber	"\<\d\>" display
398
   syn match   pythonNumber	"\<[1-9][_0-9]*\d\>" display
398
   syn match   pythonNumber	"\<[1-9][_0-9]*\d\>" display
399
   syn match   pythonNumber	"\<\d[jJ]\>" display
399
   syn match   pythonNumber	"\<\d[jJ]\>" display

+ 1
- 1
test.py View File

67
 # Erroneous numbers
67
 # Erroneous numbers
68
 
68
 
69
 077 100L 0xfffffffL 0L 08 0xk 0x 0b102 0o78 0o123LaB
69
 077 100L 0xfffffffL 0L 08 0xk 0x 0b102 0o78 0o123LaB
70
-0_ 0_1 _0 0_x1f 0x1f_ 0_b77 0b77_ ._2 .2_ 1_j
70
+0_ 0_1 0_x1f 0x1f_ 0_b77 0b77_ .2_ 1_j
71
 
71
 
72
 # Strings
72
 # Strings
73
 
73