summaryrefslogtreecommitdiffstats
path: root/src/Common
diff options
context:
space:
mode:
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/ConfigManager.cpp8
-rw-r--r--src/Common/Tokenizer.cpp10
2 files changed, 11 insertions, 7 deletions
diff --git a/src/Common/ConfigManager.cpp b/src/Common/ConfigManager.cpp
index 487e901..c119cf7 100644
--- a/src/Common/ConfigManager.cpp
+++ b/src/Common/ConfigManager.cpp
@@ -49,7 +49,7 @@ void ConfigManager::handleConfigEntry(const ConfigEntry &entry) {
}
if(!handled)
- Logger::logf(Logger::WARNING, "Invalid config option '%s'.", entry[0].getKey().c_str());
+ Logger::logf(Logger::WARNING, "Invalid config option '%s'.", entry[entry.getSize()-1].getKey().c_str());
}
bool ConfigManager::loadFile(const std::string &filename, bool finish) {
@@ -72,7 +72,7 @@ bool ConfigManager::loadFile(const std::string &filename, bool finish) {
size_t pos = input.find_first_of("#{}");
if(pos == std::string::npos) {
line += input;
- delim = 0;
+ delim = '\n';
input.clear();
}
else {
@@ -82,9 +82,7 @@ bool ConfigManager::loadFile(const std::string &filename, bool finish) {
}
if(!Tokenizer::tokenize(line, splitLine)) {
- if(delim)
- line += delim;
-
+ line += delim;
continue;
}
diff --git a/src/Common/Tokenizer.cpp b/src/Common/Tokenizer.cpp
index 1d7462f..8b01482 100644
--- a/src/Common/Tokenizer.cpp
+++ b/src/Common/Tokenizer.cpp
@@ -19,8 +19,6 @@
#include "Tokenizer.h"
-#include <iostream>
-
namespace Mad {
namespace Common {
@@ -72,8 +70,16 @@ bool Tokenizer::tokenize(const std::string &str, std::vector<std::string> &out)
break;
for(std::string::iterator c = s->begin(); c != s->end(); ++c) {
+ if(*c == '\n' && escape) {
+ escape = false;
+
+ if(doubleQuotes)
+ continue;
+ }
+
if(escape || (singleQuotes && *c != '\'')) {
token += *c;
+
escape = false;
continue;
}