From c85d026015ab18d39346bc27d69eb0ff2b72ea4f Mon Sep 17 00:00:00 2001 From: nfnty Date: Sun, 26 Feb 2017 23:35:41 +0100 Subject: [PATCH] Update statements and functions --- syntax/python.vim | 14 +++++------- tests/test.py | 57 +++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 53 insertions(+), 18 deletions(-) diff --git a/syntax/python.vim b/syntax/python.vim index e4efe74..d9a2946 100644 --- a/syntax/python.vim +++ b/syntax/python.vim @@ -60,13 +60,8 @@ endif " Keywords " -syn keyword pythonStatement break continue del -syn keyword pythonStatement exec return -syn keyword pythonStatement pass yield +syn keyword pythonStatement break continue del return pass yield global assert lambda with syn keyword pythonStatement raise nextgroup=pythonExClass skipwhite -syn keyword pythonStatement global assert -syn keyword pythonStatement lambda -syn keyword pythonStatement with syn keyword pythonStatement def class nextgroup=pythonFunction skipwhite if s:Enabled('g:python_highlight_class_vars') syn keyword pythonClassVar self cls @@ -86,6 +81,7 @@ if s:Python2Syntax() if !s:Enabled('g:python_print_as_function') syn keyword pythonStatement print endif + syn keyword pythonStatement exec syn keyword pythonImport as syn match pythonFunction '[a-zA-Z_][a-zA-Z0-9_]*' display contained else @@ -345,15 +341,15 @@ endif " if s:Enabled('g:python_highlight_builtin_funcs') - let s:funcs_re = '__import__|abs|all|any|bin|chr|classmethod|cmp|compile|complex|delattr|dir|divmod|enumerate|eval|filter|format|getattr|globals|hasattr|hash|hex|id|input|isinstance|issubclass|iter|len|locals|map|max|min|next|oct|open|ord|pow|property|range|repr|reversed|round|setattr|slice|sorted|staticmethod|sum|super|type|vars|zip' + let s:funcs_re = '__import__|abs|all|any|bin|callable|chr|classmethod|cmp|compile|complex|delattr|dir|divmod|enumerate|eval|filter|format|getattr|globals|hasattr|hash|help|hex|id|input|isinstance|issubclass|iter|len|locals|map|max|min|memoryview|next|oct|open|ord|pow|property|range|repr|reversed|round|setattr|slice|sorted|staticmethod|sum|super|type|vars|zip' if s:Python2Syntax() - let s:funcs_re .= '|apply|basestring|buffer|callable|coerce|execfile|file|help|intern|long|raw_input|reduce|reload|unichr|unicode|xrange' + let s:funcs_re .= '|apply|basestring|buffer|coerce|execfile|file|intern|long|raw_input|reduce|reload|unichr|unicode|xrange' if s:Enabled('g:python_print_as_function') let s:funcs_re .= '|print' endif else - let s:funcs_re .= '|ascii|exec|memoryview|print' + let s:funcs_re .= '|ascii|exec|print' endif execute 'syn match pythonBuiltinFunc ''\v\.@''' diff --git a/tests/test.py b/tests/test.py index 667ccb7..4547ab5 100644 --- a/tests/test.py +++ b/tests/test.py @@ -8,7 +8,7 @@ # Keywords. -with break continue del exec return pass print raise global assert lambda yield +with break continue del return pass raise global assert lambda yield for while if elif else import as try except finally from test import var as name @@ -22,6 +22,13 @@ class Classname def функция class Класс +# Keywords: Python 2 + +exec +print + +# Keywords: Python 3 + await async def Test async with @@ -33,16 +40,48 @@ True False Ellipsis None NotImplemented # Bultin types -bool float frozenset dict int list object str tuple set +bool bytearray dict float frozenset int list object set str tuple -# Builtin functions +# Builtin functions: Python 2 -__import__ abs all any apply basestring buffer callable chr classmethod -cmp coerce compile complex delattr dir divmod enumerate eval execfile file -filter getattr globals hasattr hash help hex id input intern isinstance -issubclass iter len locals long map max min oct open ord pow print property -range raw_input reduce reload repr reversed round setattr slice sorted -staticmethod sum super type unichr unicode vars xrange zip +abs() divmod() input() open() staticmethod() +all() enumerate() int() ord() str() +any() eval() isinstance() pow() sum() +basestring() execfile() issubclass() print() super() +bin() file() iter() property() tuple() +bool() filter() len() range() type() +bytearray() float() list() raw_input() unichr() +callable() format() locals() reduce() unicode() +chr() frozenset() long() reload() vars() +classmethod() getattr() map() repr() xrange() +cmp() globals() max() reversed() zip() +compile() hasattr() memoryview() round() __import__() +complex() hash() min() set() +delattr() help() next() setattr() +dict() hex() object() slice() +dir() id() oct() sorted() + +apply() +buffer() +coerce() +intern() + +# Builtin functions: Python 3 + +abs() dict() help() min() setattr() +all() dir() hex() next() slice() +any() divmod() id() object() sorted() +ascii() enumerate() input() oct() staticmethod() +bin() eval() int() open() str() +bool() exec() isinstance() ord() sum() +bytearray() filter() issubclass() pow() super() +bytes() float() iter() print() tuple() +callable() format() len() property() type() +chr() frozenset() list() range() vars() +classmethod() getattr() locals() repr() zip() +compile() globals() map() reversed() __import__() +complex() hasattr() max() round() +delattr() hash() memoryview() set() # Builtin exceptions and warnings.