From f259b31b50f3152dc27e1d4874d32c6c110e6fdb Mon Sep 17 00:00:00 2001 From: Dmitry Vasiliev Date: Sun, 14 Nov 2010 12:15:05 +0300 Subject: [PATCH] Fixes for str.format syntax highlighting --- CHANGES.txt | 4 ++++ python3.0.vim | 7 ++++--- test.py | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 39b26d9..9ce7e2d 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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): - Fixed highlighting for bytes. Patch by Anton Butanaev. diff --git a/python3.0.vim b/python3.0.vim index 7b33934..21fe3fb 100644 --- a/python3.0.vim +++ b/python3.0.vim @@ -2,9 +2,9 @@ " Language: Python " Maintainer: Dmitry Vasiliev " URL: http://www.hlabs.spb.ru/vim/python3.0.vim -" Last Change: 2010-11-11 +" Last Change: 2010-11-14 " Filenames: *.py -" Version: 3.0.5 +" Version: 3.0.6 " " Based on python.vim (from Vim 6.1 distribution) " by Neil Schemenauer @@ -24,6 +24,7 @@ " for the patch with new configuration options " Anton Butanaev " for the patch fixing bytes literals highlighting +" for the patch fixing str.format syntax highlighting " " Options: @@ -207,7 +208,7 @@ endif if exists("python_highlight_string_format") && python_highlight_string_format != 0 " str.format syntax 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 if exists("python_highlight_string_templates") && python_highlight_string_templates != 0 diff --git a/test.py b/test.py index 4d2155b..acbd157 100644 --- a/test.py +++ b/test.py @@ -86,7 +86,7 @@ br"\a\b\n\r" " %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"