Browse Source

Highlight non-ASCII decorators only for Python 3

Dmitry Vasiliev 9 years ago
parent
commit
878e75cf90
4 changed files with 15 additions and 3 deletions
  1. 5
    0
      CHANGES.txt
  2. 1
    0
      README.rst
  3. 8
    3
      syntax/python.vim
  4. 1
    0
      test.py

+ 5
- 0
CHANGES.txt View File

1
+Revision 3.3.7 (2014-12-27):
2
+
3
+    - Add support for Python 3 non-ASCII decorator names.
4
+      Patch by Victor Salgado
5
+
1
 Revision 3.3.6 (2013-11-18):
6
 Revision 3.3.6 (2013-11-18):
2
 
7
 
3
     - Highlight 'yield from' statement introduced in Python 3.3. Reported by
8
     - Highlight 'yield from' statement introduced in Python 3.3. Reported by

+ 1
- 0
README.rst View File

139
 - Marc Weber
139
 - Marc Weber
140
 - Pedro Algarvio
140
 - Pedro Algarvio
141
 - pydave at GitHub
141
 - pydave at GitHub
142
+- Victor Salgado
142
 - Will Gray
143
 - Will Gray
143
 - Yuri Habrusiev
144
 - Yuri Habrusiev

+ 8
- 3
syntax/python.vim View File

2
 " Language:     Python
2
 " Language:     Python
3
 " Maintainer:   Dmitry Vasiliev <dima at hlabs dot org>
3
 " Maintainer:   Dmitry Vasiliev <dima at hlabs dot org>
4
 " URL:          https://github.com/hdima/python-syntax
4
 " URL:          https://github.com/hdima/python-syntax
5
-" Last Change:  2013-11-18
5
+" Last Change:  2014-12-27
6
 " Filenames:    *.py
6
 " Filenames:    *.py
7
-" Version:      3.3.6
7
+" Version:      3.3.7
8
 "
8
 "
9
 " Based on python.vim (from Vim 6.1 distribution)
9
 " Based on python.vim (from Vim 6.1 distribution)
10
 " by Neil Schemenauer <nas at python dot ca>
10
 " by Neil Schemenauer <nas at python dot ca>
31
 "   Marc Weber
31
 "   Marc Weber
32
 "   Pedro Algarvio
32
 "   Pedro Algarvio
33
 "   pydave at GitHub
33
 "   pydave at GitHub
34
+"   Victor Salgado
34
 "   Will Gray
35
 "   Will Gray
35
 "   Yuri Habrusiev
36
 "   Yuri Habrusiev
36
 "
37
 "
179
 "
180
 "
180
 
181
 
181
 syn match   pythonDecorator	"@" display nextgroup=pythonDottedName skipwhite
182
 syn match   pythonDecorator	"@" display nextgroup=pythonDottedName skipwhite
182
-syn match   pythonDottedName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\)*" display contained
183
+if s:Python2Syntax()
184
+  syn match   pythonDottedName "[a-zA-Z_][a-zA-Z0-9_]*\%(\.[a-zA-Z_][a-zA-Z0-9_]*\)*" display contained
185
+else
186
+  syn match   pythonDottedName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\)*" display contained
187
+endif
183
 syn match   pythonDot        "\." display containedin=pythonDottedName
188
 syn match   pythonDot        "\." display containedin=pythonDottedName
184
 
189
 
185
 "
190
 "

+ 1
- 0
test.py View File

51
 
51
 
52
 @ decoratorname
52
 @ decoratorname
53
 @ object.__init__(arg1, arg2)
53
 @ object.__init__(arg1, arg2)
54
+@ декоратор
54
 @ декоратор.décorateur
55
 @ декоратор.décorateur
55
 
56
 
56
 # Numbers
57
 # Numbers