diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-27 22:58:59 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-27 22:58:59 +0200 |
commit | b69d34071b26e8a6230cde199989071b833d8c99 (patch) | |
tree | 259533014ff0926c73d321db68f1fae5dd384fda /src | |
parent | 3065f96f7b833701a03f5759bfc593a7f6943c4e (diff) | |
download | fastd-b69d34071b26e8a6230cde199989071b833d8c99.tar fastd-b69d34071b26e8a6230cde199989071b833d8c99.zip |
Allow comments in config files
Diffstat (limited to 'src')
-rw-r--r-- | src/config.l | 12 |
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; } %% |