aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-dataloader/v2script/AiBehaviorGrammar.hpp
diff options
context:
space:
mode:
author George L. Albany <Megacake1234@gmail.com>2024-05-10 20:57:47 +0200
committer GitHub <noreply@github.com>2024-05-10 20:57:47 +0200
commit725310939d2b324d79ea4193a72000e21dcc1a2a (patch)
treee07390b682052129c91f4b157068bcdd84ceecb4 /src/openvic-dataloader/v2script/AiBehaviorGrammar.hpp
parent7211a228e68c8a6b1ad1c1c5ec68c8d720b6d2ba (diff)
parent757114a3c5b748567b42f273c7b78ca039ae983c (diff)
Merge pull request #37 from OpenVicProject/add/dryad
Move to dryad library
Diffstat (limited to 'src/openvic-dataloader/v2script/AiBehaviorGrammar.hpp')
-rw-r--r--src/openvic-dataloader/v2script/AiBehaviorGrammar.hpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/openvic-dataloader/v2script/AiBehaviorGrammar.hpp b/src/openvic-dataloader/v2script/AiBehaviorGrammar.hpp
index e04f447..7fcd13d 100644
--- a/src/openvic-dataloader/v2script/AiBehaviorGrammar.hpp
+++ b/src/openvic-dataloader/v2script/AiBehaviorGrammar.hpp
@@ -2,6 +2,7 @@
#include <openvic-dataloader/v2script/AbstractSyntaxTree.hpp>
+#include <lexy/callback/forward.hpp>
#include <lexy/dsl.hpp>
#include "ModifierGrammar.hpp"
@@ -10,23 +11,12 @@ namespace ovdl::v2script::grammar {
struct AiBehaviorList {
static constexpr auto rule = lexy::dsl::list(lexy::dsl::p<FactorStatement> | lexy::dsl::p<ModifierStatement>);
- static constexpr auto value =
- lexy::as_list<std::vector<ast::NodePtr>> >>
- lexy::callback<ast::NodePtr>(
- [](auto&& list) {
- return ast::make_node_ptr<ast::BehaviorListNode>(LEXY_MOV(list));
- });
+ static constexpr auto value = lexy::as_list<ast::AssignStatementList>;
};
struct AiBehaviorBlock {
- static constexpr auto rule = lexy::dsl::curly_bracketed.opt(lexy::dsl::p<AiBehaviorList>);
+ static constexpr auto rule = dsl::curly_bracketed.opt(lexy::dsl::p<AiBehaviorList>);
- static constexpr auto value = lexy::callback<ast::NodePtr>(
- [](auto&& list) {
- return LEXY_MOV(list);
- },
- [](lexy::nullopt = {}) {
- return lexy::nullopt {};
- });
+ static constexpr auto value = construct_list<ast::ListValue>;
};
} \ No newline at end of file