Bram Moolenaar | bfd8fc0 | 2005-09-20 23:22:24 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Asterisk config file |
Bram Moolenaar | eee697b | 2006-03-21 21:20:39 +0000 | [diff] [blame] | 3 | " Maintainer: brc007 |
| 4 | " Updated for 1.2 by Tilghman Lesher (Corydon76) |
| 5 | " Last Change: 2006 Mar 20 |
| 6 | " version 0.4 |
Bram Moolenaar | bfd8fc0 | 2005-09-20 23:22:24 +0000 | [diff] [blame] | 7 | " |
Bram Moolenaar | bfd8fc0 | 2005-09-20 23:22:24 +0000 | [diff] [blame] | 8 | if version < 600 |
| 9 | syntax clear |
| 10 | elseif exists("b:current_syntax") |
| 11 | finish |
| 12 | endif |
| 13 | |
Bram Moolenaar | bfd8fc0 | 2005-09-20 23:22:24 +0000 | [diff] [blame] | 14 | syn sync clear |
| 15 | syn sync fromstart |
| 16 | |
Bram Moolenaar | eee697b | 2006-03-21 21:20:39 +0000 | [diff] [blame] | 17 | syn keyword asteriskTodo TODO contained |
| 18 | syn match asteriskComment ";.*" contains=asteriskTodo |
Bram Moolenaar | bfd8fc0 | 2005-09-20 23:22:24 +0000 | [diff] [blame] | 19 | syn match asteriskContext "\[.\{-}\]" |
Bram Moolenaar | eee697b | 2006-03-21 21:20:39 +0000 | [diff] [blame] | 20 | syn match asteriskExten "^\s*exten\s*=>\?\s*[^,]\+" contains=asteriskPattern |
| 21 | syn match asteriskExten "^\s*\(register\|channel\|ignorepat\|include\|\(no\)\?load\)\s*=>\?" |
| 22 | syn match asteriskPattern "_\(\[[[:alnum:]#*\-]\+\]\|[[:alnum:]#*]\)*\.\?" contained |
| 23 | syn match asteriskPattern "[^A-Za-z0-9,]\zs[[:alnum:]#*]\+\ze" contained |
| 24 | syn match asteriskApp ",\zs[a-zA-Z]\+\ze$" |
| 25 | syn match asteriskApp ",\zs[a-zA-Z]\+\ze(" |
Bram Moolenaar | bfd8fc0 | 2005-09-20 23:22:24 +0000 | [diff] [blame] | 26 | " Digits plus oldlabel (newlabel) |
Bram Moolenaar | eee697b | 2006-03-21 21:20:39 +0000 | [diff] [blame] | 27 | syn match asteriskPriority ",\zs[[:digit:]]\+\(+[[:alpha:]][[:alnum:]_]*\)\?\(([[:alpha:]][[:alnum:]_]*)\)\?\ze," contains=asteriskLabel |
| 28 | " oldlabel plus digits (newlabel) |
| 29 | syn match asteriskPriority ",\zs[[:alpha:]][[:alnum:]_]*+[[:digit:]]\+\(([[:alpha:]][[:alnum:]_]*)\)\?\ze," contains=asteriskLabel |
Bram Moolenaar | bfd8fc0 | 2005-09-20 23:22:24 +0000 | [diff] [blame] | 30 | " s or n plus digits (newlabel) |
Bram Moolenaar | eee697b | 2006-03-21 21:20:39 +0000 | [diff] [blame] | 31 | syn match asteriskPriority ",\zs[sn]\(+[[:digit:]]\+\)\?\(([[:alpha:]][[:alnum:]_]*)\)\?\ze," contains=asteriskLabel |
| 32 | syn match asteriskLabel "(\zs[[:alpha:]][[:alnum:]]*\ze)" contained |
| 33 | syn match asteriskError "^\s*#\s*[[:alnum:]]*" |
| 34 | syn match asteriskInclude "^\s*#\s*\(include\|exec\)\s.*" |
| 35 | syn match asteriskVar "\${_\{0,2}[[:alpha:]][[:alnum:]_]*\(:-\?[[:digit:]]\+\(:[[:digit:]]\+\)\?\)\?}" |
| 36 | syn match asteriskVar "_\{0,2}[[:alpha:]][[:alnum:]_]*\ze=" |
| 37 | syn match asteriskVarLen "\${_\{0,2}[[:alpha:]][[:alnum:]_]*(.*)}" contains=asteriskVar,asteriskVarLen,asteriskExp |
| 38 | syn match asteriskVarLen "(\zs[[:alpha:]][[:alnum:]_]*(.\{-})\ze=" contains=asteriskVar,asteriskVarLen,asteriskExp |
Bram Moolenaar | bfd8fc0 | 2005-09-20 23:22:24 +0000 | [diff] [blame] | 39 | syn match asteriskExp "\$\[.\{-}\]" contains=asteriskVar,asteriskVarLen,asteriskExp |
Bram Moolenaar | eee697b | 2006-03-21 21:20:39 +0000 | [diff] [blame] | 40 | syn match asteriskCodecsPermit "^\s*\(allow\|disallow\)\s*=\s*.*$" contains=asteriskCodecs |
| 41 | syn match asteriskCodecs "\(g723\|gsm\|ulaw\|alaw\|g726\|adpcm\|slin\|lpc10\|g729\|speex\|ilbc\|all\s*$\)" |
| 42 | syn match asteriskError "^\(type\|auth\|permit\|deny\|bindaddr\|host\)\s*=.*$" |
| 43 | syn match asteriskType "^\zstype=\ze\<\(peer\|user\|friend\)\>$" contains=asteriskTypeType |
| 44 | syn match asteriskTypeType "\<\(peer\|user\|friend\)\>" contained |
| 45 | syn match asteriskAuth "^\zsauth\s*=\ze\s*\<\(md5\|rsa\|plaintext\)\>$" contains=asteriskAuthType |
| 46 | syn match asteriskAuthType "\<\(md5\|rsa\|plaintext\)\>" |
| 47 | syn match asteriskAuth "^\zs\(secret\|inkeys\|outkey\)\s*=\ze.*$" |
| 48 | syn match asteriskAuth "^\(permit\|deny\)\s*=\s*\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}/\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}\s*$" contains=asteriskIPRange |
| 49 | syn match asteriskIPRange "\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}/\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}" contained |
| 50 | syn match asteriskIP "\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}" contained |
| 51 | syn match asteriskHostname "[[:alnum:]][[:alnum:]\-\.]*\.[[:alpha:]]{2,10}" contained |
| 52 | syn match asteriskPort "\d\{1,5}" contained |
| 53 | syn match asteriskSetting "^bindaddr\s*=\s*\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}$" contains=asteriskIP |
| 54 | syn match asteriskSetting "^port\s*=\s*\d\{1,5}\s*$" contains=asteriskPort |
| 55 | syn match asteriskSetting "^host\s*=\s*\(dynamic\|\(\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}\)\|\([[:alnum:]][[:alnum:]\-\.]*\.[[:alpha:]]{2,10}\)\)" contains=asteriskIP,asteriskHostname |
Bram Moolenaar | bfd8fc0 | 2005-09-20 23:22:24 +0000 | [diff] [blame] | 56 | |
| 57 | " Define the default highlighting. |
| 58 | " For version 5.7 and earlier: only when not done already |
| 59 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
Bram Moolenaar | eee697b | 2006-03-21 21:20:39 +0000 | [diff] [blame] | 60 | if version >= 508 || !exists("did_conf_syntax_inits") |
Bram Moolenaar | bfd8fc0 | 2005-09-20 23:22:24 +0000 | [diff] [blame] | 61 | if version < 508 |
| 62 | let did_conf_syntax_inits = 1 |
| 63 | command -nargs=+ HiLink hi link <args> |
| 64 | else |
| 65 | command -nargs=+ HiLink hi def link <args> |
| 66 | endif |
| 67 | |
Bram Moolenaar | eee697b | 2006-03-21 21:20:39 +0000 | [diff] [blame] | 68 | HiLink asteriskComment Comment |
| 69 | HiLink asteriskExten String |
| 70 | HiLink asteriskContext Preproc |
| 71 | HiLink asteriskPattern Type |
| 72 | HiLink asteriskApp Statement |
| 73 | HiLink asteriskInclude Preproc |
| 74 | HiLink asteriskIncludeBad Error |
| 75 | HiLink asteriskPriority Preproc |
| 76 | HiLink asteriskLabel Type |
Bram Moolenaar | bfd8fc0 | 2005-09-20 23:22:24 +0000 | [diff] [blame] | 77 | HiLink asteriskVar String |
| 78 | HiLink asteriskVarLen Function |
| 79 | HiLink asteriskExp Type |
Bram Moolenaar | eee697b | 2006-03-21 21:20:39 +0000 | [diff] [blame] | 80 | HiLink asteriskCodecsPermit Preproc |
| 81 | HiLink asteriskCodecs String |
| 82 | HiLink asteriskType Statement |
| 83 | HiLink asteriskTypeType Type |
| 84 | HiLink asteriskAuth String |
| 85 | HiLink asteriskAuthType Type |
| 86 | HiLink asteriskIPRange Identifier |
| 87 | HiLink asteriskIP Identifier |
| 88 | HiLink asteriskPort Identifier |
| 89 | HiLink asteriskHostname Identifier |
| 90 | HiLink asteriskSetting Statement |
| 91 | HiLink asteriskError Error |
Bram Moolenaar | bfd8fc0 | 2005-09-20 23:22:24 +0000 | [diff] [blame] | 92 | delcommand HiLink |
| 93 | endif |
Bram Moolenaar | bfd8fc0 | 2005-09-20 23:22:24 +0000 | [diff] [blame] | 94 | let b:current_syntax = "asterisk" |
Bram Moolenaar | bfd8fc0 | 2005-09-20 23:22:24 +0000 | [diff] [blame] | 95 | " vim: ts=8 sw=2 |
Bram Moolenaar | eee697b | 2006-03-21 21:20:39 +0000 | [diff] [blame] | 96 | |