]>
Commit | Line | Data |
---|---|---|
3964de95 ER |
1 | " Vim syntax file |
2 | " Filename: vcl.vim | |
3 | " Language: Varnish configuation Language, http://www.varnish-cache.org/ | |
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 | |
10 | if version < 600 | |
11 | syntax clear | |
12 | elseif exists("b:current_syntax") | |
13 | finish | |
14 | endif | |
15 | ||
16 | syn match vclComment '#.*' | |
17 | ||
18 | " Code Blocks | |
19 | " sub NAME { | |
20 | " backend NAME { | |
21 | " director NAME FLAGS { | |
22 | " acl NAME { | |
868a0fb9 ER |
23 | "syn region vclCodeBlock start="\s*\<sub\|backend\|director\|acl\>" end="{"he=e-1 contains=vclCodeBlockName,vclFunctionName |
24 | "syn match vclCodeBlockName "\<sub\|backend\|director\|acl\>" contained | |
3964de95 | 25 | "syn match vclFunctionName "\h[[:alnum:]_:]*" contained |
868a0fb9 ER |
26 | "syn match vclFunctionName "\h\w*[^:]" contained |
27 | " | |
28 | syn keyword vclOperator set call return synthetic deliver include | |
29 | ||
30 | " C strings | |
31 | syn region vclString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=vclSpecial | |
32 | syn match vclSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)" | |
33 | syn match vclSpecialError "L\='\\[^'\"?\\abfnrtv]'" | |
34 | syn match vclSpecialCharacter "L\='\\['\"?\\abfnrtv]'" | |
35 | syn match vclSpecialCharacter display "L\='\\\o\{1,3}'" | |
36 | syn match vclSpecialCharacter display "'\\x\x\{1,2}'" | |
37 | syn match vclSpecialCharacter display "L'\\x\x\+'" | |
38 | ||
3964de95 ER |
39 | |
40 | " Highlight the C block | |
41 | syn include @vclC syntax/c.vim | |
42 | unlet b:current_syntax | |
868a0fb9 | 43 | |
3964de95 ER |
44 | " Mark block tags itself as comment |
45 | syn region vclCBlock matchgroup=vclComment start=/C{/ end=/}C/ contains=@vclC keepend | |
46 | ||
868a0fb9 ER |
47 | " Synthetic |
48 | syn region vclSynthetic start=/{"/hs=s+2 end=/"}/he=e-2 | |
49 | ||
3964de95 ER |
50 | hi link vclCodeBlock Function |
51 | hi link vclComment Comment | |
52 | hi link vclStatement Statement | |
53 | hi link vclFunctionName Identifier | |
54 | hi link vclCodeBlockName Statement | |
868a0fb9 ER |
55 | hi link vclSpecial SpecialChar |
56 | hi link vclString String | |
57 | hi link vclSynthetic vclString | |
58 | hi link vclSpecialCharacter vclSpecialSpecial | |
59 | hi link vclOperator Operator | |
60 |