r5129 - trunk/varnish-cache/lib/libvcl
phk at varnish-cache.org
phk at varnish-cache.org
Wed Aug 25 11:47:48 CEST 2010
Author: phk
Date: 2010-08-25 11:47:48 +0200 (Wed, 25 Aug 2010)
New Revision: 5129
Modified:
trunk/varnish-cache/lib/libvcl/vcc_parse.c
Log:
Add comments with BNF-ish syntax since this is starting to get hairy.
Modified: trunk/varnish-cache/lib/libvcl/vcc_parse.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_parse.c 2010-08-25 09:30:04 UTC (rev 5128)
+++ trunk/varnish-cache/lib/libvcl/vcc_parse.c 2010-08-25 09:47:48 UTC (rev 5129)
@@ -163,6 +163,25 @@
}
}
+/*--------------------------------------------------------------------
+ * SYNTAX:
+ * Cond_3:
+ * Typed_Expr Relation Compat_Typed_Expr
+ * Typed_Expr:
+ * VarName
+ * FuncCall
+ * Relation:
+ * Subset('==', '!=', '<', '<=', '>', '>=', '~', '!~')
+ * Compat_Typed_Expr
+ * Typed_Expr
+ * Typed_Const
+ *
+ * Since we cannot tell if "10 s" is a TIME or DURATION type, or for that
+ * matter if "127.0.0.1" is a STRING or IP type, we demand that the expression
+ * before the relational operator provides us with a type which can be used to
+ * guide parsing of other expression.
+ */
+
static void
vcc_Cond_3(struct vcc *tl)
{
@@ -207,6 +226,13 @@
}
}
+/*--------------------------------------------------------------------
+ * SYNTAX:
+ * Cond_2:
+ * '!'? '(' Conditional ')'
+ * '!'? Cond_3
+ */
+
static void
vcc_Cond_2(struct vcc *tl)
{
@@ -236,6 +262,12 @@
return;
}
+/*--------------------------------------------------------------------
+ * SYNTAX:
+ * Cond_1:
+ * Cond_2 { '&&' Cond_2 }*
+ */
+
static void
vcc_Cond_1(struct vcc *tl)
{
@@ -251,6 +283,12 @@
Fb(tl, 1, ")\n");
}
+/*--------------------------------------------------------------------
+ * SYNTAX:
+ * Cond_0:
+ * Cond_1 { '||' Cond_1 }*
+ */
+
static void
vcc_Cond_0(struct vcc *tl)
{
@@ -266,6 +304,12 @@
Fb(tl, 1, ")\n");
}
+/*--------------------------------------------------------------------
+ * SYNTAX:
+ * Conditional:
+ * '(' Cond_0 ')'
+ */
+
static void
vcc_Conditional(struct vcc *tl)
{
@@ -278,7 +322,16 @@
SkipToken(tl, ')');
}
-/*--------------------------------------------------------------------*/
+/*--------------------------------------------------------------------
+ * SYNTAX:
+ * IfStmt:
+ * 'if' Conditional Compound Branch1* Branch2
+ * Branch1:
+ * 'elseif' Conditional Compound
+ * Branch2:
+ * 'else' Compound
+ * null
+ */
static void
vcc_IfStmt(struct vcc *tl)
@@ -317,7 +370,17 @@
}
}
-/*--------------------------------------------------------------------*/
+/*--------------------------------------------------------------------
+ * SYNTAX:
+ * Compound:
+ * '{' Stmt* '}'
+ *
+ * Stmt:
+ * Compound
+ * IfStmt
+ * CSRC
+ * Id(Action) (XXX)
+ */
static void
vcc_Compound(struct vcc *tl)
@@ -371,7 +434,11 @@
}
}
-/*--------------------------------------------------------------------*/
+/*--------------------------------------------------------------------
+ * SYNTAX:
+ * Function:
+ * 'sub' ID(name) Compound
+ */
static void
vcc_Function(struct vcc *tl)
More information about the varnish-commit
mailing list