Browse Source

Added highlighting for else: and removed Error highlighting for numbers followed by a colon, e.g. if value==0:

Guerki 9 years ago
parent
commit
3fb9dc2d17
2 changed files with 11 additions and 11 deletions
  1. 4
    4
      syntax/python.vim
  2. 7
    7
      test.py

+ 4
- 4
syntax/python.vim View File

153
 syn keyword pythonStatement     with
153
 syn keyword pythonStatement     with
154
 syn keyword pythonStatement     def class nextgroup=pythonFunction skipwhite
154
 syn keyword pythonStatement     def class nextgroup=pythonFunction skipwhite
155
 syn keyword pythonRepeat        for while
155
 syn keyword pythonRepeat        for while
156
-syn keyword pythonConditional   if elif else
156
+syn keyword pythonConditional   if elif else else:
157
 syn keyword pythonImport        import
157
 syn keyword pythonImport        import
158
 syn keyword pythonException     try except finally
158
 syn keyword pythonException     try except finally
159
 syn keyword pythonOperator      and in is not or
159
 syn keyword pythonOperator      and in is not or
365
 
365
 
366
   syn match   pythonNumberError	"\<\d\+\D\>" display
366
   syn match   pythonNumberError	"\<\d\+\D\>" display
367
   syn match   pythonNumberError	"\<0\d\+\>" display
367
   syn match   pythonNumberError	"\<0\d\+\>" display
368
-  syn match   pythonNumber	"\<\d\>" display
369
-  syn match   pythonNumber	"\<[1-9]\d\+\>" display
370
-  syn match   pythonNumber	"\<\d\+[jJ]\>" display
368
+  syn match   pythonNumber	"\<\d\:\=\>" display
369
+  syn match   pythonNumber	"\<[1-9]\d\+\:\=\>" display
370
+  syn match   pythonNumber	"\<\d\+[jJ]\:\=\>" display
371
 
371
 
372
   syn match   pythonOctError	"\<0[oO]\=\o*[8-9]\d*\>" display
372
   syn match   pythonOctError	"\<0[oO]\=\o*[8-9]\d*\>" display
373
   syn match   pythonBinError	"\<0[bB][01]*[2-9]\d*\>" display
373
   syn match   pythonBinError	"\<0[bB][01]*[2-9]\d*\>" display

+ 7
- 7
test.py View File

55
 # Numbers
55
 # Numbers
56
 
56
 
57
 0 1 2 9 10 0x1f .3 12.34 0j 0j 34.2E-3 0b10 0o77 1023434 0x0
57
 0 1 2 9 10 0x1f .3 12.34 0j 0j 34.2E-3 0b10 0o77 1023434 0x0
58
-
58
+0:
59
 # Erroneous numbers
59
 # Erroneous numbers
60
 
60
 
61
 077 100L 0xfffffffL 0L 08 0xk 0x  0b102 0o78 0o123LaB
61
 077 100L 0xfffffffL 0L 08 0xk 0x  0b102 0o78 0o123LaB
128
 
128
 
129
 # Trailing space errors.
129
 # Trailing space errors.
130
 
130
 
131
-    	
132
-    break	    
133
-"""  	
134
-   	 
135
-    test    	
136
-"""  	
131
+
132
+    break
133
+"""
134
+
135
+    test
136
+"""