Browse Source

Added support for new integer literal syntax

Dmitry Vasiliev 15 years ago
parent
commit
4e0828f853
3 changed files with 12 additions and 8 deletions
  1. 1
    0
      CHANGES.txt
  2. 0
    4
      TODO.txt
  3. 11
    4
      python.vim

+ 1
- 0
CHANGES.txt View File

@@ -8,6 +8,7 @@ Revision 2.6.1 (unknown):
8 8
     - Removed "OverflowWarning" (removed in Python 2.5);
9 9
     - Added option "python_print_as_function" for highlight "print" as a
10 10
       function;
11
+    - Added support for new integer literal syntax "0o" and "0b";
11 12
 
12 13
 Revision 2.5.6 (2007-02-04):
13 14
 

+ 0
- 4
TODO.txt View File

@@ -1,7 +1,3 @@
1
-- Add configuration for "print" status (function or builtin)
2
-
3
-- Integer literal support
4
-
5 1
 - Python 3.0 string formatting
6 2
 
7 3
 - Need more accurate way to handle indentation errors. For example

+ 11
- 4
python.vim View File

@@ -188,14 +188,18 @@ endif
188 188
 
189 189
 " Numbers (ints, longs, floats, complex)
190 190
 syn match   pythonHexNumber	"\<0[xX]\x\+[lL]\=\>" display
191
-syn match   pythonHexNumber	"\<0[xX]\>" display
191
+syn match   pythonOctNumber "\<0[oO]\o\+[lL]\=\>" display
192
+syn match   pythonBinNumber "\<0[bB][01]\+[lL]\=\>" display
193
+
192 194
 syn match   pythonNumber	"\<\d\+[lLjJ]\=\>" display
195
+
193 196
 syn match   pythonFloat		"\.\d\+\([eE][+-]\=\d\+\)\=[jJ]\=\>" display
194 197
 syn match   pythonFloat		"\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display
195 198
 syn match   pythonFloat		"\<\d\+\.\d*\([eE][+-]\=\d\+\)\=[jJ]\=" display
196 199
 
197
-syn match   pythonOctalError	"\<0\o*[89]\d*[lL]\=\>" display
198
-syn match   pythonHexError	"\<0[xX]\X\+[lL]\=\>" display
200
+syn match   pythonOctError	"\<0[oO]\=\o*[8-9]\d*[lL]\=\>" display
201
+syn match   pythonHexError	"\<0[xX]\x*\X\x*[lL]\=\>" display
202
+syn match   pythonBinError	"\<0[bB][01]*[2-9]\d*[lL]\=\>" display
199 203
 
200 204
 if exists("python_highlight_builtins") && python_highlight_builtins != 0
201 205
   " Builtin functions, types and objects
@@ -303,9 +307,12 @@ if version >= 508 || !exists("did_python_syn_inits")
303 307
 
304 308
   HiLink pythonNumber		Number
305 309
   HiLink pythonHexNumber	Number
310
+  HiLink pythonOctNumber	Number
311
+  HiLink pythonBinNumber	Number
306 312
   HiLink pythonFloat		Float
307
-  HiLink pythonOctalError	Error
313
+  HiLink pythonOctError	    Error
308 314
   HiLink pythonHexError		Error
315
+  HiLink pythonBinError		Error
309 316
 
310 317
   HiLink pythonBuiltinObj	Structure
311 318
   HiLink pythonBuiltinFunc	Function