Added support for string.Template syntax

This commit is contained in:
Dmitry Vasiliev
2008-09-21 17:41:55 +04:00
parent 780c6ef483
commit 907ec01b45
3 changed files with 20 additions and 2 deletions

View File

@@ -9,6 +9,8 @@ Revision 2.6.1 (unknown):
- Added option "python_print_as_function" for highlight "print" as a
function;
- Added support for new integer literal syntax "0o" and "0b";
- Added support for string.Template syntax controlled by
"python_highlight_string_templates" option;
Revision 2.5.6 (2007-02-04):

View File

@@ -1,7 +1,11 @@
- Highligh for string.Template?
Now
===
- Python 3.0 string formatting
Later
=====
- Highligh errors where symbols follow by numbers like this: 0o123LaB
- Need more accurate way to handle indentation errors. For example

View File

@@ -13,7 +13,7 @@
" Thanks:
"
" Jeroen Ruigrok van der Werven
" for the idea of highlighting for erroneous operators
" for the idea to highlight erroneous operators
" Pedro Algarvio
" for the patch to enable spell checking only for the right spots
" (strings and comments)
@@ -37,6 +37,9 @@
" For highlight string formatting:
" python_highlight_string_formatting
"
" For highlight string.Template templates:
" python_highlight_string_templates
"
" For highlight indentation errors:
" python_highlight_indent_errors
"
@@ -75,6 +78,9 @@ if exists("python_highlight_all") && python_highlight_all != 0
if !exists("python_highlight_string_formatting")
let python_highlight_string_formatting = 1
endif
if !exists("python_highlight_string_templates")
let python_highlight_string_templates = 1
endif
if !exists("python_highlight_indent_errors")
let python_highlight_indent_errors = 1
endif
@@ -180,6 +186,11 @@ if exists("python_highlight_string_formatting") && python_highlight_string_forma
syn match pythonStrFormat "%[-#0 +]*\(\*\|\d\+\)\=\(\.\(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]" 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_]*\)" contained containedin=pythonString,pythonUniString,pythonRawString,pythonUniRawString
endif
if exists("python_highlight_doctests") && python_highlight_doctests != 0
" DocTests
syn region pythonDocTest start="^\s*>>>" end=+'''+he=s-1 end="^\s*$" contained
@@ -301,6 +312,7 @@ if version >= 508 || !exists("did_python_syn_inits")
HiLink pythonUniRawEscapeError Error
HiLink pythonStrFormat Special
HiLink pythonStrTemplate Special
HiLink pythonDocTest Special
HiLink pythonDocTest2 Special