summaryrefslogtreecommitdiffstats
path: root/src/config.y
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-03-29 03:19:50 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-03-29 03:19:50 +0200
commiteb0c48b789bbf41745287adb6b2949f84e7e9171 (patch)
tree212f1156670e2f600d958116738425caa35d815e /src/config.y
parentaadf0a94b436990202cd2f13f1fe8528a9fd183c (diff)
downloadfastd-eb0c48b789bbf41745287adb6b2949f84e7e9171.tar
fastd-eb0c48b789bbf41745287adb6b2949f84e7e9171.zip
Config parse: add location tracking for nice error messages
Diffstat (limited to 'src/config.y')
-rw-r--r--src/config.y8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/config.y b/src/config.y
index 78c0833..1e75da8 100644
--- a/src/config.y
+++ b/src/config.y
@@ -27,8 +27,10 @@
%define api.pure
%define api.push-pull push
%name-prefix "fastd_config_"
+%locations
%parse-param {fastd_context *ctx}
%parse-param {fastd_config *conf}
+%parse-param {const char *filename}
%parse-param {int depth}
%code requires {
@@ -78,7 +80,7 @@
#include <stdint.h>
#include <peer.h>
- void fastd_config_error(fastd_context *ctx, fastd_config *conf, int depth, char *s);
+ void fastd_config_error(YYLTYPE *loc, fastd_context *ctx, fastd_config *conf, const char *filename, int depth, char *s);
extern fastd_protocol fastd_protocol_null;
@@ -237,6 +239,6 @@ port: TOK_INTEGER {
}
;
%%
-void fastd_config_error(fastd_context *ctx, fastd_config *conf, int depth, char *s) {
- exit_error(ctx, "config error: %s", s);
+void fastd_config_error(YYLTYPE *loc, fastd_context *ctx, fastd_config *conf, const char *filename, int depth, char *s) {
+ exit_error(ctx, "config error: %s at %s:%i:%i", s, filename, loc->first_line, loc->first_column);
}