Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " 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 |
| 13 | if !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' |
| 20 | endif |
| 21 | |
| 22 | |
| 23 | if version < 600 |
| 24 | source <sfile>:p:h/html.vim |
| 25 | else |
| 26 | runtime! syntax/html.vim |
| 27 | unlet b:current_syntax |
| 28 | endif |
| 29 | |
| 30 | syn cluster htmlPreProc add=webmacroIf,webmacroUse,webmacroBraces,webmacroParse,webmacroInclude,webmacroSet,webmacroForeach,webmacroComment |
| 31 | |
| 32 | syn match webmacroVariable "\$[a-zA-Z0-9.()]*;\=" |
| 33 | syn match webmacroNumber "[-+]\=\d\+[lL]\=" contained |
| 34 | syn keyword webmacroBoolean true false contained |
| 35 | syn match webmacroSpecial "\\." contained |
| 36 | syn region webmacroString contained start=+"+ end=+"+ contains=webmacroSpecial,webmacroVariable |
| 37 | syn region webmacroString contained start=+'+ end=+'+ contains=webmacroSpecial,webmacroVariable |
| 38 | syn region webmacroList contained matchgroup=Structure start="\[" matchgroup=Structure end="\]" contains=webmacroString,webmacroVariable,webmacroNumber,webmacroBoolean,webmacroList |
| 39 | |
| 40 | syn region webmacroIf start="#if" start="#else" end="{"me=e-1 contains=webmacroVariable,webmacroNumber,webmacroString,webmacroBoolean,webmacroList nextgroup=webmacroBraces |
| 41 | syn region webmacroForeach start="#foreach" end="{"me=e-1 contains=webmacroVariable,webmacroNumber,webmacroString,webmacroBoolean,webmacroList nextgroup=webmacroBraces |
| 42 | syn match webmacroSet "#set .*$" contains=webmacroVariable,webmacroNumber,webmacroNumber,webmacroBoolean,webmacroString,webmacroList |
| 43 | syn match webmacroInclude "#include .*$" contains=webmacroVariable,webmacroNumber,webmacroNumber,webmacroBoolean,webmacroString,webmacroList |
| 44 | syn match webmacroParse "#parse .*$" contains=webmacroVariable,webmacroNumber,webmacroNumber,webmacroBoolean,webmacroString,webmacroList |
| 45 | syn region webmacroUse matchgroup=PreProc start="#use .*" matchgroup=PreProc end="^-.*" contains=webmacroHash,@HtmlTop |
| 46 | syn region webmacroBraces matchgroup=Structure start="{" matchgroup=Structure end="}" contained transparent |
| 47 | syn match webmacroBracesError "[{}]" |
| 48 | syn match webmacroComment "##.*$" |
| 49 | syn 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 |
| 54 | if 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 |
| 76 | endif |
| 77 | |
| 78 | let b:current_syntax = "webmacro" |
| 79 | |
| 80 | if main_syntax == 'webmacro' |
| 81 | unlet main_syntax |
| 82 | endif |