summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/config.l12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/config.l b/src/config.l
index 231f228..6911e69 100644
--- a/src/config.l
+++ b/src/config.l
@@ -9,6 +9,7 @@
%s STRING
%s ADDR6
+%s COMMENT
%%
<INITIAL>{
@@ -61,12 +62,21 @@ tun { yylval->str = yytext; return TOK_TUN; }
}
<ADDR6>\] BEGIN(INITIAL);
-. {
+<INITIAL>#.* {}
+<INITIAL>\/\/.* {}
+
+<INITIAL>\/\* BEGIN(COMMENT);
+<COMMENT>\*\/ BEGIN(INITIAL);
+<COMMENT>. {}
+<COMMENT>\n {}
+
+. {
yylval->str = "invalid character";
return -1;
}
<INITIAL><<EOF>> { return 0; }
+<COMMENT><<EOF>> { yylval->str = "unterminated block comment"; return -1; }
<STRING><<EOF>> { yylval->str = "unterminated string"; return -1; }
<ADDR6><<EOF>> { yylval->str = "unterminated address"; return -1; }
%%