summaryrefslogtreecommitdiff
path: root/hscript/script_l.hh
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-05-26 00:12:13 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-05-26 00:12:13 -0500
commitdb86a77b1d79824d2ee42d617f9a04bf8c3f7210 (patch)
treeb5814b658edad1a3691bb1b798d400e7f2e5a0dc /hscript/script_l.hh
parentcedb2d224da81edcca1191e7812713e308174889 (diff)
downloadhorizon-db86a77b1d79824d2ee42d617f9a04bf8c3f7210.tar.gz
horizon-db86a77b1d79824d2ee42d617f9a04bf8c3f7210.tar.bz2
horizon-db86a77b1d79824d2ee42d617f9a04bf8c3f7210.tar.xz
horizon-db86a77b1d79824d2ee42d617f9a04bf8c3f7210.zip
hscript: Convert 'int line' to a ScriptLocation object
Diffstat (limited to 'hscript/script_l.hh')
-rw-r--r--hscript/script_l.hh35
1 files changed, 35 insertions, 0 deletions
diff --git a/hscript/script_l.hh b/hscript/script_l.hh
new file mode 100644
index 0000000..1f048c6
--- /dev/null
+++ b/hscript/script_l.hh
@@ -0,0 +1,35 @@
+/*
+ * script_l.hh - Definition of the ScriptLocation structure
+ * libhscript, the HorizonScript library for
+ * Project Horizon
+ *
+ * Copyright (c) 2020 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
+ */
+
+#ifndef SCRIPT_L_HH
+#define SCRIPT_L_HH
+
+#include <string>
+
+namespace Horizon {
+
+/*! Defines a location within a script. */
+struct ScriptLocation {
+ /*! The filename of the script. */
+ std::string name;
+ /*! The line number of the current location. */
+ int line;
+ /*! Whether this script is nested or the original script. */
+ bool nested;
+
+ ScriptLocation(std::string _n, int _l, bool _nest = false) :
+ name{_n}, line{_l}, nested{_nest} {};
+};
+
+}
+
+#endif /* !SCRIPT_L_HH */