blob: e7d5df22aa80023bf0a19af3581db4ca2ff69cdd [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: Elm Filter rules
Bram Moolenaare2719092015-01-10 15:09:25 +01003" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz>
4" Last Change: Oct 23, 2014
5" Version: 6
6" URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_ELMFILT
Bram Moolenaar071d4272004-06-13 20:20:40 +00007
8" For version 5.x: Clear all syntax items
9" For version 6.x: Quit when a syntax file was already loaded
10if version < 600
11 syntax clear
12elseif exists("b:current_syntax")
13 finish
14endif
15
16syn cluster elmfiltIfGroup contains=elmfiltCond,elmfiltOper,elmfiltOperKey,,elmfiltNumber,elmfiltOperKey
17
18syn match elmfiltParenError "[()]"
19syn match elmfiltMatchError "/"
20syn region elmfiltIf start="\<if\>" end="\<then\>" contains=elmfiltParen,elmfiltParenError skipnl skipwhite nextgroup=elmfiltAction
21syn region elmfiltParen contained matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=elmfiltParen,@elmfiltIfGroup,elmfiltThenError
22syn region elmfiltMatch contained matchgroup=Delimiter start="/" skip="\\/" matchgroup=Delimiter end="/" skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey
23syn match elmfiltThenError "\<then.*$"
24syn match elmfiltComment "^#.*$" contains=@Spell
25
26syn keyword elmfiltAction contained delete execute executec forward forwardc leave save savecopy skipnl skipwhite nextgroup=elmfiltString
27syn match elmfiltArg contained "[^\\]%[&0-9dDhmrsSty&]"lc=1
28
29syn match elmfiltOperKey contained "\<contains\>" skipnl skipwhite nextgroup=elmfiltString
30syn match elmfiltOperKey contained "\<matches\s" nextgroup=elmfiltMatch,elmfiltSpaceError
31syn keyword elmfiltCond contained cc bcc lines always subject sender from to lines received skipnl skipwhite nextgroup=elmfiltString
32syn match elmfiltNumber contained "\d\+"
33syn keyword elmfiltOperKey contained and not skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey,elmfiltString
34syn match elmfiltOper contained "\~" skipnl skipwhite nextgroup=elmfiltMatch
35syn match elmfiltOper contained "<=\|>=\|!=\|<\|<\|=" skipnl skipwhite nextgroup=elmfiltString,elmfiltCond,elmfiltOperKey
Bram Moolenaar9964e462007-05-05 17:54:07 +000036syn region elmfiltString contained start='"' skip='"\(\\\\\)*\\["%]' end='"' contains=elmfiltArg skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey,@Spell
37syn region elmfiltString contained start="'" skip="'\(\\\\\)*\\['%]" end="'" contains=elmfiltArg skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey,@Spell
Bram Moolenaar071d4272004-06-13 20:20:40 +000038syn match elmfiltSpaceError contained "\s.*$"
39
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
43if version >= 508 || !exists("did_elmfilt_syntax_inits")
44 if version < 508
45 let did_elmfilt_syntax_inits = 1
46 command -nargs=+ HiLink hi link <args>
47 else
48 command -nargs=+ HiLink hi def link <args>
49 endif
50
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
65
66 delcommand HiLink
67endif
68
69let b:current_syntax = "elmfilt"
70" vim: ts=9