Browse Source

Fixes for str.format syntax highlighting

Dmitry Vasiliev 13 years ago
parent
commit
f259b31b50
3 changed files with 9 additions and 4 deletions
  1. 4
    0
      CHANGES.txt
  2. 4
    3
      python3.0.vim
  3. 1
    1
      test.py

+ 4
- 0
CHANGES.txt View File

@@ -1,3 +1,7 @@
1
+Revision 3.0.6 (2010-11-14):
2
+
3
+    - Fixed highlighting for str.format syntax. Patch by Anton Butanaev.
4
+
1 5
 Revision 3.0.5 (2010-11-11):
2 6
 
3 7
     - Fixed highlighting for bytes. Patch by Anton Butanaev.

+ 4
- 3
python3.0.vim View File

@@ -2,9 +2,9 @@
2 2
 " Language:	Python
3 3
 " Maintainer:	Dmitry Vasiliev <dima@hlabs.spb.ru>
4 4
 " URL:		http://www.hlabs.spb.ru/vim/python3.0.vim
5
-" Last Change:	2010-11-11
5
+" Last Change:	2010-11-14
6 6
 " Filenames:	*.py
7
-" Version:	3.0.5
7
+" Version:	3.0.6
8 8
 "
9 9
 " Based on python.vim (from Vim 6.1 distribution)
10 10
 " by Neil Schemenauer <nas@python.ca>
@@ -24,6 +24,7 @@
24 24
 "        for the patch with new configuration options
25 25
 "    Anton Butanaev
26 26
 "        for the patch fixing bytes literals highlighting
27
+"        for the patch fixing str.format syntax highlighting
27 28
 
28 29
 "
29 30
 " Options:
@@ -207,7 +208,7 @@ endif
207 208
 if exists("python_highlight_string_format") && python_highlight_string_format != 0
208 209
   " str.format syntax
209 210
   syn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonRawString
210
-  syn match pythonStrFormat	"{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_*\)\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*\%(\.\d\+\)\=[bcdeEfFgGnoxX%]\=\)\=\)\=}" contained containedin=pythonString,pythonRawString
211
+  syn match pythonStrFormat	"{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\=\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}" contained containedin=pythonString,pythonRawString
211 212
 endif
212 213
 
213 214
 if exists("python_highlight_string_templates") && python_highlight_string_templates != 0

+ 1
- 1
test.py View File

@@ -86,7 +86,7 @@ br"\a\b\n\r"
86 86
 
87 87
 " %f "
88 88
 
89
-"{0.name!r:b} {0[n]} {name!s:  } {{test}} {{}}"
89
+"{0.name!r:b} {0[n]} {name!s:  } {{test}} {{}} {} {.__len__:s}"
90 90
 
91 91
 "${test} ${test ${test}aname $$$ $test+nope"
92 92