diff --git a/CHANGES.txt b/CHANGES.txt index 041b182..e0fb489 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,5 +1,6 @@ Revision 3.0.0 (2008-09-?): + - Updated support for str.format; - Added new builtins introduced in Python 2.6: "ascii", "exec", "memoryview", "print"; - Removed builtins: "apply", "basestring", "buffer", "callable", "coerce", @@ -8,7 +9,9 @@ Revision 3.0.0 (2008-09-?): Revision 2.6.2 (2008-09-?): + - Added "VMSError" exception; - Added support for b"..." syntax; + - Added support for str.format brace escaping; Revision 2.6.1 (2008-09-21): diff --git a/python.vim b/python.vim index 776a569..614e688 100644 --- a/python.vim +++ b/python.vim @@ -193,12 +193,15 @@ endif if exists("python_highlight_string_format") && python_highlight_string_format != 0 " str.format syntax + syn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString syn match pythonStrFormat "{\([a-zA-Z_][a-zA-Z0-9_]*\|\d\+\)\(\.[a-zA-Z_][a-zA-Z0-9_]*\|\[\(\d\+\|[^!:\}]\+\)\]\)*\(![rs]\)\=\(:\({\([a-zA-Z_][a-zA-Z0-9_]*\|\d\+\)}\|\([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*\(\.\d\+\)\=[bcdeEfFgGnoxX%]\=\)\=\)\=}" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString endif if exists("python_highlight_string_templates") && python_highlight_string_templates != 0 " String templates - syn match pythonStrTemplate "\$\(\$\|{[a-zA-Z_][a-zA-Z0-9_]*}\|[a-zA-Z_][a-zA-Z0-9_]*\)" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString + syn match pythonStrTemplate "\$\$" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString + syn match pythonStrTemplate "\${[a-zA-Z_][a-zA-Z0-9_]*}" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString + syn match pythonStrTemplate "\$[a-zA-Z_][a-zA-Z0-9_]*" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString endif if exists("python_highlight_doctests") && python_highlight_doctests != 0 @@ -264,7 +267,7 @@ if exists("python_highlight_exceptions") && python_highlight_exceptions != 0 syn keyword pythonExClass SystemError SystemExit TypeError syn keyword pythonExClass UnboundLocalError UnicodeError syn keyword pythonExClass UnicodeEncodeError UnicodeDecodeError - syn keyword pythonExClass UnicodeTranslateError ValueError + syn keyword pythonExClass UnicodeTranslateError ValueError VMSError syn keyword pythonExClass WindowsError ZeroDivisionError syn keyword pythonExClass Warning UserWarning BytesWarning DeprecationWarning diff --git a/python3.0.vim b/python3.0.vim index 973cbea..9fbfa54 100644 --- a/python3.0.vim +++ b/python3.0.vim @@ -186,12 +186,15 @@ endif if exists("python_highlight_string_format") && python_highlight_string_format != 0 " str.format syntax - syn match pythonStrFormat "{\([a-zA-Z_][a-zA-Z0-9_]*\|\d\+\)\(\.[a-zA-Z_][a-zA-Z0-9_]*\|\[\(\d\+\|[^!:\}]\+\)\]\)*\(![rs]\)\=\(:\({\([a-zA-Z_][a-zA-Z0-9_]*\|\d\+\)}\|\([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*\(\.\d\+\)\=[bcdeEfFgGnoxX%]\=\)\=\)\=}" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString + syn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString + syn match pythonStrFormat "{\([a-zA-Z_][a-zA-Z0-9_]*\|\d\+\)\(\.[a-zA-Z_][a-zA-Z0-9_]*\|\[\(\d\+\|[^!:\}]\+\)\]\)*\(![rsa]\)\=\(:\({\([a-zA-Z_][a-zA-Z0-9_]*\|\d\+\)}\|\([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*\(\.\d\+\)\=[bcdeEfFgGnoxX%]\=\)\=\)\=}" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString endif if exists("python_highlight_string_templates") && python_highlight_string_templates != 0 " String templates - syn match pythonStrTemplate "\$\(\$\|{[a-zA-Z_][a-zA-Z0-9_]*}\|[a-zA-Z_][a-zA-Z0-9_]*\)" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString + syn match pythonStrTemplate "\$\$" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString + syn match pythonStrTemplate "\${[a-zA-Z_][a-zA-Z0-9_]*}" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString + syn match pythonStrTemplate "\$[a-zA-Z_][a-zA-Z0-9_]*" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString endif if exists("python_highlight_doctests") && python_highlight_doctests != 0 @@ -252,7 +255,7 @@ if exists("python_highlight_exceptions") && python_highlight_exceptions != 0 syn keyword pythonExClass SystemError SystemExit TypeError syn keyword pythonExClass UnboundLocalError UnicodeError syn keyword pythonExClass UnicodeEncodeError UnicodeDecodeError - syn keyword pythonExClass UnicodeTranslateError ValueError + syn keyword pythonExClass UnicodeTranslateError ValueError VMSError syn keyword pythonExClass WindowsError ZeroDivisionError syn keyword pythonExClass Warning UserWarning BytesWarning DeprecationWarning diff --git a/test.py b/test.py index bc2baa6..140a20d 100644 --- a/test.py +++ b/test.py @@ -75,9 +75,9 @@ b"test" " %f " -"{0.name!r:b} {0[n]} {name!s: }" +"{0.name!r:b} {0[n]} {name!s: } {{test}} {{}}" -"${test} ${test ${test}aname" +"${test} ${test ${test}aname $$$ $test+nope" # Doctests.