aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-dataloader/v2script/TriggerGrammar.hpp
diff options
context:
space:
mode:
author Spartan322 <Megacake1234@gmail.com>2023-11-28 11:09:26 +0100
committer Spartan322 <Megacake1234@gmail.com>2024-05-09 22:11:26 +0200
commit757114a3c5b748567b42f273c7b78ca039ae983c (patch)
treee07390b682052129c91f4b157068bcdd84ceecb4 /src/openvic-dataloader/v2script/TriggerGrammar.hpp
parent7211a228e68c8a6b1ad1c1c5ec68c8d720b6d2ba (diff)
Add `deps/dryad` -> https://github.com/Spartan322/dryadadd/dryad
Add `deps/fmt` -> https://github.com/fmtlib/fmt Add `deps/range-v3` -> https://github.com/ericniebler/range-v3 Improve parser error and warning support Update .clang-format Update `deps/SCsub`
Diffstat (limited to 'src/openvic-dataloader/v2script/TriggerGrammar.hpp')
-rw-r--r--src/openvic-dataloader/v2script/TriggerGrammar.hpp31
1 files changed, 9 insertions, 22 deletions
diff --git a/src/openvic-dataloader/v2script/TriggerGrammar.hpp b/src/openvic-dataloader/v2script/TriggerGrammar.hpp
index 3849b12..095d115 100644
--- a/src/openvic-dataloader/v2script/TriggerGrammar.hpp
+++ b/src/openvic-dataloader/v2script/TriggerGrammar.hpp
@@ -6,37 +6,24 @@
#include <lexy/dsl.hpp>
#include "SimpleGrammar.hpp"
+#include "detail/dsl.hpp"
namespace ovdl::v2script::grammar {
struct TriggerStatement {
- static constexpr auto rule = lexy::dsl::inline_<SimpleAssignmentStatement<StringEscapeOption>>;
+ static constexpr auto rule = lexy::dsl::p<SAssignStatement<StringEscapeOption>>;
- static constexpr auto value = lexy::callback<ast::NodePtr>(
- [](auto name, auto&& initalizer) {
- return ast::make_node_ptr<ast::ExecutionNode>({}, ast::ExecutionNode::Type::Trigger, LEXY_MOV(name), LEXY_MOV(initalizer));
- });
+ static constexpr auto value = lexy::forward<ast::AssignStatement*>;
};
struct TriggerList {
- static constexpr auto rule = lexy::dsl::list(lexy::dsl::p<SimpleAssignmentStatement<StringEscapeOption>>);
-
- static constexpr auto value =
- lexy::as_list<std::vector<ast::NodePtr>> >>
- lexy::callback<ast::NodePtr>(
- [](auto&& list) {
- return ast::make_node_ptr<ast::ExecutionListNode>(ast::ExecutionNode::Type::Trigger, LEXY_MOV(list));
- });
+ static constexpr auto rule = lexy::dsl::list(lexy::dsl::p<TriggerStatement>);
+
+ static constexpr auto value = lexy::as_list<ast::AssignStatementList>;
};
struct TriggerBlock {
- static constexpr auto rule = lexy::dsl::curly_bracketed.opt(lexy::dsl::p<TriggerList>);
-
- static constexpr auto value = lexy::callback<ast::NodePtr>(
- [](auto&& list) {
- return LEXY_MOV(list);
- },
- [](lexy::nullopt = {}) {
- return lexy::nullopt {};
- });
+ static constexpr auto rule = dsl::curly_bracketed.opt(lexy::dsl::p<TriggerList>);
+
+ static constexpr auto value = construct_list<ast::ListValue>;
};
} \ No newline at end of file