Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Elm Filter rules |
Bram Moolenaar | e271909 | 2015-01-10 15:09:25 +0100 | [diff] [blame] | 3 | " 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 Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 7 | |
| 8 | " For version 5.x: Clear all syntax items |
| 9 | " For version 6.x: Quit when a syntax file was already loaded |
| 10 | if version < 600 |
| 11 | syntax clear |
| 12 | elseif exists("b:current_syntax") |
| 13 | finish |
| 14 | endif |
| 15 | |
| 16 | syn cluster elmfiltIfGroup contains=elmfiltCond,elmfiltOper,elmfiltOperKey,,elmfiltNumber,elmfiltOperKey |
| 17 | |
| 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 |
| 25 | |
| 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 |
| 28 | |
| 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 |
Bram Moolenaar | 9964e46 | 2007-05-05 17:54:07 +0000 | [diff] [blame] | 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 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 38 | syn 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 |
| 43 | if 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 |
| 67 | endif |
| 68 | |
| 69 | let b:current_syntax = "elmfilt" |
| 70 | " vim: ts=9 |