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