summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2022-12-06 22:59:55 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2022-12-07 19:18:19 +0100
commit931737a1719824d7945433177e61a6c47530ed69 (patch)
tree8b98915c6e415205d0d1cd9601a4980cc62a8c1f /src
parent84da9b6e335b7aa5bdcf1bd88c62daed5bdac889 (diff)
scanner: munch full comment lines
Munch lines full comment lines, regular expression matches lines that start by space or tab, then # follows, finally anything including one single line break. Call reset_pos() to ensure error reporting location is not puzzled. Closes: https://bugzilla.netfilter.org/show_bug.cgi?id=1196 Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r--src/scanner.l4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/scanner.l b/src/scanner.l
index 1371cd04..e72a427a 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -124,6 +124,7 @@ string ({letter}|[_.])({letter}|{digit}|[/\-_\.])*
quotedstring \"[^"]*\"
asteriskstring ({string}\*|{string}\\\*|\\\*|{string}\\\*{string})
comment #.*$
+comment_line ^[ \t]*#.*\n
slash \/
timestring ([0-9]+d)?([0-9]+h)?([0-9]+m)?([0-9]+s)?([0-9]+ms)?
@@ -858,6 +859,9 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr})
{tab}+
{space}+
{comment}
+{comment_line} {
+ reset_pos(yyget_extra(yyscanner), yylloc);
+ }
<<EOF>> {
update_pos(yyget_extra(yyscanner), yylloc, 1);