On Mon, Nov 24, 2008 at 12:17:15AM -0500, James Vega wrote: > The current Python syntax file requires that only function names follow > the @ of a decorator. This isn't quite correct. As per Python's > language reference[0], decorators are actually "dotted_names" instead of > just "identifiers". > > Attached patch fixes the issue.
There was a small error in my last patch regarding how many times the dotted identifiers could be repeated. Attached patch fixes that. -- James GPG Key: 1024D/61326D40 2003-09-02 James Vega <[EMAIL PROTECTED]>
diff --git a/runtime/syntax/python.vim b/runtime/syntax/python.vim
index 5288d9b..d285aae 100644
--- a/runtime/syntax/python.vim
+++ b/runtime/syntax/python.vim
@@ -54,7 +54,8 @@ syn match pythonComment "#.*$" contains=pythonTodo,@Spell
syn keyword pythonTodo TODO FIXME XXX contained
" Decorators (new in Python 2.4)
-syn match pythonDecorator "@" display nextgroup=pythonFunction skipwhite
+syn match pythonDecoratorName "[[:alpha:]_][[:alnum:]_]*\%(\.[[:alpha:]_][[:alnum:]_]*\)*"
+syn match pythonDecorator "@" display nextgroup=pythonDecoratorName skipwhite
" strings
syn region pythonString matchgroup=Normal start=+[uU]\='+ end=+'+ skip=+\\\\\|\\'+ contains=pythonEscape,@Spell
@@ -150,6 +151,7 @@ if version >= 508 || !exists("did_python_syn_inits")
" The default methods for highlighting. Can be overridden later
HiLink pythonStatement Statement
HiLink pythonFunction Function
+ HiLink pythonDecoratorName Function
HiLink pythonConditional Conditional
HiLink pythonRepeat Repeat
HiLink pythonString String
signature.asc
Description: Digital signature

