aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
author Spartan322 <Megacake1234@gmail.com>2023-10-04 01:23:49 +0200
committer George L. Albany <Megacake1234@gmail.com>2023-10-05 01:35:42 +0200
commit7b1e33c26b4d36be2e3d1292dc539ff17e358589 (patch)
tree4456832acce290261f5839a083018afbd154ba16 /include
parent02c30fdda7b775782af1163b2321e7d6fcf01fcc (diff)
Make File contents optional
Add lexy::nullopt support to String and List nodes
Diffstat (limited to 'include')
-rw-r--r--include/openvic-dataloader/v2script/AbstractSyntaxTree.hpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/openvic-dataloader/v2script/AbstractSyntaxTree.hpp b/include/openvic-dataloader/v2script/AbstractSyntaxTree.hpp
index 8e39bd9..8ff910f 100644
--- a/include/openvic-dataloader/v2script/AbstractSyntaxTree.hpp
+++ b/include/openvic-dataloader/v2script/AbstractSyntaxTree.hpp
@@ -14,6 +14,10 @@
#include <openvic-dataloader/detail/SelfType.hpp>
#include <openvic-dataloader/detail/TypeName.hpp>
+namespace lexy {
+ struct nullopt;
+}
+
namespace ovdl::v2script {
class Parser;
}
@@ -161,7 +165,9 @@ namespace ovdl::v2script::ast {
struct AbstractStringNode : public Node {
std::string _name;
+ AbstractStringNode();
AbstractStringNode(std::string&& name);
+ AbstractStringNode(NodeLocation location);
AbstractStringNode(NodeLocation location, std::string&& name);
OVDL_TYPE_DEFINE_SELF;
OVDL_RT_TYPE_DEF;
@@ -172,8 +178,12 @@ namespace ovdl::v2script::ast {
#define OVDL_AST_STRING_NODE(NAME) \
struct NAME final : public AbstractStringNode { \
+ NAME(); \
NAME(std::string&& name); \
+ NAME(lexy::nullopt); \
+ NAME(NodeLocation location); \
NAME(NodeLocation location, std::string&& name); \
+ NAME(NodeLocation location, lexy::nullopt); \
OVDL_TYPE_DEFINE_SELF; \
OVDL_RT_TYPE_DEF; \
OVDL_PRINT_FUNC_DEF; \
@@ -219,7 +229,9 @@ namespace ovdl::v2script::ast {
#define OVDL_AST_LIST_NODE(NAME) \
struct NAME final : public AbstractListNode { \
NAME(const std::vector<NodePtr>& statements = std::vector<NodePtr> {}); \
+ NAME(lexy::nullopt); \
NAME(NodeLocation location, const std::vector<NodePtr>& statements = std::vector<NodePtr> {}); \
+ NAME(NodeLocation location, lexy::nullopt); \
OVDL_TYPE_DEFINE_SELF; \
OVDL_RT_TYPE_DEF; \
OVDL_PRINT_FUNC_DEF; \