Bram Moolenaar | bfd8fc0 | 2005-09-20 23:22:24 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Asterisk config file |
| 3 | " Maintainer: brc007 |
| 4 | " Last Change: 2005 Sep 19 |
| 5 | " version 0.2 |
| 6 | " |
| 7 | " Additional changes made 2005 Mar 7 by Corydon76 |
| 8 | " * CVS priority, including n and s, and new label definitions |
| 9 | " * ENV( and LEN( support |
| 10 | " * Class patterns in extensions now match only the class pattern (instead of to a following expression) |
| 11 | " * anthm's functions are matched |
| 12 | " * Variables now appear in their own colors inside expressions |
| 13 | |
| 14 | " For version 5.x: Clear all syntax items |
| 15 | " For version 6.x: Quit when a syntax file was already loaded |
| 16 | if version < 600 |
| 17 | syntax clear |
| 18 | elseif exists("b:current_syntax") |
| 19 | finish |
| 20 | endif |
| 21 | |
| 22 | "testing only |
| 23 | syn sync clear |
| 24 | syn sync fromstart |
| 25 | |
| 26 | |
| 27 | syn keyword asteriskTodo TODO contained |
| 28 | syn match asteriskComment ";.*" contains=asteriskTodo |
| 29 | syn match asteriskContext "\[.\{-}\]" |
| 30 | syn match asteriskExten "^\s*exten\s*=>" |
| 31 | syn match asteriskApp "\s*,\s*\zs[a-zA-Z]*\ze" |
| 32 | " Digits plus oldlabel (newlabel) |
| 33 | syn match asteriskPriority ",[[:digit:]]\+\(+[[:alpha:]][[:alnum:]_]*\)\?\(([[:alpha:]][[:alnum:]_]*)\)\?," |
| 34 | " s or n plus digits (newlabel) |
| 35 | syn match asteriskPriority ",[sn]\(+[[:digit:]]\+\)\?\(([[:alpha:]][[:alnum:]_]*)\)\?," |
| 36 | syn match asteriskIncludeBad "^\s*#\s*[[:alnum:]]*" |
| 37 | syn match asteriskInclude "^\s#\sinclude\s.*" |
| 38 | syn match asteriskVar "\${_\{0,2}[[:alpha:]][[:alnum:]_]*\(:[[:digit:]]\+\)\{0,2}}" |
| 39 | syn match asteriskVarLen "\${_\{0,2}[[:alpha:]][[:alnum:]_]*(.\{-})}" contains=asteriskVar,asteriskVarLen,asteriskExp |
| 40 | syn match asteriskExp "\$\[.\{-}\]" contains=asteriskVar,asteriskVarLen,asteriskExp |
| 41 | syn match asteriskFunc "\$([[:alpha:]][[:alnum:]_]*.*)" contains=asteriskVar,asteriskVarLen,asteriskExp |
| 42 | |
| 43 | " Define the default highlighting. |
| 44 | " For version 5.7 and earlier: only when not done already |
| 45 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 46 | :if version >= 508 || !exists("did_conf_syntax_inits") |
| 47 | if version < 508 |
| 48 | let did_conf_syntax_inits = 1 |
| 49 | command -nargs=+ HiLink hi link <args> |
| 50 | else |
| 51 | command -nargs=+ HiLink hi def link <args> |
| 52 | endif |
| 53 | |
| 54 | |
| 55 | HiLink asteriskComment Comment |
| 56 | " not sure what type this should be, using String for testing. |
| 57 | HiLink asteriskExten String |
| 58 | " same here |
| 59 | HiLink asteriskContext Identifier |
| 60 | HiLink asteriskApplication Statement |
| 61 | HiLink asteriskInclude Preproc |
| 62 | HiLink asteriskIncludeBad Error |
| 63 | HiLink asteriskPriority Preproc |
| 64 | HiLink asteriskVar String |
| 65 | HiLink asteriskVarLen Function |
| 66 | HiLink asteriskExp Type |
| 67 | delcommand HiLink |
| 68 | endif |
| 69 | |
| 70 | |
| 71 | let b:current_syntax = "asterisk" |
| 72 | |
| 73 | " vim: ts=8 sw=2 |