summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hscript/key.hh2
-rw-r--r--hscript/script.cc29
2 files changed, 23 insertions, 8 deletions
diff --git a/hscript/key.hh b/hscript/key.hh
index 6a18466..4705c59 100644
--- a/hscript/key.hh
+++ b/hscript/key.hh
@@ -29,7 +29,7 @@ public:
/*! Create the Key object with the specified data as the entire value.
* @returns nullptr if data is unparsable, otherwise a pointer to a Key.
*/
- static Key *parseFromData(std::string) { return nullptr; }
+ static Key *parseFromData(std::string, int*, int*) { return nullptr; }
/*! Determines if the data associated with the Key is valid. */
virtual bool validate() = 0;
diff --git a/hscript/script.cc b/hscript/script.cc
index 3196d9e..e53154b 100644
--- a/hscript/script.cc
+++ b/hscript/script.cc
@@ -13,6 +13,8 @@
#include <algorithm>
#include <fstream>
#include <iostream>
+#include <set>
+
#include "script.hh"
#include "disk.hh"
#include "meta.hh"
@@ -23,6 +25,26 @@
#define LINE_MAX 512
+
+const std::set<std::string> valid_keys = {
+ "network", "hostname", "pkginstall", "rootpw",
+ "language", "keymap", "firmware",
+ "netaddress", "nameserver", "netssid",
+ "timezone", "repository", "signingkey",
+ "username", "useralias", "userpw", "usericon", "usergroups",
+ "diskid", "disklabel", "partition", "lvm_pv", "lvm_vg", "lvm_lv",
+ "encrypt", "fs", "mount"
+};
+
+
+/*! Determines if the specified +key+ has been defined in this version of
+ * HorizonScript.
+ */
+inline bool is_key(const std::string key) {
+ return valid_keys.find(key) != valid_keys.end();
+}
+
+
namespace Horizon {
struct Script::ScriptPrivate {
@@ -53,13 +75,6 @@ const Script *Script::load(const std::string path, const ScriptOptions opts) {
return Script::load(file, opts);
}
-/*! Determines if the specified +key+ has been defined in this version of
- * HorizonScript.
- */
-bool is_key(std::string key) {
- return true;
-}
-
#define PARSER_ERROR(err_str) \
errors++;\
output_error("installfile:" + std::to_string(lineno),\