summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-06 17:25:40 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-06 17:25:40 -0500
commit5c82a446b9110cf27958ad9c82535b84d0565e10 (patch)
tree3c7f9cce9ad0e25e61a41bae9049a692822ed3ae /tools
parent65f70c4d29fb2ffc75aad2435ac6b03059bb6e80 (diff)
downloadhorizon-5c82a446b9110cf27958ad9c82535b84d0565e10.tar.gz
horizon-5c82a446b9110cf27958ad9c82535b84d0565e10.tar.bz2
horizon-5c82a446b9110cf27958ad9c82535b84d0565e10.tar.xz
horizon-5c82a446b9110cf27958ad9c82535b84d0565e10.zip
Beginnings of some extremely basic parsing and a utility
Diffstat (limited to 'tools')
-rw-r--r--tools/hscript-validate/validator.cc39
1 files changed, 39 insertions, 0 deletions
diff --git a/tools/hscript-validate/validator.cc b/tools/hscript-validate/validator.cc
index e69de29..e9e1979 100644
--- a/tools/hscript-validate/validator.cc
+++ b/tools/hscript-validate/validator.cc
@@ -0,0 +1,39 @@
+/*
+ * validator.cc - Implementation of the HorizonScript validation utility
+ * Project Horizon
+ *
+ * Copyright (c) 2019 Adélie Linux and contributors. All rights reserved.
+ * This code is licensed under the AGPL 3.0 license, as noted in the
+ * LICENSE-code file in the root directory of this repository.
+ *
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+#include "hscript/script.hh"
+#include "util/output.hh"
+
+int main(int argc, char *argv[]) {
+ const Horizon::Script *my_script;
+ Horizon::ScriptOptions opts;
+
+ if(argc < 2) {
+ output_error("hscript-validate", "No installfile specified", "", true);
+ std::cerr << "Run `" << argv[0] << " --help` for usage information." << std::endl;
+ return EXIT_FAILURE;
+ }
+
+ std::cout << "\033[1mHorizonScript Validation Utility version 0.1.0\033[0m" << std::endl;
+ std::cout << "Copyright (c) 2019 Adélie Linux and contributors. AGPL-3.0 license." << std::endl;
+ std::cout << std::endl;
+
+ opts.set(Horizon::ScriptOptionFlags::Pretty);
+
+ my_script = Horizon::Script::load(argv[1], opts);
+ if(my_script == nullptr) {
+ std::cout << "Could not load the specified script." << std::endl;
+ return EXIT_FAILURE;
+ }
+ delete my_script;
+
+ return EXIT_SUCCESS;
+}