[master] 17b7c07 Use 'not' instead of '!' for boolean not operation
Martin Blix Grydeland
martin at varnish-cache.org
Tue Oct 1 14:48:19 CEST 2013
commit 17b7c076302f16933d196a1b988e1bde6c83a87e
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date: Wed Sep 25 13:31:02 2013 +0200
Use 'not' instead of '!' for boolean not operation
This makes it consistent with the 'and' and 'or' operators
diff --git a/bin/varnishtest/tests/l00001.vtc b/bin/varnishtest/tests/l00001.vtc
index b585fa2..f98ebc9 100644
--- a/bin/varnishtest/tests/l00001.vtc
+++ b/bin/varnishtest/tests/l00001.vtc
@@ -145,8 +145,8 @@ logexpect l1 -d 1 -g vxid -q "RespStatus == 404 or RespStatus ~ '^200$'" {
expect * = End
} -run
-# Test boolean !
-logexpect l1 -d 1 -g vxid -q "RespStatus == 404 or !RespStatus ~ '^404$'" {
+# Test boolean not
+logexpect l1 -d 1 -g vxid -q "RespStatus == 404 or not RespStatus ~ '^404$'" {
expect 0 * Begin req
expect * = ReqEnd
expect * = End
diff --git a/lib/libvarnishapi/generate.py b/lib/libvarnishapi/generate.py
index 6245ef8..9f3d668 100755
--- a/lib/libvarnishapi/generate.py
+++ b/lib/libvarnishapi/generate.py
@@ -60,9 +60,10 @@ tokens = {
# Boolean operators
"T_AND": "and",
"T_OR": "or",
+ "T_NOT": "not",
# Miscellaneous
- None: "<>~![]{}()",
+ None: "<>~[]{}()",
# These have handwritten recognizers
"VAL": None,
diff --git a/lib/libvarnishapi/vsl_query.c b/lib/libvarnishapi/vsl_query.c
index 1ef92e9..e36d4ba 100644
--- a/lib/libvarnishapi/vsl_query.c
+++ b/lib/libvarnishapi/vsl_query.c
@@ -236,7 +236,7 @@ vslq_exec(const struct vex *vex, struct VSL_transaction * const ptrans[])
if (r <= 0)
return (r);
return (vslq_exec(vex->b, ptrans));
- case '!':
+ case T_NOT:
AN(vex->a);
AZ(vex->b);
r = vslq_exec(vex->a, ptrans);
diff --git a/lib/libvarnishapi/vxp_parse.c b/lib/libvarnishapi/vxp_parse.c
index 83e6594..6847ab2 100644
--- a/lib/libvarnishapi/vxp_parse.c
+++ b/lib/libvarnishapi/vxp_parse.c
@@ -304,7 +304,7 @@ vxp_expr_group(struct vxp *vxp, struct vex **pvex)
/*
* SYNTAX:
* expr_not:
- * '!' expr_group
+ * 'not' expr_group
* expr_group
*/
@@ -315,7 +315,7 @@ vxp_expr_not(struct vxp *vxp, struct vex **pvex)
AN(pvex);
AZ(*pvex);
- if (vxp->t->tok == '!') {
+ if (vxp->t->tok == T_NOT) {
ALLOC_OBJ(*pvex, VEX_MAGIC);
AN(*pvex);
(*pvex)->tok = vxp->t->tok;
More information about the varnish-commit
mailing list