blob: 3b863f7c37dfeea7488c23c28ee4b7b3c7943361 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" WebMacro syntax file
2" Language: WebMacro
3" Maintainer: Claudio Fleiner <claudio@fleiner.com>
4" URL: http://www.fleiner.com/vim/syntax/webmacro.vim
5" Last Change: 2003 May 11
6
7" webmacro is a nice little language that you should
8" check out if you use java servlets.
9" webmacro: http://www.webmacro.org
10
11" For version 5.x: Clear all syntax items
12" For version 6.x: Quit when a syntax file was already loaded
13if !exists("main_syntax")
14 if version < 600
15 syntax clear
16 elseif exists("b:current_syntax")
17 finish
18 endif
19 let main_syntax = 'webmacro'
20endif
21
22
23if version < 600
24 source <sfile>:p:h/html.vim
25else
26 runtime! syntax/html.vim
27 unlet b:current_syntax
28endif
29
30syn cluster htmlPreProc add=webmacroIf,webmacroUse,webmacroBraces,webmacroParse,webmacroInclude,webmacroSet,webmacroForeach,webmacroComment
31
32syn match webmacroVariable "\$[a-zA-Z0-9.()]*;\="
33syn match webmacroNumber "[-+]\=\d\+[lL]\=" contained
34syn keyword webmacroBoolean true false contained
35syn match webmacroSpecial "\\." contained
36syn region webmacroString contained start=+"+ end=+"+ contains=webmacroSpecial,webmacroVariable
37syn region webmacroString contained start=+'+ end=+'+ contains=webmacroSpecial,webmacroVariable
38syn region webmacroList contained matchgroup=Structure start="\[" matchgroup=Structure end="\]" contains=webmacroString,webmacroVariable,webmacroNumber,webmacroBoolean,webmacroList
39
40syn region webmacroIf start="#if" start="#else" end="{"me=e-1 contains=webmacroVariable,webmacroNumber,webmacroString,webmacroBoolean,webmacroList nextgroup=webmacroBraces
41syn region webmacroForeach start="#foreach" end="{"me=e-1 contains=webmacroVariable,webmacroNumber,webmacroString,webmacroBoolean,webmacroList nextgroup=webmacroBraces
42syn match webmacroSet "#set .*$" contains=webmacroVariable,webmacroNumber,webmacroNumber,webmacroBoolean,webmacroString,webmacroList
43syn match webmacroInclude "#include .*$" contains=webmacroVariable,webmacroNumber,webmacroNumber,webmacroBoolean,webmacroString,webmacroList
44syn match webmacroParse "#parse .*$" contains=webmacroVariable,webmacroNumber,webmacroNumber,webmacroBoolean,webmacroString,webmacroList
45syn region webmacroUse matchgroup=PreProc start="#use .*" matchgroup=PreProc end="^-.*" contains=webmacroHash,@HtmlTop
46syn region webmacroBraces matchgroup=Structure start="{" matchgroup=Structure end="}" contained transparent
47syn match webmacroBracesError "[{}]"
48syn match webmacroComment "##.*$"
49syn match webmacroHash "[#{}\$]" contained
50
51" Define the default highlighting.
52" For version 5.7 and earlier: only when not done already
53" For version 5.8 and later: only when an item doesn't have highlighting yet
54if version >= 508 || !exists("did_webmacro_syn_inits")
55 if version < 508
56 let did_webmacro_syn_inits = 1
57 command -nargs=+ HiLink hi link <args>
58 else
59 command -nargs=+ HiLink hi def link <args>
60 endif
61
62 HiLink webmacroComment CommentTitle
63 HiLink webmacroVariable PreProc
64 HiLink webmacroIf webmacroStatement
65 HiLink webmacroForeach webmacroStatement
66 HiLink webmacroSet webmacroStatement
67 HiLink webmacroInclude webmacroStatement
68 HiLink webmacroParse webmacroStatement
69 HiLink webmacroStatement Function
70 HiLink webmacroNumber Number
71 HiLink webmacroBoolean Boolean
72 HiLink webmacroSpecial Special
73 HiLink webmacroString String
74 HiLink webmacroBracesError Error
75 delcommand HiLink
76endif
77
78let b:current_syntax = "webmacro"
79
80if main_syntax == 'webmacro'
81 unlet main_syntax
82endif