Fixes for str.format syntax highlighting

This commit is contained in:
Dmitry Vasiliev
2010-11-14 12:15:05 +03:00
parent 6f89b1c2de
commit f259b31b50
3 changed files with 9 additions and 4 deletions

View File

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

View File

@@ -2,9 +2,9 @@
" Language: Python " Language: Python
" Maintainer: Dmitry Vasiliev <dima@hlabs.spb.ru> " Maintainer: Dmitry Vasiliev <dima@hlabs.spb.ru>
" URL: http://www.hlabs.spb.ru/vim/python3.0.vim " URL: http://www.hlabs.spb.ru/vim/python3.0.vim
" Last Change: 2010-11-11 " Last Change: 2010-11-14
" Filenames: *.py " Filenames: *.py
" Version: 3.0.5 " Version: 3.0.6
" "
" Based on python.vim (from Vim 6.1 distribution) " Based on python.vim (from Vim 6.1 distribution)
" by Neil Schemenauer <nas@python.ca> " by Neil Schemenauer <nas@python.ca>
@@ -24,6 +24,7 @@
" for the patch with new configuration options " for the patch with new configuration options
" Anton Butanaev " Anton Butanaev
" for the patch fixing bytes literals highlighting " for the patch fixing bytes literals highlighting
" for the patch fixing str.format syntax highlighting
" "
" Options: " Options:
@@ -207,7 +208,7 @@ endif
if exists("python_highlight_string_format") && python_highlight_string_format != 0 if exists("python_highlight_string_format") && python_highlight_string_format != 0
" str.format syntax " str.format syntax
syn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonRawString syn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonRawString
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 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
endif endif
if exists("python_highlight_string_templates") && python_highlight_string_templates != 0 if exists("python_highlight_string_templates") && python_highlight_string_templates != 0

View File

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