diff options
Diffstat (limited to 'include/openvic-dataloader/v2script')
-rw-r--r-- | include/openvic-dataloader/v2script/AbstractSyntaxTree.hpp | 24 | ||||
-rw-r--r-- | include/openvic-dataloader/v2script/Parser.hpp | 1 |
2 files changed, 24 insertions, 1 deletions
diff --git a/include/openvic-dataloader/v2script/AbstractSyntaxTree.hpp b/include/openvic-dataloader/v2script/AbstractSyntaxTree.hpp index a27c237..0d0b019 100644 --- a/include/openvic-dataloader/v2script/AbstractSyntaxTree.hpp +++ b/include/openvic-dataloader/v2script/AbstractSyntaxTree.hpp @@ -172,9 +172,11 @@ namespace ovdl::v2script::ast { } OVDL_AST_LIST_NODE(ListNode); - OVDL_AST_LIST_NODE(MtthModifierNode); + OVDL_AST_LIST_NODE(ModifierNode); OVDL_AST_LIST_NODE(MtthNode); OVDL_AST_LIST_NODE(EventOptionNode); + OVDL_AST_LIST_NODE(BehaviorListNode); + OVDL_AST_LIST_NODE(DecisionListNode); #undef OVDL_AST_LIST_NODE @@ -223,6 +225,26 @@ namespace ovdl::v2script::ast { }) }; + struct DecisionNode final : public Node { + NodeUPtr _name; + std::vector<NodeUPtr> _statements; + explicit DecisionNode(NodePtr name, std::vector<NodePtr> statements = {}) + : _name(name), + _statements(make_node_ptr_vector(statements)) { + } + + OVDL_TYPE_DEFINE_SELF; + OVDL_RT_TYPE_DEF; + + OVDL_PRINT_FUNC_DEF({ + stream << "decision = {"; + for (auto& statement : _statements) { + statement->print(stream); + } + stream << "}"; + }) + }; + struct EventMtthModifierNode final : public Node { NodeUPtr _factor_value; std::vector<NodeUPtr> _statements; diff --git a/include/openvic-dataloader/v2script/Parser.hpp b/include/openvic-dataloader/v2script/Parser.hpp index 4f67e22..a1567dd 100644 --- a/include/openvic-dataloader/v2script/Parser.hpp +++ b/include/openvic-dataloader/v2script/Parser.hpp @@ -34,6 +34,7 @@ namespace ovdl::v2script { bool simple_parse(); bool event_parse(); + bool decision_parse(); bool has_error() const; bool has_fatal_error() const; |