2 " Language: Elm Filter rules
3 " Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz>
4 " Last Change: Sep 11, 2006
6 " URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax
8 " For version 5.x: Clear all syntax items
9 " For version 6.x: Quit when a syntax file was already loaded
12 elseif exists("b:current_syntax")
16 syn cluster elmfiltIfGroup contains=elmfiltCond,elmfiltOper,elmfiltOperKey,,elmfiltNumber,elmfiltOperKey
18 syn match elmfiltParenError "[()]"
19 syn match elmfiltMatchError "/"
20 syn region elmfiltIf start="\<if\>" end="\<then\>" contains=elmfiltParen,elmfiltParenError skipnl skipwhite nextgroup=elmfiltAction
21 syn region elmfiltParen contained matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=elmfiltParen,@elmfiltIfGroup,elmfiltThenError
22 syn region elmfiltMatch contained matchgroup=Delimiter start="/" skip="\\/" matchgroup=Delimiter end="/" skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey
23 syn match elmfiltThenError "\<then.*$"
24 syn match elmfiltComment "^#.*$" contains=@Spell
26 syn keyword elmfiltAction contained delete execute executec forward forwardc leave save savecopy skipnl skipwhite nextgroup=elmfiltString
27 syn match elmfiltArg contained "[^\\]%[&0-9dDhmrsSty&]"lc=1
29 syn match elmfiltOperKey contained "\<contains\>" skipnl skipwhite nextgroup=elmfiltString
30 syn match elmfiltOperKey contained "\<matches\s" nextgroup=elmfiltMatch,elmfiltSpaceError
31 syn keyword elmfiltCond contained cc bcc lines always subject sender from to lines received skipnl skipwhite nextgroup=elmfiltString
32 syn match elmfiltNumber contained "\d\+"
33 syn keyword elmfiltOperKey contained and not skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey,elmfiltString
34 syn match elmfiltOper contained "\~" skipnl skipwhite nextgroup=elmfiltMatch
35 syn match elmfiltOper contained "<=\|>=\|!=\|<\|<\|=" skipnl skipwhite nextgroup=elmfiltString,elmfiltCond,elmfiltOperKey
36 syn region elmfiltString contained start='"' skip='"\(\\\\\)*\\["%]' end='"' contains=elmfiltArg skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey,@Spell
37 syn region elmfiltString contained start="'" skip="'\(\\\\\)*\\['%]" end="'" contains=elmfiltArg skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey,@Spell
38 syn match elmfiltSpaceError contained "\s.*$"
40 " Define the default highlighting.
41 " For version 5.7 and earlier: only when not done already
42 " For version 5.8 and later: only when an item doesn't have highlighting yet
43 if version >= 508 || !exists("did_elmfilt_syntax_inits")
45 let did_elmfilt_syntax_inits = 1
46 command -nargs=+ HiLink hi link <args>
48 command -nargs=+ HiLink hi def link <args>
51 HiLink elmfiltAction Statement
52 HiLink elmfiltArg Special
53 HiLink elmfiltComment Comment
54 HiLink elmfiltCond Statement
55 HiLink elmfiltIf Statement
56 HiLink elmfiltMatch Special
57 HiLink elmfiltMatchError Error
58 HiLink elmfiltNumber Number
59 HiLink elmfiltOper Operator
60 HiLink elmfiltOperKey Type
61 HiLink elmfiltParenError Error
62 HiLink elmfiltSpaceError Error
63 HiLink elmfiltString String
64 HiLink elmfiltThenError Error
69 let b:current_syntax = "elmfilt"