Browse code

Merge branch 'rewrite-vtc3-from-vtc4'.

Summary:
- rewrote VTC3 from VTC4 for harmonization purposes.
- minor corrections in VTC4.

Xavier G authored on20/02/2015 23:52:31
Showing2 changed files

... ...
@@ -1,21 +1,7 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <!DOCTYPE language SYSTEM "language.dtd">
3
-<language name="Varnish Test Case language" version="0.2" kateversion="2.4" section="Configuration" extensions="*.vtc;" mimetype="" author="Xavier Guerrin (xavier@tuxfamily.org)" license="WTFPL">
3
+<language name="Varnish Test Case language" version="0.1" kateversion="2.4" section="Configuration" extensions="*.vtc;" mimetype="" author="Xavier Guerrin (xavier@tuxfamily.org)" license="WTFPL">
4 4
   <highlighting>
5
-    <list name="vtcClientKeywords">
6
-      <item>fatal</item>
7
-      <item>gunzip</item>
8
-      <item>rxchunk</item>
9
-    </list>
10
-    <list name="vtcServerKeywords">
11
-      <item>accept</item>
12
-      <item>close</item>
13
-      <item>expect_close</item>
14
-      <item>fatal</item>
15
-      <item>rxbody</item>
16
-      <item>rxhdrs</item>
17
-      <item>rxreq</item>
18
-    </list>
19 5
     <contexts>
20 6
       <!-- default context: define main keywords -->
21 7
       <context name="vtcnormal_text" attribute="Normal Text" lineEndContext="#stay">
... ...
@@ -84,16 +70,26 @@
84 70
 
85 71
       <!-- This context exits as soon as it parsed a string, be it defined between braces, quotes or spaces -->
86 72
       <context name="string-arg" attribute="Normal Text" lineEndContext="#stay">
73
+        <RegExpr attribute="HTTP announce"        context="#pop" String="HTTP/[0-9.]+" />
74
+        <RegExpr attribute="HTTP method"          context="#pop" String="\s+(GET|HEAD|POST|PUT|DELETE|TRACE|OPTIONS|CONNECT|PATCH)" />
75
+        <RegExpr attribute="HTTP WebDAV method"   context="#pop" String="\s+(PROPFIND|PROPPATCH|MKCOL|COPY|MOVE|LOCK|UNLOCK|CONNECT|PATCH)" />
76
+        <RegExpr attribute="HTTP custom method"   context="#pop" String="\s+(PURGE|PURGESTR)" />
87 77
         <IncludeRules context="brace-strings" />
88 78
         <IncludeRules context="quoted-strings" />
89 79
         <IncludeRules context="unquoted-strings" />
90 80
       </context>
91 81
 
92 82
       <!-- This context exits as soon as it parsed an integer. -->
93
-      <context name="int-arg" attribute="Int" lineEndContext="#pop">
83
+      <context name="int-arg" attribute="Normal Text" lineEndContext="#pop">
94 84
         <Int attribute="Decimal" context="#pop" />
95 85
       </context>
96 86
 
87
+      <!-- This context exits as soon as it parsed a status integer. -->
88
+      <context name="status-arg" attribute="String" lineEndContext="#pop">
89
+        <!-- HTTP status can be provided within quotes too. -->
90
+        <RegExpr attribute="Decimal" context="#pop" String="(&quot;[12345][0-9]{2}&quot;|[12345][0-9]{2})(?![0-9])" />
91
+      </context>
92
+
97 93
       <!-- Comments -->
98 94
       <context name="shell-like-comment" attribute="Comment" lineEndContext="#pop">
99 95
         <IncludeRules context="##Alerts" />
... ...
@@ -115,22 +111,132 @@
115 111
         <IncludeRules context="comments" />
116 112
       </context>
117 113
 
118
-      <!-- Define syntax within -expect options -->
119
-      <context name="expectation_common" attribute="Normal Text" lineEndContext="#stay">
120
-        <RegExpr attribute="Keyword" context="#stay" String="&lt;undef>" />
121
-        <IncludeRules context="base_elements" />
122
-        <IncludeRules context="vcl_operators" />
114
+      <!--
115
+        Define syntax of the -expect command for server and client objects.
116
+        Written from cmd_http_expect() in bin/varnishtest/vtc_http.c.
117
+      -->
118
+      <context name="http_expectation" attribute="Normal Text" lineEndContext="#pop">
119
+        <IncludeRules context="comments" />
120
+        <RegExpr    attribute="Float"                context="http_expectation_operator" String="[0-9\.]+(\s+|$)" />
121
+        <RegExpr    attribute="Decimal"              context="http_expectation_operator" String="[0-9]+(\s+|$)" />
122
+        <RegExpr    attribute="Keyword"              context="http_expectation_operator" String="&lt;undef>" />
123
+        <!-- Written from cmd_var_resolve() in bin/varnishtest/vtc_http.c. -->
124
+        <RegExpr    attribute="HTTP Property"        context="http_expectation_operator" String="req.(request|url|proto)" />
125
+        <RegExpr    attribute="HTTP Property"        context="http_expectation_operator" String="resp.(proto|status|msg|chunklen|bodylen|body)" />
126
+        <RegExpr    attribute="HTTP X- Header"       context="http_expectation_operator" String="(req|resp)\.http\.X-[-_A-Za-z0-9]*" />
127
+        <RegExpr    attribute="HTTP Header"          context="http_expectation_operator" String="(req|resp)\.http\.[A-Za-z][-_A-Za-z0-9]*" />
128
+        <RegExpr    attribute="HTTP announce"        context="http_expectation_operator" String="HTTP/[0-9.]+" />
129
+        <RegExpr    attribute="HTTP method"          context="http_expectation_operator" String="\s+(GET|HEAD|POST|PUT|DELETE|TRACE|OPTIONS|CONNECT|PATCH)" />
130
+        <RegExpr    attribute="HTTP WebDAV method"   context="http_expectation_operator" String="\s+(PROPFIND|PROPPATCH|MKCOL|COPY|MOVE|LOCK|UNLOCK|CONNECT|PATCH)" />
131
+        <RegExpr    attribute="HTTP custom method"   context="http_expectation_operator" String="\s+(PURGE|PURGESTR)" />
132
+        <DetectChar attribute="String"               context="http_expectation_arg1_brace-string" char="{" beginRegion="string_block" />
133
+        <DetectChar attribute="String"               context="http_expectation_arg1_quoted-string" char="&quot;" />
134
+        <RegExpr    attribute="Normal Text"          context="http_expectation_arg1_unquoted-string" String="[^ ]" lookAhead="true" />
135
+      </context>
136
+      <context name="http_expectation_operator" attribute="Normal Text" lineEndContext="#pop#pop">
137
+        <IncludeRules context="comments" />
138
+        <Detect2Chars attribute="Comparison Operator" context="common_expectation_second_arg" char="=" char1="=" />
139
+        <Detect2Chars attribute="Comparison Operator" context="common_expectation_second_arg" char="!" char1="=" />
140
+      </context>
141
+      <context name="common_expectation_second_arg" attribute="Normal Text" lineEndContext="#pop#pop#pop">
142
+        <IncludeRules context="comments" />
143
+        <RegExpr    attribute="Float"                context="common_expectation_end" String="[0-9\.]+(\s+|$)" />
144
+        <RegExpr    attribute="Decimal"              context="common_expectation_end" String="[0-9]+(\s+|$)" />
145
+        <RegExpr    attribute="Keyword"              context="common_expectation_end" String="&lt;undef>" />
146
+        <!-- Written from cmd_var_resolve() in bin/varnishtest/vtc_http.c. -->
147
+        <RegExpr    attribute="HTTP Property"        context="common_expectation_end" String="req.(request|url|proto)" />
148
+        <RegExpr    attribute="HTTP Property"        context="common_expectation_end" String="resp.(proto|status|msg|chunklen|bodylen|body)" />
149
+        <RegExpr    attribute="HTTP X- Header"       context="common_expectation_end" String="(req|resp)\.http\.X-[-_A-Za-z0-9]*" />
150
+        <RegExpr    attribute="HTTP Header"          context="common_expectation_end" String="(req|resp)\.http\.[A-Za-z][-_A-Za-z0-9]*" />
151
+        <RegExpr    attribute="HTTP announce"        context="common_expectation_end" String="HTTP/[0-9.]+" />
152
+        <RegExpr    attribute="HTTP method"          context="common_expectation_end" String="\s+(GET|HEAD|POST|PUT|DELETE|TRACE|OPTIONS|CONNECT|PATCH)" />
153
+        <RegExpr    attribute="HTTP WebDAV method"   context="common_expectation_end" String="\s+(PROPFIND|PROPPATCH|MKCOL|COPY|MOVE|LOCK|UNLOCK|CONNECT|PATCH)" />
154
+        <RegExpr    attribute="HTTP custom method"   context="common_expectation_end" String="\s+(PURGE|PURGESTR)" />
155
+        <DetectChar attribute="String"               context="common_expectation_arg2_brace-string" char="{" beginRegion="string_block" />
156
+        <DetectChar attribute="String"               context="common_expectation_arg2_quoted-string" char="&quot;" />
157
+        <RegExpr    attribute="Normal Text"          context="common_expectation_arg2_unquoted-string" String="[^ ]" lookAhead="true" />
158
+      </context>
159
+      <context name="common_expectation_end" attribute="Normal Text" lineEndContext="#pop#pop#pop#pop">
160
+        <IncludeRules context="comments" />
161
+      </context>
162
+
163
+      <!-- Contexts to parse first argument of server/client expectations as a string -->
164
+      <context name="http_expectation_arg1_brace-string" attribute="String" lineEndContext="#stay">
165
+        <DetectChar attribute="String" context="brace-string-internal" char="{" />
166
+        <DetectChar attribute="String" context="http_expectation_operator" char="}" endRegion="string_block" />
167
+      </context>
168
+      <context name="http_expectation_arg1_quoted-string" attribute="String" lineEndContext="#pop#pop">
169
+        <Detect2Chars attribute="String" context="#stay" char="\" char1="&quot;" />
170
+        <DetectChar   attribute="String" context="http_expectation_operator" char="&quot;" />
171
+      </context>
172
+      <context name="http_expectation_arg1_unquoted-string" attribute="String" lineEndContext="#pop#pop">
173
+        <RegExpr attribute="Normal Text" context="http_expectation_operator" String="\s" />
123 174
       </context>
124 175
 
125
-      <context name="expectation" attribute="String" lineEndContext="#pop">
126
-        <IncludeRules context="expectation_common" />
127
-        <IncludeRules context="vcl_variables" />
128
-        <RegExpr attribute="HTTP Property"  context="#stay" String="resp\.(msg|chunklen|bodylen|body)" />
176
+      <!-- Contexts to parse second argument of all expectations as a string -->
177
+      <context name="common_expectation_arg2_brace-string" attribute="String" lineEndContext="#stay">
178
+        <DetectChar attribute="String" context="brace-string-internal" char="{" />
179
+        <DetectChar attribute="String" context="common_expectation_end" char="}" endRegion="string_block" />
180
+      </context>
181
+      <context name="common_expectation_arg2_quoted-string" attribute="String" lineEndContext="#pop#pop">
182
+        <Detect2Chars attribute="String" context="#stay" char="\" char1="&quot;" />
183
+        <DetectChar   attribute="String" context="common_expectation_end" char="&quot;" />
184
+      </context>
185
+      <context name="common_expectation_arg2_unquoted-string" attribute="String" lineEndContext="#pop#pop">
186
+        <RegExpr attribute="Normal Text" context="common_expectation_end" String="\s" />
129 187
       </context>
130 188
 
189
+      <!--
190
+        Define syntax of the -expect command for varnish objects.
191
+        Written from varnish_expect() in bin/varnishtest/vtc_varnish.c
192
+      -->
131 193
       <context name="varnish_expectation" attribute="Normal Text" lineEndContext="#pop">
132
-        <IncludeRules context="expectation_common" />
133
-        <IncludeRules context="varnishstat_variables" />
194
+        <!-- Varnish's expect takes a Varnish counter as first argument. -->
195
+        <IncludeRules context="comments" />
196
+        <!-- Mostly extracted using man 7 varnish-counters | grep - - - | grep _ | sort -->
197
+        <RegExpr attribute="VarnishStat metric"    context="varnish_expectation_operator" String="(?:accept_fail|losthdr|uptime|vmods)" />
198
+        <RegExpr attribute="VarnishStat metric"    context="varnish_expectation_operator" String="backend_(?:busy|conn|fail|recycle|req|retry|reuse|toolate|unhealthy)" />
199
+        <RegExpr attribute="VarnishStat metric"    context="varnish_expectation_operator" String="cache_(?:hit(pass)?|miss)" />
200
+        <RegExpr attribute="VarnishStat metric"    context="varnish_expectation_operator" String="client_(?:conn|drop_late|drop|req)" />
201
+        <RegExpr attribute="VarnishStat metric"    context="varnish_expectation_operator" String="dir_dns_(?:cache_full|failed|hit|lookups)" />
202
+        <RegExpr attribute="VarnishStat metric"    context="varnish_expectation_operator" String="esi_(?:errors|warnings)" />
203
+        <RegExpr attribute="VarnishStat metric"    context="varnish_expectation_operator" String="fetch_(?:1xx|204|304|bad|chunked|close|eof|failed|head|length|oldhttp|zero)" />
204
+        <RegExpr attribute="VarnishStat metric"    context="varnish_expectation_operator" String="hcb_(?:insert|lock|nolock)" />
205
+        <RegExpr attribute="VarnishStat metric"    context="varnish_expectation_operator" String="n_(?:backend|ban_(?:add|dups|gone|obj_test|re_test|retire)|ban|expired|gunzip|gzip|lru_moved|lru_nuked|object|objectcore|objecthead|objoverflow|objsendfile|objwrite|sess_mem|sess|vampireobject|vbc|vcl_avail|vcl_discard|vcl|waitinglist|wrk_(?:create|drop|failed|lqueue|max|queued)|wrk)" />
206
+        <RegExpr attribute="VarnishStat metric"    context="varnish_expectation_operator" String="s_(?:fetch|pass|pipe|req|(?:body|hdr)bytes|sess)" />
207
+        <RegExpr attribute="VarnishStat metric"    context="varnish_expectation_operator" String="sess_(?:closed|herd|linger|pipe_overflow|pipeline|readahead)" />
208
+        <RegExpr attribute="VarnishStat metric"    context="varnish_expectation_operator" String="shm_(?:cont|cycles|flushes|records|writes)" />
209
+        <RegExpr attribute="VarnishStat metric"    context="varnish_expectation_operator" String="LCK\.(?:sm[spaf]|hsl|hcb|hcl|vcl|stat|sessmem|wstat|herder|wq|objhdr|exp|lru|cli|ban|vbp|vbe|backend)\.(?:creat|destroy|locks|colls)" />
210
+        <RegExpr attribute="VarnishStat metric"    context="varnish_expectation_operator" String="SMA\.[a-zA-Z0-9_-]+\.(?:c_(?:req|fail|bytes|freed)|g_(?:alloc|bytes|space))" />
211
+        <RegExpr attribute="VarnishStat metric"    context="varnish_expectation_operator" String="SMF\.[a-zA-Z0-9_-]+\.(?:c_(?:req|fail|bytes|freed)|g_(?:alloc|bytes|space|smf|smf_frag|smf_large))" />
212
+        <RegExpr attribute="VarnishStat metric"    context="varnish_expectation_operator" String="VBE\..+\.(?:happy|vcls)" />
213
+      </context>
214
+      <context name="varnish_expectation_operator" attribute="Normal Text" lineEndContext="#pop#pop">
215
+        <IncludeRules context="comments" />
216
+        <Detect2Chars attribute="Comparison Operator" context="varnish_expectation_second_arg" char="=" char1="=" />
217
+        <Detect2Chars attribute="Comparison Operator" context="varnish_expectation_second_arg" char="!" char1="=" />
218
+        <Detect2Chars attribute="Comparison Operator" context="varnish_expectation_second_arg" char="&gt;" char1="=" />
219
+        <Detect2Chars attribute="Comparison Operator" context="varnish_expectation_second_arg" char="&lt;" char1="=" />
220
+        <DetectChar   attribute="Comparison Operator" context="varnish_expectation_second_arg" char="&gt;" />
221
+        <DetectChar   attribute="Comparison Operator" context="varnish_expectation_second_arg" char="&lt;" />
222
+        <!-- Varnish's expect does not handle the ~ and !~ operators -->
223
+      </context>
224
+      <context name="varnish_expectation_second_arg" attribute="Normal Text" lineEndContext="#pop">
225
+        <!-- Varnish's expect takes an unsigned integer as second argument. -->
226
+        <Int attribute="Decimal" context="common_expectation_end" />
227
+      </context>
228
+
229
+      <!-- Contexts to parse first argument of Varnish expectations as a string -->
230
+      <context name="varnish_expectation_arg1_brace-string" attribute="String" lineEndContext="#stay">
231
+        <DetectChar attribute="String" context="brace-string-internal" char="{" />
232
+        <DetectChar attribute="String" context="varnish_expectation_operator" char="}" endRegion="string_block" />
233
+      </context>
234
+      <context name="varnish_expectation_arg1_quoted-string" attribute="String" lineEndContext="#pop#pop">
235
+        <Detect2Chars attribute="String" context="#stay" char="\" char1="&quot;" />
236
+        <DetectChar   attribute="String" context="varnish_expectation_operator" char="&quot;" />
237
+      </context>
238
+      <context name="varnish_expectation_arg1_unquoted-string" attribute="String" lineEndContext="#pop#pop">
239
+        <RegExpr attribute="Normal Text" context="varnish_expectation_operator" String="\s" />
134 240
       </context>
135 241
 
136 242
       <!-- Define macros -->
... ...
@@ -148,18 +254,25 @@
148 254
       </context>
149 255
 
150 256
       <context name="client_options" attribute="Normal Text" lineEndContext="#stay">
151
-        <RegExpr attribute="Keyword" context="#stay" String="\-(?:run|wait|start|connect)" />
152
-        <RegExpr attribute="Keyword" context="expectation" String="-expect" />
257
+        <!-- Extracted from bin/varnishtest/vtc_client.c  -->
258
+        <RegExpr attribute="Keyword" context="#stay" String="\-(?:run|start|wait)" />
259
+        <RegExpr attribute="Keyword" context="int-arg" String="\-repeat" />
260
+        <RegExpr attribute="Keyword" context="string-arg" String="\-connect" />
261
+        <RegExpr attribute="Keyword" context="http_expectation" String="-expect" />
153 262
         <IncludeRules context="common_options" />
154 263
       </context>
155 264
 
156 265
       <context name="server_options" attribute="Normal Text" lineEndContext="#stay" >
157
-        <RegExpr attribute="Keyword" context="#stay" String="\-(?:start|wait|stop|repeat)" />
158
-        <RegExpr attribute="Keyword" context="expectation" String="-expect" />
266
+        <!-- Extracted from bin/varnishtest/vtc_server.c  -->
267
+        <RegExpr attribute="Keyword" context="#stay" String="\-(?:start|wait)" />
268
+        <RegExpr attribute="Keyword" context="int-arg" String="\-repeat" />
269
+        <RegExpr attribute="Keyword" context="string-arg" String="\-listen " />
270
+        <RegExpr attribute="Keyword" context="http_expectation" String="-expect" />
159 271
         <IncludeRules context="common_options" />
160 272
       </context>
161 273
 
162 274
       <context name="varnish_options" attribute="Normal Text" lineEndContext="#stay" >
275
+        <!-- Extracted from bin/varnishtest/vtc_varnish.c  -->
163 276
         <RegExpr attribute="Keyword" context="#stay" String="\-(?:start|stop|wait|wait-running|wait-stopped)" />
164 277
         <RegExpr attribute="Keyword" context="string-arg" String="\-(?:arg|cli|cliok|storage) " />
165 278
         <RegExpr attribute="Keyword" context="clierr_options" String="\-clierr " />
... ...
@@ -170,31 +283,39 @@
170 283
       <context name="clierr_options" attribute="Normal Text" lineEndContext="#pop">
171 284
         <!-- unlike clikok, clierr requires an integer argument first -->
172 285
         <Int attribute="Decimal" context="clierr_command" />
286
+        <!-- It seems that integer can be provided within quotes though. -->
287
+        <RegExpr attribute="Decimal" context="clierr_command" String="&quot;[0-9]+&quot; " />
173 288
         <IncludeRules context="comments" />
174 289
       </context>
175 290
       <context name="clierr_command" attribute="String" lineEndContext="#pop">
176 291
         <IncludeRules context="comments" />
177 292
       </context>
178 293
 
179
-      <!-- Define syntax for the client-specific txreq keyword -->
180
-      <context name="txreq_options" attribute="String" lineEndContext="#pop">
294
+      <context name="tx_options" attribute="Normal Text" lineEndContext="#pop">
181 295
         <IncludeRules context="comments" />
182
-        <RegExpr attribute="TxReq Keyword" context="string-arg" String="\-(?:body|hdr|proto|req|url)" />
183 296
         <LineContinue attribute="Normal Text" context="#stay" />
184 297
       </context>
185 298
 
186
-      <!-- Define syntax for the client-specific rxresp keyword -->
187
-      <context name="rxresp_options" attribute="Normal Text" lineEndContext="#pop">
188
-        <StringDetect attribute="RxResp Keyword" String="-no_obj" />
189
-        <LineContinue attribute="Normal Text" context="#stay" />
299
+      <!-- Define syntax for the client-specific txreq keyword -->
300
+      <context name="txreq_options" attribute="String" lineEndContext="#pop">
301
+        <IncludeRules context="tx_options" />
302
+        <RegExpr attribute="TxReq Keyword" context="string-arg" String="\-(?:proto|req|url|hdr|body)" />
303
+        <RegExpr attribute="TxReq Keyword" context="int-arg" String="\-bodylen" />
190 304
       </context>
191 305
 
192 306
       <!-- Define syntax for the server-specific txresp keyword -->
193 307
       <context name="txresp_options" attribute="Normal Text" lineEndContext="#pop">
194
-        <IncludeRules context="comments" />
308
+        <IncludeRules context="tx_options" />
195 309
         <RegExpr attribute="TxResp Keyword" String="-nolen" />
196
-        <RegExpr attribute="TxResp Keyword" context="string-arg" String="\-(?:body|gzipbody|hdr|proto|msg) " />
197
-        <RegExpr attribute="TxResp Keyword" context="int-arg" String="\-(?:bodylen|gzip(?:len|residual|level)|status)" />
310
+        <RegExpr attribute="TxResp Keyword" context="int-arg" String="\-(?:bodylen|gzip(?:len|residual|level))" />
311
+        <RegExpr attribute="TxResp Keyword" context="string-arg" String="\-(?:body|gzipbody|hdr|msg|proto)" />
312
+        <RegExpr attribute="TxResp Keyword" context="status-arg" String="\-status" />
313
+      </context>
314
+
315
+      <!-- Define syntax for the client-specific rxresp keyword -->
316
+      <context name="rxresp_options" attribute="Normal Text" lineEndContext="#pop">
317
+        <IncludeRules context="comments" />
318
+        <StringDetect attribute="RxResp Keyword" String="-no_obj" />
198 319
         <LineContinue attribute="Normal Text" context="#stay" />
199 320
       </context>
200 321
 
... ...
@@ -204,6 +325,29 @@
204 325
         <IncludeRules context="comments" />
205 326
       </context>
206 327
 
328
+      <!-- client/server HTTP commands -->
329
+      <context name="clientserver_common_definition" attribute="Normal Text" lineEndContext="#stay">
330
+        <IncludeRules context="comments" />
331
+        <!-- Extracted using:
332
+            perl -nlE '$p = 1 if m#http_cmds\[\]#; say if ($p); exit if ($p && m#^\}#);' vtc_http.c
333
+            egrep '(^cmd_http_|^\s*ONLY_(CLIENT|SERVER))' bin/varnishtest/vtc_http.c
334
+        -->
335
+        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="timeout_instruction"     String="timeout" />
336
+        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay"                   String="expect_close" />
337
+        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="http_expectation"        String="expect" />
338
+        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="send_instruction"        String="sendhex" />
339
+        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="send_instruction"        String="send" />
340
+        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="chunkedlen_instruction"  String="chunkedlen" />
341
+        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="send_instruction"        String="chunked" />
342
+        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="delay_instruction"       String="delay" />
343
+        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="sema_instruction"        String="sema" />
344
+        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay"                   String="close" />
345
+        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay"                   String="accept" />
346
+        <!-- loop is not there as its parsing changes depending on server or client. -->
347
+        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay"                   String="fatal" />
348
+        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay"                   String="non-fatal" />
349
+      </context>
350
+
207 351
       <!-- client keyword -->
208 352
       <context name="client_declaration" attribute="Normal Text" lineEndContext="#pop">
209 353
         <DetectIdentifier attribute="Client Identifier" context="client_identified" />
... ...
@@ -214,23 +358,18 @@
214 358
         <LineContinue attribute="Normal Text" context="#stay" />
215 359
       </context>
216 360
       <context name="client_definition" attribute="Normal Text" lineEndContext="#stay">
217
-        <IncludeRules context="comments" />
218
-        <!-- basic keywords that take no options -->
219
-        <keyword attribute="Action Keyword" context="#stay" String="vtcClientKeywords" />
220
-        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay"                   String="non-fatal" />
221
-        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="expectation"             String="expect" />
361
+        <IncludeRules context="clientserver_common_definition" />
362
+        <!-- client-specific HTTP commands -->
363
+        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay"                   String="gunzip" />
222 364
         <StringDetect firstNonSpace="true" attribute="Action Keyword" context="txreq_options"           String="txreq" />
223 365
         <StringDetect firstNonSpace="true" attribute="Action Keyword" context="rxresp_options"          String="rxresp" />
224
-        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="sema_instruction"        String="sema" />
225
-        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="delay_instruction"       String="delay" />
226
-        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="send_instruction"        String="sendhex" />
227
-        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="send_instruction"        String="send" />
228
-        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="timeout_instruction"     String="timeout" />
366
+        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay"                   String="rxchunk" />
229 367
         <StringDetect firstNonSpace="true" attribute="Action Keyword" context="client_loop_instruction" String="loop" />
230 368
         <DetectChar attribute="Region Marker" context="client_postdefinition" char="}" endRegion="client_block" />
231 369
       </context>
232 370
       <context name="client_postdefinition" attribute="Normal Text" lineEndContext="#pop#pop#pop#pop">
233 371
         <IncludeRules context="client_options" />
372
+        <LineContinue attribute="Normal Text" context="#stay" />
234 373
       </context>
235 374
 
236 375
       <!-- server keyword -->
... ...
@@ -243,24 +382,18 @@
243 382
         <LineContinue attribute="Normal Text" context="#stay" />
244 383
       </context>
245 384
       <context name="server_definition" attribute="Normal Text" lineEndContext="#stay">
246
-        <IncludeRules context="comments" />
247
-        <!-- basic keywords that take no options -->
248
-        <keyword attribute="Action Keyword" context="#stay" String="vtcServerKeywords" />
249
-        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay"                   String="non-fatal" />
250
-        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="expectation"             String="expect" />
385
+        <IncludeRules context="clientserver_common_definition" />
386
+        <!-- server-specific HTTP commands -->
387
+        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay"                   String="rxhdrs" />
388
+        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay"                   String="rxreq" />
389
+        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay"                   String="rxbody" />
251 390
         <StringDetect firstNonSpace="true" attribute="Action Keyword" context="txresp_options"          String="txresp" />
252
-        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="sema_instruction"        String="sema" />
253
-        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="delay_instruction"       String="delay" />
254
-        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="chunkedlen_instruction"  String="chunkedlen" />
255
-        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="send_instruction"        String="sendhex" />
256
-        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="send_instruction"        String="send" />
257
-        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="send_instruction"        String="chunked" />
258
-        <StringDetect firstNonSpace="true" attribute="Action Keyword" context="timeout_instruction"     String="timeout" />
259 391
         <StringDetect firstNonSpace="true" attribute="Action Keyword" context="server_loop_instruction" String="loop" />
260 392
         <DetectChar attribute="Region Marker" context="server_postdefinition" char="}" endRegion="server_block" />
261 393
       </context>
262 394
       <context name="server_postdefinition" attribute="Normal Text" lineEndContext="#pop#pop#pop#pop">
263 395
         <IncludeRules context="server_options" />
396
+        <LineContinue attribute="Normal Text" context="#stay" />
264 397
       </context>
265 398
 
266 399
       <!-- varnish keyword -->
... ...
@@ -269,7 +402,8 @@
269 402
       </context>
270 403
       <context name="varnish_identified" attribute="Normal Text" lineEndContext="#pop">
271 404
         <IncludeRules context="varnish_options" />
272
-        <RegExpr attribute="Keyword" context="varnish_vclannounced" String="\s*\-(?:bad)?vcl(?:\+backend)?" />
405
+        <RegExpr attribute="Keyword" context="varnish_vclannounced" String="\s*\-vcl(?:\+backend)?" />
406
+        <RegExpr attribute="Keyword" context="varnish_errvclannounced" String="\s*\-badvcl" />
273 407
         <LineContinue attribute="Normal Text" context="#stay" />
274 408
       </context>
275 409
       <context name="varnish_vclannounced" attribute="Normal Text" lineEndContext="#stay">
... ...
@@ -281,6 +415,23 @@
281 415
       </context>
282 416
       <context name="varnish_postvcldefinition" attribute="Normal Text" lineEndContext="#pop#pop#pop#pop#pop">
283 417
         <IncludeRules context="varnish_options" />
418
+        <LineContinue attribute="Normal Text" context="#stay" />
419
+      </context>
420
+      <context name="varnish_errvclannounced" attribute="Normal Text" lineEndContext="#stay">
421
+        <DetectChar attribute="String" context="varnish_errvclcode-quoted" char="&quot;" />
422
+        <DetectChar attribute="Region Marker" context="varnish_errvclcode" char="{" beginRegion="errvclcode_block" />
423
+      </context>
424
+      <context name="varnish_errvclcode-quoted" attribute="String" lineEndContext="#pop">
425
+        <Detect2Chars attribute="String" context="#stay" char="\" char1="&quot;" />
426
+        <DetectChar attribute="String" context="varnish_postvcldefinition" char="&quot;" />
427
+      </context>
428
+      <context name="varnish_errvclcode" attribute="Normal Text" lineEndContext="#stay">
429
+        <DetectChar attribute="Normal Text" context="varnish_errvclcode-internal" char="{" />
430
+        <DetectChar attribute="Region Marker" context="varnish_postvcldefinition" char="}" endRegion="errvclcode_block" />
431
+      </context>
432
+      <context name="varnish_errvclcode-internal" attribute="Normal Text" lineEndContext="#stay">
433
+        <DetectChar attribute="Normal Text" context="varnish_errvclcode-internal" char="{" />
434
+        <DetectChar attribute="Normal Text" context="#pop" char="}" />
284 435
       </context>
285 436
 
286 437
       <!-- sema keyword -->
... ...
@@ -371,76 +522,12 @@
371 522
         <!-- There does not seem to be a syntax highlighting dedicated to "standard shell" so let's use Bash instead -->
372 523
         <IncludeRules context="##Bash" />
373 524
       </context>
374
-
375
-      <!-- Define keywords from other tools: variables and operators from the VCL language, varnishstat metrics -->
376
-      <context name="vcl_variables" attribute="Normal Text" lineEndContext="#stay">
377
-        <RegExpr attribute="Variable"       context="#stay" String="now" />
378
-        <RegExpr attribute="Storage"        context="#stay" String="storage\.[a-zA-Z0-9]+(?:\.(?:free_space|used_space|happy))?" />
379
-        <RegExpr attribute="TCP Property"   context="#stay" String="client\.(ip|identity)" />
380
-        <RegExpr attribute="TCP Property"   context="#stay" String="server\.(ip|hostname|identity|port)" />
381
-        <RegExpr attribute="HTTP Property"  context="#stay" String="req\.(request|url|proto|backend|restarts|esi_level|ttl|grace|keep|xid|esi|can_gzip|backend\.healthy|hash_ignore_busy|hash_always_miss)" />
382
-        <RegExpr attribute="HTTP Property"  context="#stay" String="bereq\.(request|url|proto|connect_timeout|first_byte_timeout|between_bytes_timeout)" />
383
-        <RegExpr attribute="HTTP Property"  context="#stay" String="obj\.(proto|status|response|hits|ttl|grace|keep|lastuse)" />
384
-        <RegExpr attribute="HTTP Property"  context="#stay" String="beresp\.(proto|saintmode|status|response|do_esi|do_stream|do_gzip|do_gunzip|ttl|grace|keep|backend\.(name|ip|port)|storage|cacheable)" />
385
-        <RegExpr attribute="HTTP Property"  context="#stay" String="resp\.(proto|status|response)" />
386
-        <RegExpr attribute="HTTP X- Header" context="#stay" String="(req|bereq|resp|beresp|obj)\.http\.X-[-_A-Za-z0-9]*" />
387
-        <RegExpr attribute="HTTP Header"    context="#stay" String="(req|bereq|resp|beresp|obj)\.http\.[A-Za-z][-_A-Za-z0-9]*" />
388
-      </context>
389
-      <context name="vcl_operators" attribute="Operator" lineEndContext="#stay">
390
-        <DetectChar   attribute="Logical Operator" context="#stay" char="!" />
391
-        <Detect2Chars attribute="Logical Operator" context="#stay" char="&amp;" char1="&amp;" />
392
-        <Detect2Chars attribute="Logical Operator" context="#stay" char="|" char1="|" />
393
-
394
-        <Detect2Chars attribute="Comparison Operator" context="#stay" char="=" char1="=" />
395
-        <Detect2Chars attribute="Comparison Operator" context="#stay" char="!" char1="=" />
396
-        <Detect2Chars attribute="Comparison Operator" context="#stay" char="&lt;" char1="=" />
397
-        <Detect2Chars attribute="Comparison Operator" context="#stay" char="&gt;" char1="=" />
398
-        <DetectChar   attribute="Comparison Operator" context="#stay" char="&lt;" />
399
-        <DetectChar   attribute="Comparison Operator" context="#stay" char="&gt;" />
400
-        <DetectChar   attribute="Comparison Operator" context="#stay" char="~" />
401
-        <Detect2Chars attribute="Comparison Operator" context="#stay" char="!" char1="~" />
402
-
403
-        <DetectChar   attribute="Arithmetic Operator" context="#stay" char="+" />
404
-        <DetectChar   attribute="Arithmetic Operator" context="#stay" char="-" />
405
-        <DetectChar   attribute="Arithmetic Operator" context="#stay" char="*" />
406
-        <DetectChar   attribute="Arithmetic Operator" context="#stay" char="/" />
407
-
408
-        <Detect2Chars attribute="Arithmetic Operator" context="#stay" char="+" char1="=" />
409
-        <Detect2Chars attribute="Arithmetic Operator" context="#stay" char="-" char1="=" />
410
-        <Detect2Chars attribute="Arithmetic Operator" context="#stay" char="*" char1="=" />
411
-        <Detect2Chars attribute="Arithmetic Operator" context="#stay" char="/" char1="=" />
412
-
413
-        <Detect2Chars attribute="Arithmetic Operator" context="#stay" char="+" char1="+" />
414
-        <Detect2Chars attribute="Arithmetic Operator" context="#stay" char="-" char1="-" />
415
-
416
-        <Detect2Chars attribute="Arithmetic Operator" context="#stay" char="&gt;" char1="&gt;" />
417
-        <Detect2Chars attribute="Arithmetic Operator" context="#stay" char="&lt;" char1="&lt;" />
418
-
419
-        <DetectChar   attribute="Operator" context="#stay" char="=" />
420
-      </context>
421
-      <context name="varnishstat_variables" attribute="Normal Text" lineEndContext="#stay">
422
-        <RegExpr attribute="VarnishStat metric"    context="#stay" String="client_(?:conn|drop|req|drop_late)" />
423
-        <RegExpr attribute="VarnishStat metric"    context="#stay" String="cache_(?:hit(pass)?|miss)" />
424
-        <RegExpr attribute="VarnishStat metric"    context="#stay" String="backend_(?:conn|unhealthy|busy|fail|reuse|toolate|recycle|retry|req)" />
425
-        <RegExpr attribute="VarnishStat metric"    context="#stay" String="fetch_(?:head|length|chunked|eof|bad|close|oldhttp|zero|failed|1xx|204|304)" />
426
-        <RegExpr attribute="VarnishStat metric"    context="#stay" String="n_(?:sess_mem|sess|object|vampireobject|objectcore|objecthead|waitinglist|vbc|wrk|wrk_(?:create|failed|max|lqueue|queueddrop)|backend|expired|lru_nuked|lru_moved|obj(?:sendfile|write|overflow)|vcl|vcl_avail|vcl_discard|ban|ban_(?:gone|add|retire|obj_test|re_test|dups)|gzip|gunzip)" />
427
-        <RegExpr attribute="VarnishStat metric"    context="#stay" String="(?:losthdr|backend_req|accept_fail|uptime|vmods)" />
428
-        <RegExpr attribute="VarnishStat metric"    context="#stay" String="s_(?:sess|req|pipe|pass|fetch|hdrbytes|bodybytes)" />
429
-        <RegExpr attribute="VarnishStat metric"    context="#stay" String="sess_(?:closed|pipeline|readahead|linger|herd)" />
430
-        <RegExpr attribute="VarnishStat metric"    context="#stay" String="shm_(?:records|writes|flushes|cont|cycles)" />
431
-        <RegExpr attribute="VarnishStat metric"    context="#stay" String="sms_(?:nreq|nobj|nbytes|balloc|bfree)" />
432
-        <RegExpr attribute="VarnishStat metric"    context="#stay" String="hcb_(?:nolock|lock|insert)" />
433
-        <RegExpr attribute="VarnishStat metric"    context="#stay" String="esi_(?:errors|warnings)" />
434
-        <RegExpr attribute="VarnishStat metric"    context="#stay" String="dir_dns_(?:lookups|failed|hit|cache_full)" />
435
-        <RegExpr attribute="VarnishStat metric"    context="#stay" String="LCK\.(?:sm[spaf]|hsl|hcb|hcl|vcl|stat|sessmem|wstat|herder|wq|objhdr|exp|lru|cli|ban|vbp|vbe|backend)\.(?:creat|destroy|locks|colls)" />
436
-        <RegExpr attribute="VarnishStat metric"    context="#stay" String="SMA\.[a-zA-Z0-9_-]+\.(?:c_(?:req|fail|bytes|freed)|g_(?:alloc|bytes|space))" />
437
-        <RegExpr attribute="VarnishStat metric"    context="#stay" String="VBE\..+\.(?:happy|vcls)" />
438
-      </context>
439 525
     </contexts>
440 526
     <itemDatas>
441 527
       <itemData name="Normal Text"               defStyleNum="dsNormal" />
442 528
       <itemData name="Comment"                   defStyleNum="dsComment" />
443 529
       <itemData name="Keyword"                   defStyleNum="dsKeyword" />
530
+      <itemData name="Tx Keyword"                defStyleNum="dsKeyword" color="#008000" bold="0" />
444 531
       <itemData name="TxReq Keyword"             defStyleNum="dsKeyword" color="#008000" bold="0" />
445 532
       <itemData name="TxResp Keyword"            defStyleNum="dsKeyword" color="#008000" bold="0" />
446 533
       <itemData name="RxResp Keyword"            defStyleNum="dsKeyword" color="#008000" bold="0" />
... ...
@@ -466,6 +553,7 @@
466 553
       <itemData name="Client Identifier"         defStyleNum="dsDataType" color="#0D62FF" selColor="#0D62FF" bold="0" underline="1" />
467 554
       <itemData name="Server Identifier"         defStyleNum="dsDataType" color="#0D62FF" selColor="#0D62FF" bold="0" underline="1" />
468 555
       <itemData name="Varnish Identifier"        defStyleNum="dsDataType" color="#0D62FF" selColor="#0D62FF" bold="0" underline="1" />
556
+      <itemData name="LogExpect Identifier"      defStyleNum="dsDataType" color="#0D62FF" selColor="#0D62FF" bold="0" underline="1" />
469 557
       <itemData name="Sema Identifier"           defStyleNum="dsDataType" color="#0D62FF" selColor="#0D62FF" bold="0" underline="1" />
470 558
     </itemDatas>
471 559
   </highlighting>
... ...
@@ -408,6 +408,7 @@
408 408
 
409 409
       <!-- Define syntax for the client-specific rxresp keyword -->
410 410
       <context name="rxresp_options" attribute="Normal Text" lineEndContext="#pop">
411
+        <IncludeRules context="comments" />
411 412
         <StringDetect attribute="RxResp Keyword" String="-no_obj" />
412 413
         <LineContinue attribute="Normal Text" context="#stay" />
413 414
       </context>
... ...
@@ -454,7 +455,6 @@
454 455
       <context name="client_definition" attribute="Normal Text" lineEndContext="#stay">
455 456
         <IncludeRules context="clientserver_common_definition" />
456 457
         <!-- client-specific HTTP commands -->
457
-        <keyword attribute="Action Keyword" context="#stay" String="vtcClientKeywords" />
458 458
         <StringDetect firstNonSpace="true" attribute="Action Keyword" context="txreq_options"           String="txreq" />
459 459
         <StringDetect firstNonSpace="true" attribute="Action Keyword" context="#stay"                   String="rxresphdrs" />
460 460
         <StringDetect firstNonSpace="true" attribute="Action Keyword" context="rxresp_options"          String="rxresp" />