From af4d61a9604651cb78e26ed8ea65b3b0f9b46f98 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 3 Nov 2020 21:28:36 +0000 Subject: Fix inconsistencies with FilePosition and column counting. --- src/configparser.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/configparser.cpp') diff --git a/src/configparser.cpp b/src/configparser.cpp index c9381c4be..2254cefda 100644 --- a/src/configparser.cpp +++ b/src/configparser.cpp @@ -89,8 +89,15 @@ struct Parser std::string mandatory_tag; Parser(ParseStack& me, int myflags, FILE* conf, const std::string& name, const std::string& mandatorytag) - : stack(me), flags(myflags), file(conf), current(name), last_tag(name), ungot(-1), mandatory_tag(mandatorytag) - { } + : stack(me) + , flags(myflags) + , file(conf) + , current(name, 1, 0) + , last_tag(name, 0, 0) + , ungot(-1) + , mandatory_tag(mandatorytag) + { + } int next(bool eof_ok = false) { @@ -108,7 +115,7 @@ struct Parser else if (ch == '\n') { current.line++; - current.column = 0; + current.column = 1; } else { @@ -262,7 +269,7 @@ struct Parser if (name.empty()) throw CoreException("Empty tag name"); - tag = std::make_shared(name, current); + tag = std::make_shared(name, last_tag); while (kv()) { // Do nothing here (silences a GCC warning). -- cgit v1.3.1-10-gc9f91