blob: c4e2b15f42afc8256957cdac9da58d3c3046f57d [file] [log] [blame]
Bram Moolenaarbfd8fc02005-09-20 23:22:24 +00001" 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
16if version < 600
17 syntax clear
18elseif exists("b:current_syntax")
19 finish
20endif
21
22"testing only
23syn sync clear
24syn sync fromstart
25
26
27syn keyword asteriskTodo TODO contained
28syn match asteriskComment ";.*" contains=asteriskTodo
29syn match asteriskContext "\[.\{-}\]"
30syn match asteriskExten "^\s*exten\s*=>"
31syn match asteriskApp "\s*,\s*\zs[a-zA-Z]*\ze"
32" Digits plus oldlabel (newlabel)
33syn match asteriskPriority ",[[:digit:]]\+\(+[[:alpha:]][[:alnum:]_]*\)\?\(([[:alpha:]][[:alnum:]_]*)\)\?,"
34" s or n plus digits (newlabel)
35syn match asteriskPriority ",[sn]\(+[[:digit:]]\+\)\?\(([[:alpha:]][[:alnum:]_]*)\)\?,"
36syn match asteriskIncludeBad "^\s*#\s*[[:alnum:]]*"
37syn match asteriskInclude "^\s#\sinclude\s.*"
38syn match asteriskVar "\${_\{0,2}[[:alpha:]][[:alnum:]_]*\(:[[:digit:]]\+\)\{0,2}}"
39syn match asteriskVarLen "\${_\{0,2}[[:alpha:]][[:alnum:]_]*(.\{-})}" contains=asteriskVar,asteriskVarLen,asteriskExp
40syn match asteriskExp "\$\[.\{-}\]" contains=asteriskVar,asteriskVarLen,asteriskExp
41syn 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
68endif
69
70
71let b:current_syntax = "asterisk"
72
73" vim: ts=8 sw=2