From bd5121e2c8293a4378b046ea55313b2171ec7027 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 10 May 2016 19:54:27 -0400 Subject: [PATCH] Rules: Fixed bug where all values were tokenized, thereby introducing spaces --- src/Rules.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Rules.cpp b/src/Rules.cpp index 52a3d9fa..998671a6 100644 --- a/src/Rules.cpp +++ b/src/Rules.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include //////////////////////////////////////////////////////////////////////////////// @@ -267,12 +268,13 @@ void Rules::parse (const std::string& input, int nest /* = 1 */) else if (tokens.size () >= 3 && std::get <0> (tokens[1]) == "=") { - // Extract the words from the 3rd - Nth tuple. - std::vector words; - for (auto& token : std::vector > (tokens.begin () + 2, tokens.end ())) - words.push_back (std::get <0> (token)); + // If this line is an assignment, then tokenizing it is a mistake, so + // use the raw data from 'line'. + auto equals = line.find ('='); + assert (equals != std::string::npos); - set (firstWord, join (" ", words)); + set (trim (line.substr (indent, equals - indent)), + trim (line.substr (equals + 1))); } // Top-level settings, with no value: