annotate runtime/syntax/mason.vim @ 622:4096208d2a50

updated for version 7.0178
author vimboss
date Thu, 29 Dec 2005 22:45:34 +0000
parents 3fc0f57ecb91
children 43efa4f5a8ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim syntax file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: Mason (Perl embedded in HTML)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 " Maintainer: Andrew Smith <andrewdsmith@yahoo.com>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 " Last change: 2003 May 11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 " URL: http://www.masonhq.com/editors/mason.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 " This seems to work satisfactorily with html.vim and perl.vim for version 5.5.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 " Please mail any fixes or improvements to the above address. Things that need
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 " doing include:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 " - Add match for component names in <& &> blocks.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 " - Add match for component names in <%def> and <%method> block delimiters.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 " - Fix <%text> blocks to show HTML tags but ignore Mason tags.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 " Clear previous syntax settings unless this is v6 or above, in which case just
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 " exit without doing anything.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 if version < 600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 syn clear
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 elseif exists("b:current_syntax")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 " The HTML syntax file included below uses this variable.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 if !exists("main_syntax")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 let main_syntax = 'mason'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 " First pull in the HTML syntax.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 if version < 600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 so <sfile>:p:h/html.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 runtime! syntax/html.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 unlet b:current_syntax
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 syn cluster htmlPreproc add=@masonTop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 " Now pull in the Perl syntax.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 if version < 600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 syn include @perlTop <sfile>:p:h/perl.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 syn include @perlTop syntax/perl.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 " It's hard to reduce down to the correct sub-set of Perl to highlight in some
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 " of these cases so I've taken the safe option of just using perlTop in all of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 " them. If you have any suggestions, please let me know.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 syn region masonLine matchgroup=Delimiter start="^%" end="$" contains=@perlTop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 syn region masonExpr matchgroup=Delimiter start="<%" end="%>" contains=@perlTop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 syn region masonPerl matchgroup=Delimiter start="<%perl>" end="</%perl>" contains=@perlTop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 syn region masonComp keepend matchgroup=Delimiter start="<&" end="&>" contains=@perlTop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 syn region masonArgs matchgroup=Delimiter start="<%args>" end="</%args>" contains=@perlTop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 syn region masonInit matchgroup=Delimiter start="<%init>" end="</%init>" contains=@perlTop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 syn region masonCleanup matchgroup=Delimiter start="<%cleanup>" end="</%cleanup>" contains=@perlTop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 syn region masonOnce matchgroup=Delimiter start="<%once>" end="</%once>" contains=@perlTop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 syn region masonShared matchgroup=Delimiter start="<%shared>" end="</%shared>" contains=@perlTop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 syn region masonDef matchgroup=Delimiter start="<%def[^>]*>" end="</%def>" contains=@htmlTop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 syn region masonMethod matchgroup=Delimiter start="<%method[^>]*>" end="</%method>" contains=@htmlTop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 syn region masonFlags matchgroup=Delimiter start="<%flags>" end="</%flags>" contains=@perlTop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 syn region masonAttr matchgroup=Delimiter start="<%attr>" end="</%attr>" contains=@perlTop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 syn region masonFilter matchgroup=Delimiter start="<%filter>" end="</%filter>" contains=@perlTop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 syn region masonDoc matchgroup=Delimiter start="<%doc>" end="</%doc>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 syn region masonText matchgroup=Delimiter start="<%text>" end="</%text>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 syn cluster masonTop contains=masonLine,masonExpr,masonPerl,masonComp,masonArgs,masonInit,masonCleanup,masonOnce,masonShared,masonDef,masonMethod,masonFlags,masonAttr,masonFilter,masonDoc,masonText
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 " Set up default highlighting. Almost all of this is done in the included
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 " syntax files.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 if version >= 508 || !exists("did_mason_syn_inits")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 if version < 508
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 let did_mason_syn_inits = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 com -nargs=+ HiLink hi link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 com -nargs=+ HiLink hi def link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 HiLink masonDoc Comment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 delc HiLink
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 let b:current_syntax = "mason"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 if main_syntax == 'mason'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 unlet main_syntax
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 endif