From 4e0828f853c47da140af4a647563f4d0f7c9fe8a Mon Sep 17 00:00:00 2001 From: Dmitry Vasiliev Date: Sat, 20 Sep 2008 22:13:20 +0400 Subject: [PATCH] Added support for new integer literal syntax --- CHANGES.txt | 1 + TODO.txt | 4 ---- python.vim | 15 +++++++++++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index b602743..02f2023 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -8,6 +8,7 @@ Revision 2.6.1 (unknown): - Removed "OverflowWarning" (removed in Python 2.5); - Added option "python_print_as_function" for highlight "print" as a function; + - Added support for new integer literal syntax "0o" and "0b"; Revision 2.5.6 (2007-02-04): diff --git a/TODO.txt b/TODO.txt index d72d252..e23ffe1 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,7 +1,3 @@ -- Add configuration for "print" status (function or builtin) - -- Integer literal support - - Python 3.0 string formatting - Need more accurate way to handle indentation errors. For example diff --git a/python.vim b/python.vim index 62e4882..eb94df7 100644 --- a/python.vim +++ b/python.vim @@ -188,14 +188,18 @@ endif " Numbers (ints, longs, floats, complex) syn match pythonHexNumber "\<0[xX]\x\+[lL]\=\>" display -syn match pythonHexNumber "\<0[xX]\>" display +syn match pythonOctNumber "\<0[oO]\o\+[lL]\=\>" display +syn match pythonBinNumber "\<0[bB][01]\+[lL]\=\>" display + syn match pythonNumber "\<\d\+[lLjJ]\=\>" display + syn match pythonFloat "\.\d\+\([eE][+-]\=\d\+\)\=[jJ]\=\>" display syn match pythonFloat "\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display syn match pythonFloat "\<\d\+\.\d*\([eE][+-]\=\d\+\)\=[jJ]\=" display -syn match pythonOctalError "\<0\o*[89]\d*[lL]\=\>" display -syn match pythonHexError "\<0[xX]\X\+[lL]\=\>" display +syn match pythonOctError "\<0[oO]\=\o*[8-9]\d*[lL]\=\>" display +syn match pythonHexError "\<0[xX]\x*\X\x*[lL]\=\>" display +syn match pythonBinError "\<0[bB][01]*[2-9]\d*[lL]\=\>" display if exists("python_highlight_builtins") && python_highlight_builtins != 0 " Builtin functions, types and objects @@ -303,9 +307,12 @@ if version >= 508 || !exists("did_python_syn_inits") HiLink pythonNumber Number HiLink pythonHexNumber Number + HiLink pythonOctNumber Number + HiLink pythonBinNumber Number HiLink pythonFloat Float - HiLink pythonOctalError Error + HiLink pythonOctError Error HiLink pythonHexError Error + HiLink pythonBinError Error HiLink pythonBuiltinObj Structure HiLink pythonBuiltinFunc Function