summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-03-27 22:58:59 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-03-27 22:58:59 +0200
commitb69d34071b26e8a6230cde199989071b833d8c99 (patch)
tree259533014ff0926c73d321db68f1fae5dd384fda /src
parent3065f96f7b833701a03f5759bfc593a7f6943c4e (diff)
downloadfastd-b69d34071b26e8a6230cde199989071b833d8c99.tar
fastd-b69d34071b26e8a6230cde199989071b833d8c99.zip
Allow comments in config files
Diffstat (limited to 'src')
-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; }
%%