Debian Codegraph @

data/syntax/varnishtest.xml

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE language [
3 <!ENTITY tab "&#9;">
4 ]>
5 <language name="Varnish Test Case language" version="14" kateversion="5.79" section="Configuration" extensions="*.vtc" author="Xavier Guerrin ([email protected])" license="WTFPL" priority="9">
6 <highlighting>
7 <list name="VSLGrouping">
8 <!-- Extracted from lib/libvarnishapi/vsl_arg.c -->
9 <item>raw</item>
10 <item>vxid</item>
11 <item>request</item>
12 <item>session</item>
13 </list>
14 <list name="VSLTags">
15 <!--
16 Extracted using:
17 perl -nlE 'push(@tags, $1) if m#^([^ ]+) - #; END { map { printf(" <item>%s</item>\n", $_); } @tags; }' lib/libvarnishapi/vsl-tags.rst
18 -->
19 <item>Backend</item>
20 <item>BackendClose</item>
21 <item>BackendOpen</item>
22 <item>BackendReuse</item>
23 <item>Backend_health</item>
24 <item>Begin</item>
25 <item>BereqAcct</item>
26 <item>BereqHeader</item>
27 <item>BereqMethod</item>
28 <item>BereqProtocol</item>
29 <item>BereqURL</item>
30 <item>BerespHeader</item>
31 <item>BerespProtocol</item>
32 <item>BerespReason</item>
33 <item>BerespStatus</item>
34 <item>BogoHeader</item>
35 <item>CLI</item>
36 <item>Debug</item>
37 <item>ESI_BodyBytes</item>
38 <item>ESI_xmlerror</item>
39 <item>End</item>
40 <item>Error</item>
41 <item>ExpBan</item>
42 <item>ExpKill</item>
43 <item>FetchError</item>
44 <item>Fetch_Body</item>
45 <item>Gzip</item>
46 <item>Hash</item>
47 <item>Hit</item>
48 <item>HitPass</item>
49 <item>HttpGarbage</item>
50 <item>Length</item>
51 <item>Link</item>
52 <item>LostHeader</item>
53 <item>ObjHeader</item>
54 <item>ObjProtocol</item>
55 <item>ObjReason</item>
56 <item>ObjStatus</item>
57 <item>PipeAcct</item>
58 <item>ReqAcct</item>
59 <item>ReqHeader</item>
60 <item>ReqMethod</item>
61 <item>ReqProtocol</item>
62 <item>ReqStart</item>
63 <item>ReqURL</item>
64 <item>RespHeader</item>
65 <item>RespProtocol</item>
66 <item>RespReason</item>
67 <item>RespStatus</item>
68 <item>SessClose</item>
69 <item>SessOpen</item>
70 <item>Storage</item>
71 <item>TTL</item>
72 <item>Timestamp</item>
73 <item>VCL_Error</item>
74 <item>VCL_Log</item>
75 <item>VCL_acl</item>
76 <item>VCL_call</item>
77 <item>VCL_return</item>
78 <item>VCL_trace</item>
79 <item>VSL</item>
80 <item>WorkThread</item>
81 </list>
82 <contexts>
83 <!-- default context: define main keywords -->
84 <context name="vtcnormal_text" attribute="Normal Text" lineEndContext="#stay">
85 <IncludeRules context="global_directives_restricted" />
86 <IncludeRules context="global_directives" />
87 </context>
88
89 <!-- directives that can be encountered at global scope but not within a loop -->
90 <context name="global_directives_restricted" attribute="Normal Text" lineEndContext="#stay">
91 <StringDetect firstNonSpace="true" attribute="Keyword" context="varnishtest_declaration" String="varnishtest" />
92 <StringDetect firstNonSpace="true" attribute="Keyword" context="feature_instruction" String="feature" />
93 <RegExpr attribute="Keyword" context="#stay" String="^\s*random\s*$" column="0" />
94 </context>
95
96 <!-- directives that can be encountered at global scope, either directly or within a loop -->
97 <context name="global_directives" attribute="Normal Text" lineEndContext="#stay">
98 <IncludeRules context="comments" />
99 <StringDetect firstNonSpace="true" attribute="Keyword" context="client_declaration" String="client" />
100 <StringDetect firstNonSpace="true" attribute="Keyword" context="server_declaration" String="server" />
101 <StringDetect firstNonSpace="true" attribute="Keyword" context="varnish_declaration" String="varnish" />
102 <StringDetect firstNonSpace="true" attribute="Keyword" context="logexpect_declaration" String="logexpect" />
103 <StringDetect firstNonSpace="true" attribute="Keyword" context="sema_instruction" String="sema" />
104 <StringDetect firstNonSpace="true" attribute="Keyword" context="shell_instruction" String="shell" />
105 <StringDetect firstNonSpace="true" attribute="Keyword" context="delay_instruction" String="delay" />
106 <StringDetect firstNonSpace="true" attribute="Keyword" context="global_loop_instruction" String="loop" />
107 </context>
108
109 <!-- Strings delimited with double quotes -->
110 <context name="strings" attribute="Normal Text" lineEndContext="#stay">
111 <DetectChar char="&quot;" context="string" attribute="String" />
112 </context>
113 <context name="string" attribute="String" lineEndContext="#pop">
114 <Detect2Chars attribute="String" context="#stay" char="\" char1="&quot;" />
115 <DetectChar attribute="String" context="#pop" char="&quot;" />
116 </context>
117
118 <!-- The following contexts (quoted-, brace- and unquoted- strings) make their parent pop as soon as they parsed a string. -->
119 <context name="quoted-strings" attribute="Normal Text" lineEndContext="#stay">
120 <DetectChar char="&quot;" context="quoted-string" attribute="String" />
121 </context>
122 <context name="quoted-string" attribute="String" lineEndContext="#pop#pop">
123 <Detect2Chars attribute="String" context="#stay" char="\" char1="&quot;" />
124 <DetectChar attribute="String" context="#pop#pop" char="&quot;" />
125 </context>
126
127 <context name="brace-strings" attribute="Normal Text" lineEndContext="#pop">
128 <DetectChar attribute="String" context="brace-string" char="{" beginRegion="string_block" />
129 </context>
130 <context name="brace-string" attribute="String" lineEndContext="#stay">
131 <!--
132 strings delimited with braces do not require to escape closing braces;
133 therefore, we have to use an extra context to keep track of opening and closing braces
134 -->
135 <DetectChar attribute="String" context="brace-string-internal" char="{" />
136 <DetectChar attribute="String" context="#pop#pop" char="}" endRegion="string_block" />
137 </context>
138 <context name="brace-string-internal" attribute="String" lineEndContext="#stay">
139 <DetectChar attribute="String" context="#pop" char="}" />
140 </context>
141
142 <context name="unquoted-strings" attribute="String" lineEndContext="#pop">
143 <RegExpr attribute="String" context="unquoted-string" String="[^ ]" />
144 </context>
145 <context name="unquoted-string" attribute="String" lineEndContext="#pop#pop">
146 <AnyChar attribute="Normal Text" context="#pop#pop" String="&tab; " />
147 </context>
148
149 <!-- This context exits as soon as it parsed a string, be it defined between braces, quotes or spaces -->
150 <context name="string-arg" attribute="Normal Text" lineEndContext="#stay">
151 <RegExpr attribute="HTTP announce" context="#pop" String="HTTP/[0-9.]+" />
152 <RegExpr attribute="HTTP method" context="#pop" String="\s+(GET|HEAD|POST|PUT|DELETE|TRACE|OPTIONS|CONNECT|PATCH)" />
153 <RegExpr attribute="HTTP WebDAV method" context="#pop" String="\s+(PROPFIND|PROPPATCH|MKCOL|COPY|MOVE|LOCK|UNLOCK|CONNECT|PATCH)" />
154 <RegExpr attribute="HTTP custom method" context="#pop" String="\s+(PURGE|PURGESTR)" />
155 <IncludeRules context="brace-strings" />
156 <IncludeRules context="quoted-strings" />
157 <IncludeRules context="unquoted-strings" />
158 </context>
159
160 <!-- This context exits as soon as it parsed an integer. -->
161 <context name="int-arg" attribute="Normal Text" lineEndContext="#pop">
162 <Int attribute="Decimal" context="#pop" />
163 </context>
164
165 <!-- This context exits as soon as it parsed a status integer. -->
166 <context name="status-arg" attribute="String" lineEndContext="#pop">
167 <!-- HTTP status can be provided within quotes too. -->
168 <RegExpr attribute="Decimal" context="#pop" String="(&quot;[12345][0-9]{2}&quot;|[12345][0-9]{2})(?![0-9])" />
169 </context>
170
171 <!-- Comments -->
172 <context name="shell-like-comment" attribute="Comment" lineEndContext="#pop">
173 <DetectSpaces />
174 <IncludeRules context="##Comments" />
175 <DetectIdentifier />
176 </context>
177 <context name="comments" attribute="Comment" lineEndContext="#pop">
178 <DetectChar char="#" context="shell-like-comment" attribute="Comment" />
179 </context>
180
181 <!-- Define base elements that used within various contexts -->
182 <context name="base_elements" attribute="Normal Text" lineEndContext="#stay">
183 <RegExpr attribute="HTTP announce" context="#stay" String="HTTP/[0-9.]+" />
184 <RegExpr attribute="HTTP method" context="#stay" String="\s+(GET|HEAD|POST|PUT|DELETE|TRACE|OPTIONS|CONNECT|PATCH)" />
185 <RegExpr attribute="HTTP WebDAV method" context="#stay" String="\s+(PROPFIND|PROPPATCH|MKCOL|COPY|MOVE|LOCK|UNLOCK|CONNECT|PATCH)" />
186 <RegExpr attribute="HTTP custom method" context="#stay" String="\s+(PURGE|PURGESTR)" />
187 <Float attribute="Float" context="#stay" />
188 <Int attribute="Decimal" context="#stay" />
189 <IncludeRules context="strings" />
190 <IncludeRules context="comments" />
191 </context>
192
193 <!--
194 Define syntax of the -expect command for server and client objects.
195 Written from cmd_http_expect() in bin/varnishtest/vtc_http.c.
196 -->
197 <context name="http_expectation" attribute="Normal Text" lineEndContext="#pop">
198 <IncludeRules context="comments" />
199 <RegExpr attribute="Float" context="http_expectation_operator" String="[0-9\.]+(\s+|$)" />
200 <RegExpr attribute="Decimal" context="http_expectation_operator" String="[0-9]+(\s+|$)" />
201 <StringDetect attribute="Keyword" context="http_expectation_operator" String="&lt;undef&gt;" />
202 <!-- Written from cmd_var_resolve() in bin/varnishtest/vtc_http.c. -->
203 <RegExpr attribute="HTTP Property" context="http_expectation_operator" String="req\.(method|url|proto|bodylen)|resp\.(proto|status|msg|chunklen|bodylen|body)" />
204 <RegExpr attribute="HTTP X- Header" context="http_expectation_operator" String="(req|resp)\.http\.X\-[\-_A-Za-z0-9]*" />
205 <RegExpr attribute="HTTP Header" context="http_expectation_operator" String="(req|resp)\.http\.[A-Za-z][\-_A-Za-z0-9]*" />
206 <RegExpr attribute="HTTP announce" context="http_expectation_operator" String="HTTP/[0-9\.]+" />
207 <RegExpr attribute="HTTP method" context="http_expectation_operator" String="\s+(GET|HEAD|POST|PUT|DELETE|TRACE|OPTIONS|CONNECT|PATCH)" />
208 <RegExpr attribute="HTTP WebDAV method" context="http_expectation_operator" String="\s+(PROPFIND|PROPPATCH|MKCOL|COPY|MOVE|LOCK|UNLOCK|CONNECT|PATCH)" />
209 <RegExpr attribute="HTTP custom method" context="http_expectation_operator" String="\s+(PURGE|PURGESTR)" />
210 <DetectChar attribute="String" context="http_expectation_arg1_brace-string" char="{" beginRegion="string_block" />
211 <DetectChar attribute="String" context="http_expectation_arg1_quoted-string" char="&quot;" />
212 <RegExpr attribute="Normal Text" context="http_expectation_arg1_unquoted-string" String="[^ ]" lookAhead="true" />
213 </context>
214 <context name="http_expectation_operator" attribute="Normal Text" lineEndContext="#pop#pop">
215 <IncludeRules context="comments" />
216 <Detect2Chars attribute="Comparison Operator" context="common_expectation_second_arg" char="=" char1="=" />
217 <Detect2Chars attribute="Comparison Operator" context="common_expectation_second_arg" char="!" char1="=" />
218 <Detect2Chars attribute="Comparison Operator" context="common_expectation_second_arg" char="&gt;" char1="=" />
219 <Detect2Chars attribute="Comparison Operator" context="common_expectation_second_arg" char="&lt;" char1="=" />
220 <AnyChar attribute="Comparison Operator" context="common_expectation_second_arg" String="&gt;&lt;~" />
221 <Detect2Chars attribute="Comparison Operator" context="common_expectation_second_arg" char="!" char1="~" />
222 </context>
223 <context name="common_expectation_second_arg" attribute="Normal Text" lineEndContext="#pop#pop#pop">
224 <IncludeRules context="comments" />
225 <RegExpr attribute="Float" context="common_expectation_end" String="[0-9\.]+(\s+|$)" />
226 <RegExpr attribute="Decimal" context="common_expectation_end" String="[0-9]+(\s+|$)" />
227 <StringDetect attribute="Keyword" context="common_expectation_end" String="&lt;undef&gt;" />
228 <!-- Written from cmd_var_resolve() in bin/varnishtest/vtc_http.c. -->
229 <RegExpr attribute="HTTP Property" context="common_expectation_end" String="req\.(method|url|proto|bodylen)|resp\.(proto|status|msg|chunklen|bodylen|body)" />
230 <RegExpr attribute="HTTP X- Header" context="common_expectation_end" String="(req|resp)\.http\.X\-[\-_A-Za-z0-9]*" />
231 <RegExpr attribute="HTTP Header" context="common_expectation_end" String="(req|resp)\.http\.[A-Za-z][\-_A-Za-z0-9]*" />
232 <RegExpr attribute="HTTP announce" context="common_expectation_end" String="HTTP/[0-9\.]+" />
233 <RegExpr attribute="HTTP method" context="common_expectation_end" String="\s+(GET|HEAD|POST|PUT|DELETE|TRACE|OPTIONS|CONNECT|PATCH)" />
234 <RegExpr attribute="HTTP WebDAV method" context="common_expectation_end" String="\s+(PROPFIND|PROPPATCH|MKCOL|COPY|MOVE|LOCK|UNLOCK|CONNECT|PATCH)" />
235 <RegExpr attribute="HTTP custom method" context="common_expectation_end" String="\s+(PURGE|PURGESTR)" />
236 <DetectChar attribute="String" context="common_expectation_arg2_brace-string" char="{" beginRegion="string_block" />
237 <DetectChar attribute="String" context="common_expectation_arg2_quoted-string" char="&quot;" />
238 <RegExpr attribute="Normal Text" context="common_expectation_arg2_unquoted-string" String="[^ ]" lookAhead="true" />
239 </context>
240 <context name="common_expectation_end" attribute="Normal Text" lineEndContext="#pop#pop#pop#pop">
241 <IncludeRules context="comments" />
242 </context>
243
244 <!-- Contexts to parse first argument of server/client expectations as a string -->
245 <context name="http_expectation_arg1_brace-string" attribute="String" lineEndContext="#stay">
246 <DetectChar attribute="String" context="brace-string-internal" char="{" />
247 <DetectChar attribute="String" context="http_expectation_operator" char="}" endRegion="string_block" />
248 </context>
249 <context name="http_expectation_arg1_quoted-string" attribute="String" lineEndContext="#pop#pop">
250 <Detect2Chars attribute="String" context="#stay" char="\" char1="&quot;" />
251 <DetectChar attribute="String" context="http_expectation_operator" char="&quot;" />
252 </context>
253 <context name="http_expectation_arg1_unquoted-string" attribute="String" lineEndContext="#pop#pop">
254 <AnyChar attribute="Normal Text" context="http_expectation_operator" String="&tab; " />
255 </context>
256
257 <!-- Contexts to parse second argument of all expectations as a string -->
258 <context name="common_expectation_arg2_brace-string" attribute="String" lineEndContext="#stay">
259 <DetectChar attribute="String" context="brace-string-internal" char="{" />
260 <DetectChar attribute="String" context="common_expectation_end" char="}" endRegion="string_block" />
261 </context>
262 <context name="common_expectation_arg2_quoted-string" attribute="String" lineEndContext="#pop#pop">
263 <Detect2Chars attribute="String" context="#stay" char="\" char1="&quot;" />
264 <DetectChar attribute="String" context="common_expectation_end" char="&quot;" />
265 </context>
266 <context name="common_expectation_arg2_unquoted-string" attribute="String" lineEndContext="#pop#pop">
267 <AnyChar attribute="Normal Text" context="common_expectation_end" String="&tab; " />
268 </context>
269
270 <!--
271 Define syntax of the -expect command for varnish objects.
272 Written from varnish_expect() in bin/varnishtest/vtc_varnish.c
273 -->
274 <context name="varnish_expectation" attribute="Normal Text" lineEndContext="#pop">
275 <!-- Varnish's expect takes a Varnish counter as first argument. -->
276 <IncludeRules context="comments" />
277 <!-- Mostly extracted using man 7 varnish-counters | grep - - - | grep _ | sort -->
278 <!-- MEMPOOL.* found out in c00050.vtc -->
279 <RegExpr attribute="VarnishStat metric" context="varnish_expectation_operator" String="backend_(?:busy|conn|fail|recycle|req|retry|reuse|toolate|unhealthy)|bans_(?:added|completed|deleted|dups|lurker_(?:contention|obj_killed|tested|tests_tested)|obj|obj_killed|persisted_(bytes|fragmentation)|req|tested|tests_tested)|busy_(?:sleep|wakeup)|cache_(?:hit(pass)?|miss)|client_(?:req|req_4(?:00|11|13|17))|esi_(?:errors|warnings)|exp_(?:mailed|received)|fetch_(?:1xx|204|304|bad|chunked|close|eof|failed|head|length|oldhttp|zero)|hcb_(?:insert|lock|nolock)|n_(?:backend|expired|gunzip|gzip|lru_moved|lru_nuked|obj_purged|object|objectcore|objecthead|purges|vampireobject|vcl|vcl_avail|vcl_discard|waitinglist)|s_(?:fetch|pass|pipe|pipe_(?:hdrbytes|in|out)|req|(req|resp)_(?:body|hdr)bytes|sess|synth)|sess_(?:closed|conn|drop|dropped|fail|herd|pipe_overflow|pipeline|queued|readahead)|shm_(?:cont|cycles|flushes|records|writes)|sms_(?:balloc|bfree|nbytes|nobj|nreq)|thread_(?:queue_len|created|destroyed|failed|limited)|vsm_(?:cooling|free|overflow(ed)?|user)|(?:bans|losthdr|pools|threads|uptime|vmods)|LCK\.(?:sm[spaf]|hsl|hcb|hcl|vcl|stat|sessmem|wstat|herder|wq|objhdr|exp|lru|cli|ban|vbp|vbe|backend)\.(?:creat|destroy|locks)|SMA\.[a-zA-Z0-9_\-]+\.(?:c_(?:req|fail|bytes|freed)|g_(?:alloc|bytes|space))|SMF\.[a-zA-Z0-9_\-]+\.(?:c_(?:req|fail|bytes|freed)|g_(?:alloc|bytes|space|smf|smf_frag|smf_large))|VBE\..+\.(?:happy|vcls|be(?:req|resp)_(?:body|hdr)bytes|pipe_(?:in|hdrbytes|out))|MEMPOOL\.vbc\.(?:pool|surplus|timeout)" />
280 </context>
281 <context name="varnish_expectation_operator" attribute="Normal Text" lineEndContext="#pop#pop">
282 <IncludeRules context="comments" />
283 <Detect2Chars attribute="Comparison Operator" context="varnish_expectation_second_arg" char="=" char1="=" />
284 <Detect2Chars attribute="Comparison Operator" context="varnish_expectation_second_arg" char="!" char1="=" />
285 <Detect2Chars attribute="Comparison Operator" context="varnish_expectation_second_arg" char="&gt;" char1="=" />
286 <Detect2Chars attribute="Comparison Operator" context="varnish_expectation_second_arg" char="&lt;" char1="=" />
287 <AnyChar attribute="Comparison Operator" context="varnish_expectation_second_arg" String="&gt;&lt;" />
288 <!-- Varnish's expect does not handle the ~ and !~ operators -->
289 </context>
290 <context name="varnish_expectation_second_arg" attribute="Normal Text" lineEndContext="#pop">
291 <!-- Varnish's expect takes an unsigned integer as second argument. -->
292 <Int attribute="Decimal" context="common_expectation_end" />
293 </context>
294
295 <!-- Define macros -->
296 <context name="macro_accepted" attribute="String" lineEndContext="#pop">
297 <Detect2Chars char="$" char1="{" attribute="String" context="macro_identifier" />
298 </context>
299 <context name="macro_identifier" attribute="String" lineEndContext="#pop#pop">
300 <DetectChar char="}" attribute="String" context="#pop" />
301 </context>
302
303 <!-- Define syntax for main keywords' options -->
304 <context name="common_options" attribute="Normal Text" lineEndContext="#stay">
305 <IncludeRules context="macro_accepted" />
306 <IncludeRules context="base_elements" />
307 </context>
308
309 <context name="client_options" attribute="Normal Text" lineEndContext="#stay">
310 <!-- Extracted from bin/varnishtest/vtc_client.c -->
311 <RegExpr attribute="Keyword" context="#stay" String="\-(?:run|start|wait)" />
312 <StringDetect attribute="Keyword" context="int-arg" String="-repeat" />
313 <StringDetect attribute="Keyword" context="string-arg" String="-connect" />
314 <StringDetect attribute="Keyword" context="http_expectation" String="-expect" />
315 <IncludeRules context="common_options" />
316 </context>
317
318 <context name="server_options" attribute="Normal Text" lineEndContext="#stay" >
319 <!-- Extracted from bin/varnishtest/vtc_server.c -->
320 <RegExpr attribute="Keyword" context="#stay" String="\-(?:break|start|wait)" />
321 <StringDetect attribute="Keyword" context="int-arg" String="-repeat" />
322 <StringDetect attribute="Keyword" context="string-arg" String="-listen " />
323 <StringDetect attribute="Keyword" context="http_expectation" String="-expect" />
324 <IncludeRules context="common_options" />
325 </context>
326
327 <context name="varnish_options" attribute="Normal Text" lineEndContext="#stay" >
328 <!-- Extracted from bin/varnishtest/vtc_varnish.c -->
329 <RegExpr attribute="Keyword" context="#stay" String="\-(?:start|stop|wait|wait-running|wait-stopped)" />
330 <RegExpr attribute="Keyword" context="string-arg" String="\-(?:arg|cli|cliok|storage) " />
331 <StringDetect attribute="Keyword" context="clierr_options" String="-clierr " />
332 <StringDetect attribute="Keyword" context="varnish_expectation" String="-expect" />
333 <IncludeRules context="common_options" />
334 </context>
335
336 <context name="logexpect_options" attribute="Normal Text" lineEndContext="#stay" >
337 <!-- Extracted from bin/varnishtest/vtc_logexp.c -->
338 <RegExpr attribute="Keyword" context="#stay" String="\-(?:start|run|wait)" />
339 </context>
340
341 <context name="clierr_options" attribute="Normal Text" lineEndContext="#pop">
342 <!-- unlike clikok, clierr requires an integer argument first -->
343 <Int attribute="Decimal" context="clierr_command" />
344 <!-- It seems that integer can be provided within quotes though. -->
345 <RegExpr attribute="Decimal" context="clierr_command" String="&quot;[0-9]+&quot; " />
346 <IncludeRules context="comments" />
347 </context>
348 <context name="clierr_command" attribute="String" lineEndContext="#pop">
349 <IncludeRules context="comments" />
350 </context>
351
352 <context name="tx_options" attribute="Normal Text" lineEndContext="#pop">
353 <IncludeRules context="comments" />
354 <StringDetect attribute="Tx Keyword" String="-nolen" />
355 <RegExpr attribute="Tx Keyword" context="string-arg" String="\-(?:body|gzipbody|hdr|proto) " />
356 <RegExpr attribute="Tx Keyword" context="int-arg" String="\-(?:bodylen|gzip(?:len|residual|level))" />
357 <LineContinue attribute="Normal Text" context="#stay" />
358 </context>
359
360 <!-- Define syntax for the client-specific txreq keyword -->
361 <context name="txreq_options" attribute="String" lineEndContext="#pop">
362 <IncludeRules context="tx_options" />
363 <RegExpr attribute="TxReq Keyword" context="string-arg" String="\-(?:req|url)" />
364 </context>
365
366 <!-- Define syntax for the server-specific txresp keyword -->
367 <context name="txresp_options" attribute="Normal Text" lineEndContext="#pop">
368 <IncludeRules context="tx_options" />
369 <StringDetect attribute="TxResp Keyword" context="string-arg" String="-msg" />
370 <StringDetect attribute="TxResp Keyword" context="status-arg" String="-status" />
371 </context>
372
373 <!-- Define syntax for the client-specific rxresp keyword -->
374 <context name="rxresp_options" attribute="Normal Text" lineEndContext="#pop">
375 <IncludeRules context="comments" />
376 <StringDetect attribute="RxResp Keyword" String="-no_obj" />
377 <LineContinue attribute="Normal Text" context="#stay" />
378 </context>
379
380 <!-- varnishtest keyword -->
381 <context name="varnishtest_declaration" attribute="Normal Text" lineEndContext="#pop">
382 <IncludeRules context="strings" />
383 <IncludeRules context="comments" />
384 </context>
385
386 <!-- client/server HTTP commands -->
387 <context name="clientserver_common_definition" attribute="Normal Text" lineEndContext="#stay">
388 <IncludeRules context="comments" />
389 <!-- Extracted using:
390 perl -nlE '$p = 1 if m#http_cmds\[\]#; say if ($p); exit if ($p && m#^\}#);' vtc_http.c
391 egrep '(^cmd_http_|^\s*ONLY_(CLIENT|SERVER))' bin/varnishtest/vtc_http.c
392 -->
393 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="timeout_instruction" String="timeout" />
394 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay" String="gunzip" />
395 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay" String="expect_close" />
396 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="http_expectation" String="expect" />
397 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="send_instruction" String="sendhex" />
398 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="send_instruction" String="send" />
399 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="chunkedlen_instruction" String="chunkedlen" />
400 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="send_instruction" String="chunked" />
401 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="delay_instruction" String="delay" />
402 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="sema_instruction" String="sema" />
403 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay" String="close" />
404 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay" String="accept" />
405 <!-- loop is not there as its parsing changes depending on server or client. -->
406 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay" String="fatal" />
407 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay" String="non-fatal" />
408 </context>
409
410 <!-- client keyword -->
411 <context name="client_declaration" attribute="Normal Text" lineEndContext="#pop">
412 <DetectIdentifier attribute="Client Identifier" context="client_identified" />
413 </context>
414 <context name="client_identified" attribute="String" lineEndContext="#pop">
415 <IncludeRules context="client_options" />
416 <DetectChar attribute="Region Marker" context="client_definition" char="{" beginRegion="client_block" />
417 <LineContinue attribute="Normal Text" context="#stay" />
418 </context>
419 <context name="client_definition" attribute="Normal Text" lineEndContext="#stay">
420 <IncludeRules context="clientserver_common_definition" />
421 <!-- client-specific HTTP commands -->
422 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="txreq_options" String="txreq" />
423 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay" String="rxresphdrs" />
424 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="rxresp_options" String="rxresp" />
425 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay" String="rxchunk" />
426 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="client_loop_instruction" String="loop" />
427 <DetectChar attribute="Region Marker" context="client_postdefinition" char="}" endRegion="client_block" />
428 </context>
429 <context name="client_postdefinition" attribute="Normal Text" lineEndContext="#pop#pop#pop#pop">
430 <IncludeRules context="client_options" />
431 <LineContinue attribute="Normal Text" context="#stay" />
432 </context>
433
434 <!-- server keyword -->
435 <context name="server_declaration" attribute="Normal Text" lineEndContext="#pop">
436 <DetectIdentifier attribute="Server Identifier" context="server_identified" />
437 </context>
438 <context name="server_identified" attribute="String" lineEndContext="#pop">
439 <IncludeRules context="server_options" />
440 <DetectChar attribute="Region Marker" context="server_definition" char="{" beginRegion="server_block" />
441 <LineContinue attribute="Normal Text" context="#stay" />
442 </context>
443 <context name="server_definition" attribute="Normal Text" lineEndContext="#stay">
444 <IncludeRules context="clientserver_common_definition" />
445 <!-- server-specific HTTP commands -->
446 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay" String="rxreqhdrs" />
447 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay" String="rxreq" />
448 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay" String="rxbody" />
449 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="txresp_options" String="txresp" />
450 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="server_loop_instruction" String="loop" />
451 <DetectChar attribute="Region Marker" context="server_postdefinition" char="}" endRegion="server_block" />
452 </context>
453 <context name="server_postdefinition" attribute="Normal Text" lineEndContext="#pop#pop#pop#pop">
454 <IncludeRules context="server_options" />
455 <LineContinue attribute="Normal Text" context="#stay" />
456 </context>
457
458 <!-- varnish keyword -->
459 <context name="varnish_declaration" attribute="Normal Text" lineEndContext="#pop">
460 <DetectIdentifier attribute="Varnish Identifier" context="varnish_identified" />
461 </context>
462 <context name="varnish_identified" attribute="Normal Text" lineEndContext="#pop">
463 <IncludeRules context="varnish_options" />
464 <RegExpr attribute="Keyword" context="varnish_vclannounced" String="\s*\-vcl(?:\+backend)?" />
465 <RegExpr attribute="Keyword" context="varnish_errvclannounced" String="\s*\-errvcl" />
466 <LineContinue attribute="Normal Text" context="#stay" />
467 </context>
468 <context name="varnish_vclannounced" attribute="Normal Text" lineEndContext="#stay">
469 <DetectChar attribute="Region Marker" context="varnish_vcldefinition" char="{" beginRegion="varnish_block" />
470 </context>
471 <context name="varnish_vcldefinition" attribute="Normal Text" lineEndContext="#stay">
472 <IncludeRules context="##Varnish Configuration Language" />
473 <DetectChar attribute="Region Marker" context="varnish_postvcldefinition" char="}" endRegion="varnish_block" />
474 </context>
475 <context name="varnish_postvcldefinition" attribute="Normal Text" lineEndContext="#pop#pop#pop#pop#pop">
476 <IncludeRules context="varnish_options" />
477 <LineContinue attribute="Normal Text" context="#stay" />
478 </context>
479 <context name="varnish_errvclannounced" attribute="Normal Text" lineEndContext="#stay">
480 <DetectChar char="&quot;" context="errvcl_expected_error_quoted" attribute="String" />
481 <DetectChar char="{" context="errvcl_expected_error_brace" attribute="String" beginRegion="string_block" />
482 </context>
483 <context name="errvcl_expected_error_quoted" attribute="String" lineEndContext="#pop">
484 <Detect2Chars attribute="String" context="#stay" char="\" char1="&quot;" />
485 <DetectChar attribute="String" context="varnish_errvcldefined" char="&quot;" />
486 </context>
487 <context name="errvcl_expected_error_brace" attribute="String" lineEndContext="#pop">
488 <DetectChar attribute="String" context="brace-string-internal" char="{" />
489 <DetectChar attribute="String" context="varnish_errvcldefined" char="}" endRegion="string_block" />
490 </context>
491 <context name="varnish_errvcldefined" attribute="Normal Text" lineEndContext="#pop">
492 <DetectChar attribute="Region Marker" context="varnish_errvclcode" char="{" beginRegion="errvclcode_block" />
493 </context>
494 <context name="varnish_errvclcode" attribute="Normal Text" lineEndContext="#stay">
495 <DetectChar attribute="Normal Text" context="varnish_errvclcode-internal" char="{" />
496 <DetectChar attribute="Region Marker" context="varnish_postvcldefinition" char="}" endRegion="errvclcode_block" />
497 </context>
498 <context name="varnish_errvclcode-internal" attribute="Normal Text" lineEndContext="#stay">
499 <DetectChar attribute="Normal Text" context="varnish_errvclcode-internal" char="{" />
500 <DetectChar attribute="Normal Text" context="#pop" char="}" />
501 </context>
502
503 <context name="logexpect_declaration" attribute="Normal Text" lineEndContext="#pop">
504 <DetectIdentifier attribute="LogExpect Identifier" context="logexpect_identified" />
505 </context>
506 <context name="logexpect_identified" attribute="Normal Text" lineEndContext="#pop">
507 <LineContinue attribute="Normal Text" context="#stay" />
508 <IncludeRules context="logexpect_options" />
509 <!-- Extracted from bin/varnishtest/vtc_logexp.c -->
510 <Detect2Chars attribute="Keyword" char="-" char1="v" context="logexpect_varnishinstance_arg" />
511 <Detect2Chars attribute="Keyword" char="-" char1="g" context="logexpect_grouping_arg" />
512 <Detect2Chars attribute="Keyword" char="-" char1="d" context="logexpect_headtailmode_arg" />
513 <Detect2Chars attribute="Keyword" char="-" char1="q" context="logexpect_query_arg" />
514 <DetectChar attribute="Region Marker" context="logexpect_definition" char="{" beginRegion="logexpect_block" />
515 </context>
516 <context name="logexpect_varnishinstance_arg" attribute="Normal Text" lineEndContext="#pop">
517 <DetectIdentifier attribute="Varnish Identifier" context="#pop" />
518 </context>
519 <context name="logexpect_grouping_arg" attribute="Normal Text" lineEndContext="#pop">
520 <keyword attribute="VSL Grouping" context="#pop" String="VSLGrouping" />
521 </context>
522 <context name="logexpect_headtailmode_arg" attribute="Normal Text" lineEndContext="#pop">
523 <AnyChar attribute="Decimal" context="#pop" String="01" />
524 </context>
525 <context name="logexpect_query_arg" attribute="Normal Text" lineEndContext="#pop">
526 <IncludeRules context="string-arg" />
527 </context>
528 <context name="logexpect_definition" attribute="Normal Text" lineEndContext="#stay">
529 <DetectChar attribute="Region Marker" context="logexpect_postdefinition" char="}" endRegion="logexpect_block" />
530 <StringDetect firstNonSpace="true" attribute="Action Keyword" context="logexpect_skip" String="expect" />
531 </context>
532 <context name="logexpect_postdefinition" attribute="Normal Text" lineEndContext="#pop#pop#pop#pop">
533 <IncludeRules context="logexpect_options" />
534 </context>
535 <context name="logexpect_skip" attribute="Normal Text" lineEndContext="#pop">
536 <Int attribute="Decimal" context="logexpect_vxid" />
537 <DetectChar attribute="Logical Operator" context="logexpect_vxid" char="*" />
538 </context>
539 <context name="logexpect_vxid" attribute="Normal Text" lineEndContext="#pop">
540 <Int attribute="Decimal" context="logexpect_tag" />
541 <AnyChar attribute="Logical Operator" context="logexpect_tag" String="*=" />
542 </context>
543 <context name="logexpect_tag" attribute="Normal Text" lineEndContext="#pop">
544 <keyword attribute="VSL Tag" context="logexpect_regex" String="VSLTags" />
545 <AnyChar attribute="Logical Operator" context="logexpect_regex" String="*=" />
546 </context>
547 <context name="logexpect_regex" attribute="String" lineEndContext="#pop">
548 <IncludeRules context="brace-strings" />
549 <IncludeRules context="quoted-strings" />
550 </context>
551
552 <!-- sema keyword -->
553 <context name="sema_instruction" attribute="Normal Text" lineEndContext="#pop">
554 <DetectIdentifier attribute="Sema Identifier" context="sema_identified" />
555 </context>
556 <context name="sema_identified" attribute="Normal Text" lineEndContext="#pop#pop">
557 <StringDetect attribute="Keyword" String="sync" />
558 <Int attribute="Decimal" context="#stay" />
559 <IncludeRules context="comments" />
560 </context>
561
562 <!-- delay keyword -->
563 <context name="delay_instruction" attribute="Normal Text" lineEndContext="#pop">
564 <Float attribute="Float" context="#stay" />
565 <Int attribute="Decimal" context="#stay" />
566 <IncludeRules context="comments" />
567 </context>
568
569 <!-- feature keyword -->
570 <context name="feature_instruction" attribute="String" lineEndContext="#pop">
571 <IncludeRules context="strings" />
572 <IncludeRules context="comments" />
573 </context>
574
575 <!-- chunkedlen keyword -->
576 <context name="chunkedlen_instruction" attribute="Normal Text" lineEndContext="#pop">
577 <Int attribute="Decimal" context="#stay" />
578 <IncludeRules context="comments" />
579 </context>
580
581 <!-- send / sendhex / chunk keywords -->
582 <context name="send_instruction" attribute="Normal Text" lineEndContext="#pop">
583 <IncludeRules context="string-arg" />
584 <IncludeRules context="comments" />
585 </context>
586
587 <!-- timeout keyword -->
588 <context name="timeout_instruction" attribute="Normal Text" lineEndContext="#pop">
589 <IncludeRules context="int-arg" />
590 <IncludeRules context="comments" />
591 </context>
592
593 <!-- loop keyword at global scope -->
594 <context name="global_loop_instruction" attribute="Normal Text" lineEndContext="#stay">
595 <Int attribute="Decimal" context="global_loop_defined" />
596 </context>
597 <context name="global_loop_defined" attribute="Normal Text" lineEndContext="#stay">
598 <DetectChar attribute="Region Marker" context="global_loop_code" char="{" beginRegion="loop_block" />
599 </context>
600 <context name="global_loop_code" attribute="Normal Text" lineEndContext="#stay">
601 <DetectChar attribute="Region Marker" context="#pop#pop#pop" char="}" endRegion="loop_block" />
602 <IncludeRules context="global_directives" />
603 </context>
604
605 <!-- loop keyword for client definitions -->
606 <context name="client_loop_instruction" attribute="Normal Text" lineEndContext="#stay">
607 <Int attribute="Decimal" context="client_loop_defined" />
608 </context>
609 <context name="client_loop_defined" attribute="Normal Text" lineEndContext="#stay">
610 <DetectChar attribute="Region Marker" context="client_loop_code" char="{" beginRegion="loop_block" />
611 </context>
612 <context name="client_loop_code" attribute="Normal Text" lineEndContext="#stay">
613 <DetectChar attribute="Region Marker" context="#pop#pop#pop" char="}" endRegion="loop_block" />
614 <IncludeRules context="client_definition" />
615 </context>
616
617 <!-- loop keyword for server definitions -->
618 <context name="server_loop_instruction" attribute="Normal Text" lineEndContext="#stay">
619 <Int attribute="Decimal" context="server_loop_defined" />
620 </context>
621 <context name="server_loop_defined" attribute="Normal Text" lineEndContext="#stay">
622 <DetectChar attribute="Region Marker" context="server_loop_code" char="{" beginRegion="loop_block" />
623 </context>
624 <context name="server_loop_code" attribute="Normal Text" lineEndContext="#stay">
625 <DetectChar attribute="Region Marker" context="#pop#pop#pop" char="}" endRegion="loop_block" />
626 <IncludeRules context="server_definition" />
627 </context>
628
629 <!-- shell keyword, one-line version -->
630 <context name="shell_instruction" attribute="Normal Text" lineEndContext="#stay">
631 <DetectChar attribute="Region Marker" context="shell_code" char="{" beginRegion="shell_block" />
632 <IncludeRules context="quoted-strings" />
633 <IncludeRules context="comments" />
634 </context>
635 <context name="shell_code" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="Command##Bash">
636 <DetectChar attribute="Region Marker" context="#pop#pop" char="}" endRegion="shell_block" />
637 <!-- There does not seem to be a syntax highlighting dedicated to "standard shell" so let's use Bash instead -->
638 <IncludeRules context="##Bash" />
639 </context>
640 </contexts>
641 <itemDatas>
642 <itemData name="Normal Text" defStyleNum="dsNormal" />
643 <itemData name="Comment" defStyleNum="dsComment" />
644 <itemData name="Keyword" defStyleNum="dsKeyword" />
645 <itemData name="Tx Keyword" defStyleNum="dsOthers" /> <!-- #008000 -->
646 <itemData name="TxReq Keyword" defStyleNum="dsOthers" /> <!-- #008000 -->
647 <itemData name="TxResp Keyword" defStyleNum="dsOthers" /> <!-- #008000 -->
648 <itemData name="RxResp Keyword" defStyleNum="dsOthers" /> <!-- #008000 -->
649 <itemData name="Action Keyword" defStyleNum="dsKeyword" />
650 <itemData name="Comparison Operator" defStyleNum="dsOthers" /> <!-- #008000 -->
651 <itemData name="Logical Operator" defStyleNum="dsOthers" /> <!-- #008000 -->
652 <itemData name="String" defStyleNum="dsString" />
653 <itemData name="Region Marker" defStyleNum="dsNormal" />
654 <itemData name="HTTP Property" defStyleNum="dsAttribute" bold="0" italic="0" /> <!-- #0000FF -->
655 <itemData name="HTTP Header" defStyleNum="dsExtension" bold="0" italic="0" /> <!-- #0D62FF -->
656 <itemData name="HTTP X- Header" defStyleNum="dsExtension" bold="0" italic="1" /> <!-- #0D62FF -->
657 <itemData name="HTTP announce" defStyleNum="dsFunction" bold="1" /> <!-- #562579 -->
658 <itemData name="HTTP method" defStyleNum="dsFunction" bold="1" /> <!-- #562579 -->
659 <itemData name="HTTP WebDAV method" defStyleNum="dsFunction" bold="1" /> <!-- #562579 -->
660 <itemData name="HTTP custom method" defStyleNum="dsFunction" bold="1" /> <!-- #562579 -->
661 <itemData name="VarnishStat metric" defStyleNum="dsAttribute" bold="0" italic="0" /> <!-- #0000FF -->
662 <itemData name="VSL Tag" defStyleNum="dsAttribute" bold="0" italic="0" /> <!-- #0000FF -->
663 <itemData name="VSL Grouping" defStyleNum="dsAttribute" bold="0" italic="0" /> <!-- #0000FF -->
664 <itemData name="Decimal" defStyleNum="dsDecVal" />
665 <itemData name="Float" defStyleNum="dsFloat" spellChecking="false"/>
666 <itemData name="Client Identifier" defStyleNum="dsExtension" bold="0" underline="1" /> <!-- #0D62FF -->
667 <itemData name="Server Identifier" defStyleNum="dsExtension" bold="0" underline="1" /> <!-- #0D62FF -->
668 <itemData name="Varnish Identifier" defStyleNum="dsExtension" bold="0" underline="1" /> <!-- #0D62FF -->
669 <itemData name="LogExpect Identifier" defStyleNum="dsExtension" bold="0" underline="1" /> <!-- #0D62FF -->
670 <itemData name="Sema Identifier" defStyleNum="dsExtension" bold="0" underline="1" /> <!-- #0D62FF -->
671 </itemDatas>
672 </highlighting>
673 <general>
674 <comments>
675 <comment name="singleLine" start="#" />
676 </comments>
677 <keywords casesensitive="1" />
678 </general>
679 </language>
680 <!-- kate: space-indent on; indent-width 2; replace-tabs on; -->