Commit 3ba970ec authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Teach vmodtool.py's tokenizer quotes

parent 8af37f4c
......@@ -22,12 +22,12 @@ client c1 {
txreq
rxresp
expect resp.bodylen == "6"
expect resp.http.foo1 == "1 2 3"
expect resp.http.foo2 == "1 2 3"
expect resp.http.foo3 == "1 2 3"
expect resp.http.foo4 == "1 2 3"
expect resp.http.foo5 == "1 2 3"
expect resp.http.foo6 == "1 2 3"
expect resp.http.foo1 == "1 2 3 ,"
expect resp.http.foo2 == "1 2 3 ,"
expect resp.http.foo3 == "1 2 3 ,"
expect resp.http.foo4 == "1 2 3 ,"
expect resp.http.foo5 == "1 2 3 ,"
expect resp.http.foo6 == "1 2 3 ,"
} -run
delay .1
......
......@@ -739,6 +739,22 @@ class FileSection(object):
return
l = re.sub("[ \t]*#.*$", "", l)
l = re.sub("[ \t]*\n", "", l)
if re.match("['\"]", l):
m = re.match("(['\"]).*?(\\1)", l)
if not m:
raise FormatError("Unbalanced quote",
"Unbalanced quote on line %d" % ln)
self.tl.append(Token(ln, 0, l[:m.end()]))
self.l.insert(0, (ln, l[m.end():]))
return
m = re.search("['\"]", l)
if m:
rest = l[m.start():]
self.l.insert(0, (ln, rest))
l = l[:m.start()]
l = re.sub("([(){},=])", r' \1 ', l)
if l == "":
return
......
......@@ -94,7 +94,8 @@ $Function VOID rot52(HTTP hdr)
Encrypt the HTTP header with quad-ROT13 encryption,
(this is approx 33% better than triple-DES).
$Function STRING argtest(STRING one, REAL two=2, STRING three="3")
$Function STRING argtest(STRING one, REAL two=2, STRING three="3",
STRING comma=",")
$Function INT vre_limit()
......
......@@ -177,11 +177,12 @@ vmod_rot52(VRT_CTX, VCL_HTTP hp)
}
VCL_STRING
vmod_argtest(VRT_CTX, VCL_STRING one, VCL_REAL two, VCL_STRING three)
vmod_argtest(VRT_CTX, VCL_STRING one, VCL_REAL two, VCL_STRING three,
VCL_STRING comma)
{
char buf[100];
bprintf(buf, "%s %g %s", one, two, three);
bprintf(buf, "%s %g %s %s", one, two, three, comma);
return WS_Copy(ctx->ws, buf, -1);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment