Skip to content

Commit 878e75c

Browse files
committed
Highlight non-ASCII decorators only for Python 3
1 parent 9209dd0 commit 878e75c

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

CHANGES.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
16
Revision 3.3.6 (2013-11-18):
27

38
- Highlight 'yield from' statement introduced in Python 3.3. Reported by

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,5 +139,6 @@ List of the contributors in alphabetical order:
139139
- Marc Weber
140140
- Pedro Algarvio
141141
- pydave at GitHub
142+
- Victor Salgado
142143
- Will Gray
143144
- Yuri Habrusiev

syntax/python.vim

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
" Language: Python
33
" Maintainer: Dmitry Vasiliev <dima at hlabs dot org>
44
" URL: https://github.com/hdima/python-syntax
5-
" Last Change: 2013-11-18
5+
" Last Change: 2014-12-27
66
" Filenames: *.py
7-
" Version: 3.3.6
7+
" Version: 3.3.7
88
"
99
" Based on python.vim (from Vim 6.1 distribution)
1010
" by Neil Schemenauer <nas at python dot ca>
@@ -31,6 +31,7 @@
3131
" Marc Weber
3232
" Pedro Algarvio
3333
" pydave at GitHub
34+
" Victor Salgado
3435
" Will Gray
3536
" Yuri Habrusiev
3637
"
@@ -179,7 +180,11 @@ endif
179180
"
180181

181182
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
183188
syn match pythonDot "\." display containedin=pythonDottedName
184189

185190
"

test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class Класс
5151

5252
@ decoratorname
5353
@ object.__init__(arg1, arg2)
54+
@ декоратор
5455
@ декоратор.décorateur
5556

5657
# Numbers

0 commit comments

Comments
 (0)