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

+ 0
- 4
TODO.txt View File

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

+ 11
- 4
python.vim View File

188
 
188
 
189
 " Numbers (ints, longs, floats, complex)
189
 " Numbers (ints, longs, floats, complex)
190
 syn match   pythonHexNumber	"\<0[xX]\x\+[lL]\=\>" display
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
 syn match   pythonNumber	"\<\d\+[lLjJ]\=\>" display
194
 syn match   pythonNumber	"\<\d\+[lLjJ]\=\>" display
195
+
193
 syn match   pythonFloat		"\.\d\+\([eE][+-]\=\d\+\)\=[jJ]\=\>" display
196
 syn match   pythonFloat		"\.\d\+\([eE][+-]\=\d\+\)\=[jJ]\=\>" display
194
 syn match   pythonFloat		"\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display
197
 syn match   pythonFloat		"\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display
195
 syn match   pythonFloat		"\<\d\+\.\d*\([eE][+-]\=\d\+\)\=[jJ]\=" display
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
 if exists("python_highlight_builtins") && python_highlight_builtins != 0
204
 if exists("python_highlight_builtins") && python_highlight_builtins != 0
201
   " Builtin functions, types and objects
205
   " Builtin functions, types and objects
303
 
307
 
304
   HiLink pythonNumber		Number
308
   HiLink pythonNumber		Number
305
   HiLink pythonHexNumber	Number
309
   HiLink pythonHexNumber	Number
310
+  HiLink pythonOctNumber	Number
311
+  HiLink pythonBinNumber	Number
306
   HiLink pythonFloat		Float
312
   HiLink pythonFloat		Float
307
-  HiLink pythonOctalError	Error
313
+  HiLink pythonOctError	    Error
308
   HiLink pythonHexError		Error
314
   HiLink pythonHexError		Error
315
+  HiLink pythonBinError		Error
309
 
316
 
310
   HiLink pythonBuiltinObj	Structure
317
   HiLink pythonBuiltinObj	Structure
311
   HiLink pythonBuiltinFunc	Function
318
   HiLink pythonBuiltinFunc	Function