diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-29 03:19:50 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-29 03:19:50 +0200 |
commit | eb0c48b789bbf41745287adb6b2949f84e7e9171 (patch) | |
tree | 212f1156670e2f600d958116738425caa35d815e /src/config.c | |
parent | aadf0a94b436990202cd2f13f1fe8528a9fd183c (diff) | |
download | fastd-eb0c48b789bbf41745287adb6b2949f84e7e9171.tar fastd-eb0c48b789bbf41745287adb6b2949f84e7e9171.zip |
Config parse: add location tracking for nice error messages
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/config.c b/src/config.c index b63ade9..8ba8c0a 100644 --- a/src/config.c +++ b/src/config.c @@ -117,17 +117,18 @@ void fastd_read_config(fastd_context *ctx, fastd_config *conf, const char *filen int token; YYSTYPE token_val; + YYLTYPE loc = {1, 0, 1, 0}; if (peer_config) token = START_PEER_CONFIG; else token = START_CONFIG; - while(fastd_config_push_parse(ps, token, &token_val, ctx, conf, depth+1) == YYPUSH_MORE) { - token = fastd_config_yylex(&token_val, scanner); + while(fastd_config_push_parse(ps, token, &token_val, &loc, ctx, conf, filename, depth+1) == YYPUSH_MORE) { + token = fastd_config_yylex(&token_val, &loc, scanner); if (token < 0) - exit_error(ctx, "config error: %s", token_val.str); + exit_error(ctx, "config error: %s at %s:%i:%i", token_val.str, filename, loc.first_line, loc.first_column); } fastd_config_pstate_delete(ps); |