diff options
Diffstat (limited to 'runtime/syntax/mason.vim')
-rw-r--r-- | runtime/syntax/mason.vim | 56 |
1 files changed, 32 insertions, 24 deletions
diff --git a/runtime/syntax/mason.vim b/runtime/syntax/mason.vim index 6789e11ae..f087def79 100644 --- a/runtime/syntax/mason.vim +++ b/runtime/syntax/mason.vim @@ -1,15 +1,13 @@ " Vim syntax file -" Language: Mason (Perl embedded in HTML) -" Maintainer: Andrew Smith <andrewdsmith@yahoo.com> -" Last change: 2003 May 11 -" URL: http://www.masonhq.com/editors/mason.vim +" Language: Mason (Perl embedded in HTML) +" Maintainer: vim-perl <vim-perl@googlegroups.com> +" Homepage: http://github.com/vim-perl/vim-perl/tree/master +" Bugs/requests: http://github.com/vim-perl/vim-perl/issues +" Last Change: 2017-09-12 +" Contributors: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com> +" Andrew Smith <andrewdsmith@yahoo.com> " -" This seems to work satisfactorily with html.vim and perl.vim for version 5.5. -" Please mail any fixes or improvements to the above address. Things that need -" doing include: -" -" - Add match for component names in <& &> blocks. -" - Add match for component names in <%def> and <%method> block delimiters. +" TODO: " - Fix <%text> blocks to show HTML tags but ignore Mason tags. " @@ -34,30 +32,38 @@ syn cluster htmlPreproc add=@masonTop " Now pull in the Perl syntax. " syn include @perlTop syntax/perl.vim +unlet b:current_syntax +syn include @podTop syntax/pod.vim " It's hard to reduce down to the correct sub-set of Perl to highlight in some " of these cases so I've taken the safe option of just using perlTop in all of " them. If you have any suggestions, please let me know. " -syn region masonLine matchgroup=Delimiter start="^%" end="$" contains=@perlTop -syn region masonExpr matchgroup=Delimiter start="<%" end="%>" contains=@perlTop -syn region masonPerl matchgroup=Delimiter start="<%perl>" end="</%perl>" contains=@perlTop -syn region masonComp keepend matchgroup=Delimiter start="<&" end="&>" contains=@perlTop +syn region masonPod start="^=[a-z]" end="^=cut" keepend contained contains=@podTop +syn cluster perlTop remove=perlBraces +syn region masonLine matchgroup=Delimiter start="^%" end="$" keepend contains=@perlTop +syn region masonPerlComment start="#" end="\%(%>\)\@=\|$" contained contains=perlTodo,@Spell +syn region masonExpr matchgroup=Delimiter start="<%" end="%>" contains=@perlTop,masonPerlComment +syn region masonPerl matchgroup=Delimiter start="<%perl>" end="</%perl>" contains=masonPod,@perlTop +syn region masonComp keepend matchgroup=Delimiter start="<&\s*\%([-._/[:alnum:]]\+:\)\?[-._/[:alnum:]]*" end="&>" contains=@perlTop +syn region masonComp keepend matchgroup=Delimiter skipnl start="<&|\s*\%([-._/[:alnum:]]\+:\)\?[-._/[:alnum:]]*" end="&>" contains=@perlTop nextgroup=masonCompContent +syn region masonCompContent matchgroup=Delimiter start="" end="</&>" contained contains=@masonTop -syn region masonArgs matchgroup=Delimiter start="<%args>" end="</%args>" contains=@perlTop +syn region masonArgs matchgroup=Delimiter start="<%args>" end="</%args>" contains=masonPod,@perlTop -syn region masonInit matchgroup=Delimiter start="<%init>" end="</%init>" contains=@perlTop -syn region masonCleanup matchgroup=Delimiter start="<%cleanup>" end="</%cleanup>" contains=@perlTop -syn region masonOnce matchgroup=Delimiter start="<%once>" end="</%once>" contains=@perlTop -syn region masonShared matchgroup=Delimiter start="<%shared>" end="</%shared>" contains=@perlTop +syn region masonInit matchgroup=Delimiter start="<%init>" end="</%init>" contains=masonPod,@perlTop +syn region masonCleanup matchgroup=Delimiter start="<%cleanup>" end="</%cleanup>" contains=masonPod,@perlTop +syn region masonOnce matchgroup=Delimiter start="<%once>" end="</%once>" contains=masonPod,@perlTop +syn region masonClass matchgroup=Delimiter start="<%class>" end="</%class>" contains=masonPod,@perlTop +syn region masonShared matchgroup=Delimiter start="<%shared>" end="</%shared>" contains=masonPod,@perlTop -syn region masonDef matchgroup=Delimiter start="<%def[^>]*>" end="</%def>" contains=@htmlTop -syn region masonMethod matchgroup=Delimiter start="<%method[^>]*>" end="</%method>" contains=@htmlTop +syn region masonDef matchgroup=Delimiter start="<%def\s*[-._/[:alnum:]]\+\s*>" end="</%def>" contains=@htmlTop +syn region masonMethod matchgroup=Delimiter start="<%method\s*[-._/[:alnum:]]\+\s*>" end="</%method>" contains=@htmlTop -syn region masonFlags matchgroup=Delimiter start="<%flags>" end="</%flags>" contains=@perlTop -syn region masonAttr matchgroup=Delimiter start="<%attr>" end="</%attr>" contains=@perlTop +syn region masonFlags matchgroup=Delimiter start="<%flags>" end="</%flags>" contains=masonPod,@perlTop +syn region masonAttr matchgroup=Delimiter start="<%attr>" end="</%attr>" contains=masonPod,@perlTop -syn region masonFilter matchgroup=Delimiter start="<%filter>" end="</%filter>" contains=@perlTop +syn region masonFilter matchgroup=Delimiter start="<%filter>" end="</%filter>" contains=masonPod,@perlTop syn region masonDoc matchgroup=Delimiter start="<%doc>" end="</%doc>" syn region masonText matchgroup=Delimiter start="<%text>" end="</%text>" @@ -67,6 +73,8 @@ syn cluster masonTop contains=masonLine,masonExpr,masonPerl,masonComp,masonArgs, " Set up default highlighting. Almost all of this is done in the included " syntax files. hi def link masonDoc Comment +hi def link masonPod Comment +hi def link masonPerlComment perlComment let b:current_syntax = "mason" |