Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Elm Filter rules |
Christian Brabandt | f9ca139 | 2024-02-19 20:37:11 +0100 | [diff] [blame] | 3 | " Maintainer: This runtime file is looking for a new maintainer. |
| 4 | " Former Maintainer: Charles E. Campbell |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 5 | " Last Change: Aug 31, 2016 |
Bram Moolenaar | 1d9215b | 2020-01-25 13:27:42 +0100 | [diff] [blame] | 6 | " Version: 9 |
Christian Brabandt | f9ca139 | 2024-02-19 20:37:11 +0100 | [diff] [blame] | 7 | " Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_ELMFILT |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 8 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 9 | " quit when a syntax file was already loaded |
| 10 | if exists("b:current_syntax") |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 11 | finish |
| 12 | endif |
| 13 | |
| 14 | syn cluster elmfiltIfGroup contains=elmfiltCond,elmfiltOper,elmfiltOperKey,,elmfiltNumber,elmfiltOperKey |
| 15 | |
| 16 | syn match elmfiltParenError "[()]" |
| 17 | syn match elmfiltMatchError "/" |
| 18 | syn region elmfiltIf start="\<if\>" end="\<then\>" contains=elmfiltParen,elmfiltParenError skipnl skipwhite nextgroup=elmfiltAction |
| 19 | syn region elmfiltParen contained matchgroup=Delimiter start="(" matchgroup=Delimiter end=")" contains=elmfiltParen,@elmfiltIfGroup,elmfiltThenError |
| 20 | syn region elmfiltMatch contained matchgroup=Delimiter start="/" skip="\\/" matchgroup=Delimiter end="/" skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey |
| 21 | syn match elmfiltThenError "\<then.*$" |
| 22 | syn match elmfiltComment "^#.*$" contains=@Spell |
| 23 | |
| 24 | syn keyword elmfiltAction contained delete execute executec forward forwardc leave save savecopy skipnl skipwhite nextgroup=elmfiltString |
| 25 | syn match elmfiltArg contained "[^\\]%[&0-9dDhmrsSty&]"lc=1 |
| 26 | |
| 27 | syn match elmfiltOperKey contained "\<contains\>" skipnl skipwhite nextgroup=elmfiltString |
| 28 | syn match elmfiltOperKey contained "\<matches\s" nextgroup=elmfiltMatch,elmfiltSpaceError |
| 29 | syn keyword elmfiltCond contained cc bcc lines always subject sender from to lines received skipnl skipwhite nextgroup=elmfiltString |
| 30 | syn match elmfiltNumber contained "\d\+" |
| 31 | syn keyword elmfiltOperKey contained and not skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey,elmfiltString |
| 32 | syn match elmfiltOper contained "\~" skipnl skipwhite nextgroup=elmfiltMatch |
| 33 | syn match elmfiltOper contained "<=\|>=\|!=\|<\|<\|=" skipnl skipwhite nextgroup=elmfiltString,elmfiltCond,elmfiltOperKey |
Bram Moolenaar | 9964e46 | 2007-05-05 17:54:07 +0000 | [diff] [blame] | 34 | syn region elmfiltString contained start='"' skip='"\(\\\\\)*\\["%]' end='"' contains=elmfiltArg skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey,@Spell |
| 35 | syn region elmfiltString contained start="'" skip="'\(\\\\\)*\\['%]" end="'" contains=elmfiltArg skipnl skipwhite nextgroup=elmfiltOper,elmfiltOperKey,@Spell |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 36 | syn match elmfiltSpaceError contained "\s.*$" |
| 37 | |
| 38 | " Define the default highlighting. |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 39 | if !exists("skip_elmfilt_syntax_inits") |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 40 | |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 41 | 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 Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 55 | |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 56 | endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 57 | |
| 58 | let b:current_syntax = "elmfilt" |
| 59 | " vim: ts=9 |