From 878e75cf90a6d0ec3e23ec7d5df9f9d060df6762 Mon Sep 17 00:00:00 2001 From: Dmitry Vasiliev Date: Sat, 27 Dec 2014 16:13:08 +0100 Subject: [PATCH] Highlight non-ASCII decorators only for Python 3 --- CHANGES.txt | 5 +++++ README.rst | 1 + syntax/python.vim | 11 ++++++++--- test.py | 1 + 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index e0579bf..8ee9f69 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,8 @@ +Revision 3.3.7 (2014-12-27): + + - Add support for Python 3 non-ASCII decorator names. + Patch by Victor Salgado + Revision 3.3.6 (2013-11-18): - Highlight 'yield from' statement introduced in Python 3.3. Reported by diff --git a/README.rst b/README.rst index 8293b60..9c34599 100644 --- a/README.rst +++ b/README.rst @@ -139,5 +139,6 @@ List of the contributors in alphabetical order: - Marc Weber - Pedro Algarvio - pydave at GitHub +- Victor Salgado - Will Gray - Yuri Habrusiev diff --git a/syntax/python.vim b/syntax/python.vim index ba34666..8d68796 100644 --- a/syntax/python.vim +++ b/syntax/python.vim @@ -2,9 +2,9 @@ " Language: Python " Maintainer: Dmitry Vasiliev " URL: https://github.com/hdima/python-syntax -" Last Change: 2013-11-18 +" Last Change: 2014-12-27 " Filenames: *.py -" Version: 3.3.6 +" Version: 3.3.7 " " Based on python.vim (from Vim 6.1 distribution) " by Neil Schemenauer @@ -31,6 +31,7 @@ " Marc Weber " Pedro Algarvio " pydave at GitHub +" Victor Salgado " Will Gray " Yuri Habrusiev " @@ -179,7 +180,11 @@ endif " syn match pythonDecorator "@" display nextgroup=pythonDottedName skipwhite -syn match pythonDottedName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\)*" display contained +if s:Python2Syntax() + syn match pythonDottedName "[a-zA-Z_][a-zA-Z0-9_]*\%(\.[a-zA-Z_][a-zA-Z0-9_]*\)*" display contained +else + syn match pythonDottedName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\)*" display contained +endif syn match pythonDot "\." display containedin=pythonDottedName " diff --git a/test.py b/test.py index 671d289..b80ea1e 100644 --- a/test.py +++ b/test.py @@ -51,6 +51,7 @@ RuntimeWarning FutureWarning ImportWarning UnicodeWarning @ decoratorname @ object.__init__(arg1, arg2) +@ декоратор @ декоратор.décorateur # Numbers