From 2b810b412aeee2d9c79d97fa54a80e317981a6d8 Mon Sep 17 00:00:00 2001 From: InspIRCd Robot Date: Fri, 30 Dec 2022 11:31:28 +0000 Subject: Update copyright headers. --- src/configparser.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/configparser.cpp') diff --git a/src/configparser.cpp b/src/configparser.cpp index d0fa48ef8..8a1f78d46 100644 --- a/src/configparser.cpp +++ b/src/configparser.cpp @@ -6,7 +6,6 @@ * Copyright (C) 2013 ChrisTX * Copyright (C) 2012-2014 Attila Molnar * Copyright (C) 2012 Robby - * Copyright (C) 2010 Craig Edwards * Copyright (C) 2009-2010 Daniel De Graaf * * This file is part of InspIRCd. InspIRCd is free software: you can -- cgit v1.3.1-10-gc9f91 From b310c28aff053968a601ef6d26925f39fdd6375a Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 31 Dec 2022 18:24:22 +0000 Subject: Fix some minor config parser error messages. - Fix starting the column count for the first line on one instead of zero. This is incremented when reading the first character so starting at 1 causes an off by one error. - Fix showing "last tag was on line ..." message when there is an error before any tags. --- src/configparser.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/configparser.cpp') diff --git a/src/configparser.cpp b/src/configparser.cpp index 8a1f78d46..8fe3d082f 100644 --- a/src/configparser.cpp +++ b/src/configparser.cpp @@ -59,7 +59,13 @@ struct FilePosition FilePosition(const std::string& Name) : name(Name) , line(1) - , column(1) + , column(0) + { + } + + FilePosition() + : line(0) + , column(0) { } @@ -118,7 +124,7 @@ 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), ungot(-1), mandatory_tag(mandatorytag) { } int next(bool eof_ok = false) @@ -401,9 +407,10 @@ struct Parser { stack.errstr << err.GetReason() << " at " << current.str(); if (tag) - stack.errstr << " (inside tag " << tag->tag << " at line " << tag->src_line << ")\n"; - else - stack.errstr << " (last tag was on line " << last_tag.line << ")\n"; + stack.errstr << " (inside <" << tag->tag << "> tag on line " << tag->src_line << ")"; + else if (!last_tag.name.empty()) + stack.errstr << " (last tag was on line " << last_tag.line << ")"; + stack.errstr << " \n"; } return false; } -- cgit v1.3.1-10-gc9f91