From 09d32687401dfbff59736d88817c7a783dd9ae87 Mon Sep 17 00:00:00 2001 From: Benjamin Bannier Date: Sun, 25 Sep 2022 22:28:54 +0200 Subject: [PATCH] bifcl: Keep zeekygen comments close to their definitions The Yacc grammar treats comments like other whitespace and when seeing the first definition in a file would previously emit all whitespace before emitting the `export` section containing the definition. This lead to the first definition being separated from their zeekygen documention (separated by `export {`). With this patch we start the export section before emitting whitespace. While this might now pull more "whitespace" into the exported part, it avoids breaking the association between zeekygen comments and definitions. Closes #15. --- tools/bifcl/builtin-func.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bifcl/builtin-func.y b/tools/bifcl/builtin-func.y index e1ca2e13e2..b8c67426d6 100644 --- a/tools/bifcl/builtin-func.y +++ b/tools/bifcl/builtin-func.y @@ -327,8 +327,8 @@ definitions: definitions definition opt_ws } | opt_ws { - fprintf(fp_zeek_init, "%s", $1); fprintf(fp_zeek_init, "export {\n"); + fprintf(fp_zeek_init, "%s", $1); } ;