From f22918785212df167b747cd5ae10f713e0160e1a Mon Sep 17 00:00:00 2001 From: Asa Jay Date: Sat, 30 Jul 2016 15:01:15 +0200 Subject: [PATCH] Negative Numbers, Docstrings, self (builtin object) --- syntax/python.vim | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/syntax/python.vim b/syntax/python.vim index e963628..1be04b9 100644 --- a/syntax/python.vim +++ b/syntax/python.vim @@ -3,9 +3,9 @@ " Current Maintainer: Dmitry Vasiliev " Previous Maintainer: Neil Schemenauer " URL: https://github.com/hdima/python-syntax -" Last Change: 2015-11-01 +" Last Change: 2016-07-30 " Filenames: *.py -" Version: 3.6.0 +" Version: 3.6.1 " " Based on python.vim (from Vim 6.1 distribution) " by Neil Schemenauer @@ -38,6 +38,7 @@ " Victor Salgado " Will Gray " Yuri Habrusiev +" Arthur Jaron " " Options " ======= @@ -276,8 +277,12 @@ else syn region pythonString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell syn region pythonString start=+"""+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell syn region pythonString start=+'''+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell + endif +syn region pythonDocstring start=+^\s*[uU]\?[rR]\?"""+ end=+"""+ keepend excludenl contains=pythonEscape,@Spell,pythonDoctest,pythonDocTest2,pythonSpaceError +syn region pythonDocstring start=+^\s*[uU]\?[rR]\?'''+ end=+'''+ keepend excludenl contains=pythonEscape,@Spell,pythonDoctest,pythonDocTest2,pythonSpaceError + if s:Python2Syntax() " Python 2 Unicode raw strings syn region pythonUniRawString start=+[uU][rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell @@ -368,6 +373,11 @@ if s:Python2Syntax() syn match pythonNumber "\<[0-9]\d\+[lL]\=\>" display syn match pythonNumber "\<\d\+[lLjJ]\>" display + " For completeness + syn match pythonNumber "\<-\d[lL]\=\>" display + syn match pythonNumber "\<-[0-9]\d\+[lL]\=\>" display + syn match pythonNumber "\<-\d\+[lLjJ]\>" display + syn match pythonOctError "\<0[oO]\=\o*[8-9]\d*[lL]\=\>" display syn match pythonBinError "\<0[bB][01]*[2-9]\d*[lL]\=\>" display else @@ -385,6 +395,11 @@ else syn match pythonNumber "\<[1-9]\d\+\>" display syn match pythonNumber "\<\d\+[jJ]\>" display + " Negative numbers, why missing? + syn match pythonNumber "\<-\d\>" display + syn match pythonNumber "\<-[1-9]\d\+\>" display + syn match pythonNumber "\<-\d\+[jJ]\>" display + syn match pythonOctError "\<0[oO]\=\o*[8-9]\d*\>" display syn match pythonBinError "\<0[bB][01]*[2-9]\d*\>" display endif @@ -402,7 +417,7 @@ if s:Enabled("g:python_highlight_builtin_objs") syn keyword pythonBuiltinObj None syn keyword pythonBoolean True False endif - syn keyword pythonBuiltinObj Ellipsis NotImplemented + syn keyword pythonBuiltinObj Ellipsis NotImplemented self syn keyword pythonBuiltinObj __debug__ __doc__ __file__ __name__ __package__ endif @@ -521,6 +536,8 @@ if version >= 508 || !exists("did_python_syn_inits") HiLink pythonString String HiLink pythonRawString String + HiLink pythonDocstring Docstring + HiLink pythonUniEscape Special HiLink pythonUniEscapeError Error