diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-04-16 17:42:41 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-04-19 21:26:17 +0200 |
commit | d194380de93023c8901eb77b2820b0f74e8a5283 (patch) | |
tree | 278ad4bef23e59965236c673ab6e53fdee443a13 /runtime/syntax/python.vim | |
parent | c1edb4c39a7267226d48ef034c0fea62f11ea5b3 (diff) | |
download | rneovim-d194380de93023c8901eb77b2820b0f74e8a5283.tar.gz rneovim-d194380de93023c8901eb77b2820b0f74e8a5283.tar.bz2 rneovim-d194380de93023c8901eb77b2820b0f74e8a5283.zip |
vim-patch:e4a3bcf28d92
Updated runtime files. Add Scala files.
https://github.com/vim/vim/commit/e4a3bcf28d92d0bde9ca227ccb40d401038185e5
Diffstat (limited to 'runtime/syntax/python.vim')
-rw-r--r-- | runtime/syntax/python.vim | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/runtime/syntax/python.vim b/runtime/syntax/python.vim index fa42b3e2d2..f0f03a8c8d 100644 --- a/runtime/syntax/python.vim +++ b/runtime/syntax/python.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Python " Maintainer: Zvezdan Petkovic <zpetkovic@acm.org> -" Last Change: 2016 Jul 21 +" Last Change: 2016 Aug 14 " Credits: Neil Schemenauer <nas@python.ca> " Dmitry Vasiliev " @@ -84,14 +84,30 @@ syn keyword pythonInclude from import syn keyword pythonAsync async await " Decorators (new in Python 2.4) -syn match pythonDecorator "@" display nextgroup=pythonFunction skipwhite -" The zero-length non-grouping match before the function name is -" extremely important in pythonFunction. Without it, everything is -" interpreted as a function inside the contained environment of -" doctests. +" Python 3.5 introduced the use of the same symbol for matrix +" multiplication. We now have to exclude the symbol from being +" highlighted when used in that context. Hence, the check that it's +" preceded by empty space only (possibly in a docstring/doctest) and +" followed by decorator name, optional parenthesized list of arguments, +" and the next line with either def, class, or another decorator. +syn match pythonDecorator + \ "\%(\%(^\s*\)\%(\%(>>>\|\.\.\.\)\s\+\)\=\)\zs@\%(\s*\h\%(\w\|\.\)*\%(([^)]*)\)\=\s*\n\s*\%(\.\.\.\s\+\)\=\%(@\s*\h\|\%(def\|class\)\s\+\)\)\@=" + \ display nextgroup=pythonDecoratorName skipwhite + " A dot must be allowed because of @MyClass.myfunc decorators. +" It must be preceded by a decorator symbol and on a separate line from +" a function/class it decorates. +syn match pythonDecoratorName + \ "\%(@\s*\)\@<=\h\%(\w\|\.\)*\%(\%(([^)]*)\)\=\s*\n\)\@=" + \ contained display nextgroup=pythonFunction skipnl + +" The zero-length non-grouping match of def or class before the function +" name is extremely important in pythonFunction. Without it, everything +" is interpreted as a function inside the contained environment of +" doctests. syn match pythonFunction - \ "\%(\%(def\s\|class\s\|@\)\s*\)\@<=\h\%(\w\|\.\)*" contained + \ "\%(\%(^\s*\)\%(\%(>>>\|\.\.\.\)\s\+\)\=\%(def\|class\)\s\+\)\@<=\h\w*" + \ contained syn match pythonComment "#.*$" contains=pythonTodo,@Spell syn keyword pythonTodo FIXME NOTE NOTES TODO XXX contained @@ -293,6 +309,7 @@ if version >= 508 || !exists("did_python_syn_inits") HiLink pythonInclude Include HiLink pythonAsync Statement HiLink pythonDecorator Define + HiLink pythonDecoratorName Function HiLink pythonFunction Function HiLink pythonComment Comment HiLink pythonTodo Todo |