Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Procmail definition file |
| 3 | " Maintainer: Melchior FRANZ <mfranz@aon.at> |
| 4 | " Last Change: 2003 Aug 14 |
| 5 | " Author: Sonia Heimann |
| 6 | |
| 7 | " For version 5.x: Clear all syntax items |
| 8 | " For version 6.x: Quit when a syntax file was already loaded |
| 9 | if version < 600 |
| 10 | syntax clear |
| 11 | elseif exists("b:current_syntax") |
| 12 | finish |
| 13 | endif |
| 14 | |
| 15 | syn match procmailComment "#.*$" contains=procmailTodo |
| 16 | syn keyword procmailTodo contained Todo TBD |
| 17 | |
| 18 | syn region procmailString start=+"+ skip=+\\"+ end=+"+ |
| 19 | syn region procmailString start=+'+ skip=+\\'+ end=+'+ |
| 20 | |
| 21 | syn region procmailVarDeclRegion start="^\s*[a-zA-Z0-9_]\+\s*="hs=e-1 skip=+\\$+ end=+$+ contains=procmailVar,procmailVarDecl,procmailString |
| 22 | syn match procmailVarDecl contained "^\s*[a-zA-Z0-9_]\+" |
| 23 | syn match procmailVar "$[a-zA-Z0-9_]\+" |
| 24 | |
| 25 | syn match procmailCondition contained "^\s*\*.*" |
| 26 | |
| 27 | syn match procmailActionFolder contained "^\s*[-_a-zA-Z0-9/]\+" |
| 28 | syn match procmailActionVariable contained "^\s*$[a-zA-Z_]\+" |
| 29 | syn region procmailActionForward start=+^\s*!+ skip=+\\$+ end=+$+ |
| 30 | syn region procmailActionPipe start=+^\s*|+ skip=+\\$+ end=+$+ |
| 31 | syn region procmailActionNested start=+^\s*{+ end=+^\s*}+ contains=procmailRecipe,procmailComment,procmailVarDeclRegion |
| 32 | |
| 33 | syn region procmailRecipe start=+^\s*:.*$+ end=+^\s*\($\|}\)+me=e-1 contains=procmailComment,procmailCondition,procmailActionFolder,procmailActionVariable,procmailActionForward,procmailActionPipe,procmailActionNested,procmailVarDeclRegion |
| 34 | |
| 35 | " Define the default highlighting. |
| 36 | " For version 5.7 and earlier: only when not done already |
| 37 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 38 | if version >= 508 || !exists("did_procmail_syntax_inits") |
| 39 | if version < 508 |
| 40 | let did_procmail_syntax_inits = 1 |
| 41 | command -nargs=+ HiLink hi link <args> |
| 42 | else |
| 43 | command -nargs=+ HiLink hi def link <args> |
| 44 | endif |
| 45 | |
| 46 | HiLink procmailComment Comment |
| 47 | HiLink procmailTodo Todo |
| 48 | |
| 49 | HiLink procmailRecipe Statement |
| 50 | "HiLink procmailCondition Statement |
| 51 | |
| 52 | HiLink procmailActionFolder procmailAction |
| 53 | HiLink procmailActionVariable procmailAction |
| 54 | HiLink procmailActionForward procmailAction |
| 55 | HiLink procmailActionPipe procmailAction |
| 56 | HiLink procmailAction Function |
| 57 | HiLink procmailVar Identifier |
| 58 | HiLink procmailVarDecl Identifier |
| 59 | |
| 60 | HiLink procmailString String |
| 61 | |
| 62 | delcommand HiLink |
| 63 | endif |
| 64 | |
| 65 | let b:current_syntax = "procmail" |
| 66 | |
| 67 | " vim: ts=8 |