blob: aa1b57cbfe7b529287bce888a9b1c56404783539 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: Elm Filter rules
Christian Brabandtf9ca1392024-02-19 20:37:11 +01003" Maintainer: This runtime file is looking for a new maintainer.
4" Former Maintainer: Charles E. Campbell
Bram Moolenaarf37506f2016-08-31 22:22:10 +02005" Last Change: Aug 31, 2016
Bram Moolenaar1d9215b2020-01-25 13:27:42 +01006" Version: 9
Christian Brabandtf9ca1392024-02-19 20:37:11 +01007" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_ELMFILT
Bram Moolenaar071d4272004-06-13 20:20:40 +00008
Bram Moolenaar89bcfda2016-08-30 23:26:57 +02009" quit when a syntax file was already loaded
10if exists("b:current_syntax")
Bram Moolenaar071d4272004-06-13 20:20:40 +000011 finish
12endif
13
14syn cluster elmfiltIfGroup contains=elmfiltCond,elmfiltOper,elmfiltOperKey,,elmfiltNumber,elmfiltOperKey
15
16syn match elmfiltParenError "[()]"
17syn match elmfiltMatchError "/"
18syn region elmfiltIf start="\<if\>" end="\<then\>" contains=elmfiltParen,elmfiltParenError skipnl skipwhite nextgroup=elmfiltAction
19syn region elmfiltParen contained matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=elmfiltParen,@elmfiltIfGroup,elmfiltThenError
20syn region elmfiltMatch contained matchgroup=Delimiter start="/" skip="\\/" matchgroup=Delimiter end="/" skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey
21syn match elmfiltThenError "\<then.*$"
22syn match elmfiltComment "^#.*$" contains=@Spell
23
24syn keyword elmfiltAction contained delete execute executec forward forwardc leave save savecopy skipnl skipwhite nextgroup=elmfiltString
25syn match elmfiltArg contained "[^\\]%[&0-9dDhmrsSty&]"lc=1
26
27syn match elmfiltOperKey contained "\<contains\>" skipnl skipwhite nextgroup=elmfiltString
28syn match elmfiltOperKey contained "\<matches\s" nextgroup=elmfiltMatch,elmfiltSpaceError
29syn keyword elmfiltCond contained cc bcc lines always subject sender from to lines received skipnl skipwhite nextgroup=elmfiltString
30syn match elmfiltNumber contained "\d\+"
31syn keyword elmfiltOperKey contained and not skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey,elmfiltString
32syn match elmfiltOper contained "\~" skipnl skipwhite nextgroup=elmfiltMatch
33syn match elmfiltOper contained "<=\|>=\|!=\|<\|<\|=" skipnl skipwhite nextgroup=elmfiltString,elmfiltCond,elmfiltOperKey
Bram Moolenaar9964e462007-05-05 17:54:07 +000034syn region elmfiltString contained start='"' skip='"\(\\\\\)*\\["%]' end='"' contains=elmfiltArg skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey,@Spell
35syn region elmfiltString contained start="'" skip="'\(\\\\\)*\\['%]" end="'" contains=elmfiltArg skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey,@Spell
Bram Moolenaar071d4272004-06-13 20:20:40 +000036syn match elmfiltSpaceError contained "\s.*$"
37
38" Define the default highlighting.
Bram Moolenaarf37506f2016-08-31 22:22:10 +020039if !exists("skip_elmfilt_syntax_inits")
Bram Moolenaar071d4272004-06-13 20:20:40 +000040
Bram Moolenaarf37506f2016-08-31 22:22:10 +020041 hi def link elmfiltAction Statement
42 hi def link elmfiltArg Special
43 hi def link elmfiltComment Comment
44 hi def link elmfiltCond Statement
45 hi def link elmfiltIf Statement
46 hi def link elmfiltMatch Special
47 hi def link elmfiltMatchError Error
48 hi def link elmfiltNumber Number
49 hi def link elmfiltOper Operator
50 hi def link elmfiltOperKey Type
51 hi def link elmfiltParenError Error
52 hi def link elmfiltSpaceError Error
53 hi def link elmfiltString String
54 hi def link elmfiltThenError Error
Bram Moolenaar071d4272004-06-13 20:20:40 +000055
Bram Moolenaarf37506f2016-08-31 22:22:10 +020056endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000057
58let b:current_syntax = "elmfilt"
59" vim: ts=9