blob: 58589466484d2e2fdbc3178a10e471f72cdc3fcd [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
Bram Moolenaar89bcfda2016-08-30 23:26:57 +02008" quit when a syntax file was already loaded
9if exists("b:current_syntax")
Bram Moolenaar071d4272004-06-13 20:20:40 +000010 finish
11endif
12
13syn cluster elmfiltIfGroup contains=elmfiltCond,elmfiltOper,elmfiltOperKey,,elmfiltNumber,elmfiltOperKey
14
15syn match elmfiltParenError "[()]"
16syn match elmfiltMatchError "/"
17syn region elmfiltIf start="\<if\>" end="\<then\>" contains=elmfiltParen,elmfiltParenError skipnl skipwhite nextgroup=elmfiltAction
18syn region elmfiltParen contained matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=elmfiltParen,@elmfiltIfGroup,elmfiltThenError
19syn region elmfiltMatch contained matchgroup=Delimiter start="/" skip="\\/" matchgroup=Delimiter end="/" skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey
20syn match elmfiltThenError "\<then.*$"
21syn match elmfiltComment "^#.*$" contains=@Spell
22
23syn keyword elmfiltAction contained delete execute executec forward forwardc leave save savecopy skipnl skipwhite nextgroup=elmfiltString
24syn match elmfiltArg contained "[^\\]%[&0-9dDhmrsSty&]"lc=1
25
26syn match elmfiltOperKey contained "\<contains\>" skipnl skipwhite nextgroup=elmfiltString
27syn match elmfiltOperKey contained "\<matches\s" nextgroup=elmfiltMatch,elmfiltSpaceError
28syn keyword elmfiltCond contained cc bcc lines always subject sender from to lines received skipnl skipwhite nextgroup=elmfiltString
29syn match elmfiltNumber contained "\d\+"
30syn keyword elmfiltOperKey contained and not skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey,elmfiltString
31syn match elmfiltOper contained "\~" skipnl skipwhite nextgroup=elmfiltMatch
32syn match elmfiltOper contained "<=\|>=\|!=\|<\|<\|=" skipnl skipwhite nextgroup=elmfiltString,elmfiltCond,elmfiltOperKey
Bram Moolenaar9964e462007-05-05 17:54:07 +000033syn region elmfiltString contained start='"' skip='"\(\\\\\)*\\["%]' end='"' contains=elmfiltArg skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey,@Spell
34syn region elmfiltString contained start="'" skip="'\(\\\\\)*\\['%]" end="'" contains=elmfiltArg skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey,@Spell
Bram Moolenaar071d4272004-06-13 20:20:40 +000035syn match elmfiltSpaceError contained "\s.*$"
36
37" Define the default highlighting.
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020038" Only when an item doesn't have highlighting yet
39command -nargs=+ HiLink hi def link <args>
Bram Moolenaar071d4272004-06-13 20:20:40 +000040
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020041HiLink elmfiltAction Statement
42HiLink elmfiltArg Special
43HiLink elmfiltComment Comment
44HiLink elmfiltCond Statement
45HiLink elmfiltIf Statement
46HiLink elmfiltMatch Special
47HiLink elmfiltMatchError Error
48HiLink elmfiltNumber Number
49HiLink elmfiltOper Operator
50HiLink elmfiltOperKey Type
51HiLink elmfiltParenError Error
52HiLink elmfiltSpaceError Error
53HiLink elmfiltString String
54HiLink elmfiltThenError Error
Bram Moolenaar071d4272004-06-13 20:20:40 +000055
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020056delcommand HiLink
Bram Moolenaar071d4272004-06-13 20:20:40 +000057
58let b:current_syntax = "elmfilt"
59" vim: ts=9