summaryrefslogtreecommitdiffstats
path: root/src/config.l
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-03-24 23:10:10 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-03-24 23:10:10 +0100
commit0b61ebf351a69a3451727254eec2c7e1cc024b4c (patch)
tree05b656fad541547b812193bc69061dd0d0b8059c /src/config.l
parent01683df316a73475ff59b665a3652718b55ac519 (diff)
downloadfastd-0b61ebf351a69a3451727254eec2c7e1cc024b4c.tar
fastd-0b61ebf351a69a3451727254eec2c7e1cc024b4c.zip
Remove context argument from lexer call
Diffstat (limited to 'src/config.l')
-rw-r--r--src/config.l21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/config.l b/src/config.l
index f18dca7..5e5e666 100644
--- a/src/config.l
+++ b/src/config.l
@@ -4,11 +4,7 @@
%option reentrant
%top {
- #define YY_DECL int fastd_config_lex(YYSTYPE *yylval_param, fastd_context *ctx, void *yyscanner)
-
- #include <fastd.h>
#include <config.yy.h>
- YY_DECL;
}
%x STRING
@@ -26,8 +22,10 @@ peer { yylval->str = yytext; return TOK_PEER; }
address { yylval->str = yytext; return TOK_ADDRESS; }
[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} {
- if (!inet_pton(AF_INET, yytext, &yylval->addr))
- exit_error(ctx, "config error: invalid address");
+ if (!inet_pton(AF_INET, yytext, &yylval->addr)) {
+ yylval->str = "invalid address";
+ return TOK_ERROR;
+ }
return TOK_ADDR;
}
@@ -48,12 +46,17 @@ tun { yylval->str = yytext; return TOK_TUN; }
\[ BEGIN(ADDR6);
<ADDR6>[^\]]+ {
- if (!inet_pton(AF_INET6, yytext, &yylval->addr6))
- exit_error(ctx, "config error: invalid address");
+ if (!inet_pton(AF_INET6, yytext, &yylval->addr6)) {
+ yylval->str = "invalid address";
+ return TOK_ERROR;
+ }
return TOK_ADDR6;
}
<ADDR6>\] BEGIN(INITIAL);
-<INITIAL,STRING,ADDR6>. exit_error(ctx, "config error: invalid character");
+<INITIAL,STRING,ADDR6>. {
+ yylval->str = "invalid character";
+ return TOK_ERROR;
+ }
%%