summaryrefslogtreecommitdiff
path: root/hscript/script.cc
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-07 17:46:47 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-07 17:46:47 -0500
commit94fa461e0fe0c8004ee062c4d198dcae0bd29d68 (patch)
tree38616d7e75addfd82c8a5adbe40926e852f7821a /hscript/script.cc
parentbca63af9342506d7d6a9cc0e639a18a2613649ae (diff)
downloadhorizon-94fa461e0fe0c8004ee062c4d198dcae0bd29d68.tar.gz
horizon-94fa461e0fe0c8004ee062c4d198dcae0bd29d68.tar.bz2
horizon-94fa461e0fe0c8004ee062c4d198dcae0bd29d68.tar.xz
horizon-94fa461e0fe0c8004ee062c4d198dcae0bd29d68.zip
hscript: Lowercase the key, and don't parse an invalid key further
Diffstat (limited to 'hscript/script.cc')
-rw-r--r--hscript/script.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/hscript/script.cc b/hscript/script.cc
index 40c5fbf..01c920d 100644
--- a/hscript/script.cc
+++ b/hscript/script.cc
@@ -10,6 +10,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
+#include <algorithm>
#include <fstream>
#include <iostream>
#include "script.hh"
@@ -104,6 +105,9 @@ const Script *Script::load(std::istream &sstream, ScriptOptions opts) {
PARSER_ERROR("key '" + key + "' has no value")
}
+ /* Normalise key to lower-case */
+ std::transform(key.begin(), key.end(), key.begin(), ::tolower);
+
if(!is_key(key)) {
/* Invalid key */
if(opts.test(StrictMode)) {
@@ -111,6 +115,7 @@ const Script *Script::load(std::istream &sstream, ScriptOptions opts) {
} else {
PARSER_WARNING("key '" + key + "' is not defined")
}
+ continue;
}
}