]> git.pld-linux.org Git - packages/vim-syntax-vcl.git/blame - vcl.vim
- add options so much i could find from manual and default vcl
[packages/vim-syntax-vcl.git] / vcl.vim
CommitLineData
3964de95
ER
1" Vim syntax file
2" Filename: vcl.vim
180ee5d7 3" Language: Varnish configuation Language, http://varnish-cache.org/wiki/VCL
3964de95
ER
4" Maintainer: Elan Ruusamäe <glen@delfi.ee>
5" Version Info: $Revision$
6" Last Change: $Date$ UTC
7
8" For version 5.x: Clear all syntax items
9" For version 6.x: Quit when a syntax file was already loaded
10if version < 600
11 syntax clear
12elseif exists("b:current_syntax")
13 finish
14endif
15
180ee5d7
ER
16" TODO
17" - sub ...
18" - backend/director/...
19" - acl ...
20" - error when invalid operator used in if (...)
21" - +=, = operators
22" - functions
3964de95
ER
23
24" Code Blocks
25" sub NAME {
26" backend NAME {
27" director NAME FLAGS {
28" acl NAME {
868a0fb9
ER
29"syn region vclCodeBlock start="\s*\<sub\|backend\|director\|acl\>" end="{"he=e-1 contains=vclCodeBlockName,vclFunctionName
30"syn match vclCodeBlockName "\<sub\|backend\|director\|acl\>" contained
3964de95 31"syn match vclFunctionName "\h[[:alnum:]_:]*" contained
868a0fb9
ER
32"syn match vclFunctionName "\h\w*[^:]" contained
33"
180ee5d7
ER
34syn keyword vclOperator set call return error esi synthetic include
35" return modes
36syn keyword vclModes deliver pipe pass hash lookup discard fetch
868a0fb9
ER
37
38" C strings
39syn region vclString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=vclSpecial
40syn match vclSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)"
41syn match vclSpecialError "L\='\\[^'\"?\\abfnrtv]'"
42syn match vclSpecialCharacter "L\='\\['\"?\\abfnrtv]'"
43syn match vclSpecialCharacter display "L\='\\\o\{1,3}'"
44syn match vclSpecialCharacter display "'\\x\x\{1,2}'"
45syn match vclSpecialCharacter display "L'\\x\x\+'"
46
180ee5d7
ER
47syn keyword vclConditional if else elseif
48
49" Numbers
50syn match vclNumbers display transparent "\<\d\|\.\d" contains=vclNumber,vclNumberTime
51syn match vclNumber display contained "\d\+"
52" set obj.ttl = 0s, 0m;
53syn match vclNumberTime display contained "\d\+[dhsm]"
54
55" client
56syn match vclOption /client\.ip/
57" server
58syn match vclOption /server\.\(ip\|port\)/
59" req
60syn match vclOption /req\.\(hash\|request\|url\|proto\|backend\|backend\.healthy\|grace\|xid\)/
61" bereq.
62syn match vclOption /bereq\.\(request\|url\|proto\|connect_timeout\|first_byte_timeout\|between_bytes_timeout\)/
63" obj
64syn match vclOption /obj\.\(proto\|status\|response\|cacheable\|ttl\|lastuse\|hits\|hash\|grace\|prefetch\)/
65" resp
66syn match vclOption /resp\.\(proto\|status\|response\)/
67" common: http.HEADERNAME
68syn match vclOption /\(req\|bereq\|resp\|obj\)\.http\.[A-Za-z][-_A-Za-z0-9]*/
3964de95
ER
69
70" Highlight the C block
71syn include @vclC syntax/c.vim
72unlet b:current_syntax
868a0fb9 73
3964de95
ER
74" Mark block tags itself as comment
75syn region vclCBlock matchgroup=vclComment start=/C{/ end=/}C/ contains=@vclC keepend
76
868a0fb9 77" Synthetic
0ad3ea52
ER
78syn region vclSynthetic start=/{"/hs=s+2 end=/"}/he=e-2 contains=@vclHTML keepend
79
80" Allow html in synthetic
81syn include @vclHTML syntax/html.vim
82unlet b:current_syntax
868a0fb9 83
180ee5d7
ER
84syn match vclComment '#.*'
85syn match vclComment "//.*"
86syn region vclComment start="/\*" end="\*/"
87
88syn sync ccomment vclComment
89
90hi link vclCodeBlock Function
91hi link vclComment Comment
92hi link vclStatement Statement
93hi link vclFunctionName Identifier
94hi link vclCodeBlockName Statement
868a0fb9
ER
95hi link vclSpecial SpecialChar
96hi link vclString String
180ee5d7
ER
97hi link vclConditional Conditional
98hi link vclSynthetic vclString
99hi link vclSpecialCharacter vclSpecialSpecial
100hi link vclOperator Operator
101hi link vclModes Operator
102hi link vclOption Identifier
103hi link vclNumber Number
104hi link vclNumberTime Number
This page took 0.104864 seconds and 4 git commands to generate.