[master] 94ca452d7 Allow comments in a VSL query

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Wed Jun 12 04:58:11 UTC 2019


commit 94ca452d73cd09b4e8fb858797224281c12c1978
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Fri May 17 09:16:31 2019 +0200

    Allow comments in a VSL query
    
    Now that we can have multiple lines in a query, it may come in handy to
    add a description of a query or its purpose.

diff --git a/lib/libvarnishapi/vxp_lexer.c b/lib/libvarnishapi/vxp_lexer.c
index ff5221e41..e6ce575aa 100644
--- a/lib/libvarnishapi/vxp_lexer.c
+++ b/lib/libvarnishapi/vxp_lexer.c
@@ -109,6 +109,13 @@ vxp_Lexer(struct vxp *vxp)
 			continue;
 		}
 
+		/* Skip comments */
+		if (*p == '#') {
+			while (p < vxp->e && *p != '\n')
+				p++;
+			continue;
+		}
+
 		/* Match for the fixed tokens */
 		u = vxp_fixed_token(p, &q);
 		if (u != 0) {


More information about the varnish-commit mailing list