aboutsummaryrefslogtreecommitdiff
path: root/src/configparser.cpp
diff options
context:
space:
mode:
authorGravatar Sadie Powell2020-11-03 21:28:36 +0000
committerGravatar Sadie Powell2020-11-03 21:28:36 +0000
commitaf4d61a9604651cb78e26ed8ea65b3b0f9b46f98 (patch)
tree65ab6e9b20525841639d6e42083bf80e2df4e6ca /src/configparser.cpp
parentMerge branch 'insp3' into master. (diff)
Fix inconsistencies with FilePosition and column counting.
Diffstat (limited to 'src/configparser.cpp')
-rw-r--r--src/configparser.cpp15
1 files changed, 11 insertions, 4 deletions
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<ConfigTag>(name, current);
+ tag = std::make_shared<ConfigTag>(name, last_tag);
while (kv())
{
// Do nothing here (silences a GCC warning).