Skip to content

Commit 453269d

Browse files
committed
Highlight 'yield from' statement
The 'yield from' statement was introduced in Python 3.3. Reported by Elizabeth Myers.
1 parent efe8499 commit 453269d

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
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.6 (2013-11-18):
2+
3+
- Highlight 'yield from' statement introduced in Python 3.3. Reported by
4+
Elizabeth Myers.
5+
16
Revision 3.3.5 (2013-08-31):
27

38
- Highlight 'import', 'from' and 'as' as include statements.

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ List of the contributors in alphabetical order:
133133
- Andrea Riciputi
134134
- Anton Butanaev
135135
- Caleb Adamantine
136+
- Elizabeth Myers
136137
- Jeroen Ruigrok van der Werven
137138
- John Eikenberry
138139
- Marc Weber

syntax/python.vim

Lines changed: 9 additions & 4 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-08-31
5+
" Last Change: 2013-11-18
66
" Filenames: *.py
7-
" Version: 3.3.5
7+
" Version: 3.3.6
88
"
99
" Based on python.vim (from Vim 6.1 distribution)
1010
" by Neil Schemenauer <nas at python dot ca>
@@ -25,6 +25,7 @@
2525
" Andrea Riciputi
2626
" Anton Butanaev
2727
" Caleb Adamantine
28+
" Elizabeth Myers
2829
" Jeroen Ruigrok van der Werven
2930
" John Eikenberry
3031
" Marc Weber
@@ -148,15 +149,18 @@ syn keyword pythonStatement break continue del
148149
syn keyword pythonStatement exec return
149150
syn keyword pythonStatement pass raise
150151
syn keyword pythonStatement global assert
151-
syn keyword pythonStatement lambda yield
152+
syn keyword pythonStatement lambda
152153
syn keyword pythonStatement with
153154
syn keyword pythonStatement def class nextgroup=pythonFunction skipwhite
154155
syn keyword pythonRepeat for while
155156
syn keyword pythonConditional if elif else
156-
syn keyword pythonImport import from
157+
syn keyword pythonImport import
157158
syn keyword pythonException try except finally
158159
syn keyword pythonOperator and in is not or
159160

161+
syn match pythonStatement "\<yield\>" display
162+
syn match pythonImport "\<from\>" display
163+
160164
if s:Python2Syntax()
161165
if !s:Enabled("g:python_print_as_function")
162166
syn keyword pythonStatement print
@@ -165,6 +169,7 @@ if s:Python2Syntax()
165169
syn match pythonFunction "[a-zA-Z_][a-zA-Z0-9_]*" display contained
166170
else
167171
syn keyword pythonStatement as nonlocal None
172+
syn match pythonStatement "\<yield\s\+from\>" display
168173
syn keyword pythonBoolean True False
169174
syn match pythonFunction "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
170175
endif

test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
with break continue del exec return pass print raise global assert lambda yield
1212
for while if elif else import from as try except finally and in is not or
13+
14+
yield from
15+
1316
def functionname
1417
class Classname
1518
def функция

0 commit comments

Comments
 (0)