From 7b1e33c26b4d36be2e3d1292dc539ff17e358589 Mon Sep 17 00:00:00 2001 From: Spartan322 Date: Tue, 3 Oct 2023 19:23:49 -0400 Subject: Make File contents optional Add lexy::nullopt support to String and List nodes --- include/openvic-dataloader/v2script/AbstractSyntaxTree.hpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/openvic-dataloader') 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 #include +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& statements = std::vector {}); \ + NAME(lexy::nullopt); \ NAME(NodeLocation location, const std::vector& statements = std::vector {}); \ + NAME(NodeLocation location, lexy::nullopt); \ OVDL_TYPE_DEFINE_SELF; \ OVDL_RT_TYPE_DEF; \ OVDL_PRINT_FUNC_DEF; \ -- cgit v1.2.3-56-ga3b1