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