From 757114a3c5b748567b42f273c7b78ca039ae983c Mon Sep 17 00:00:00 2001 From: Spartan322 Date: Tue, 28 Nov 2023 05:09:26 -0500 Subject: Add `deps/dryad` -> https://github.com/Spartan322/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` --- src/openvic-dataloader/v2script/EffectGrammar.hpp | 31 +++++++---------------- 1 file changed, 9 insertions(+), 22 deletions(-) (limited to 'src/openvic-dataloader/v2script/EffectGrammar.hpp') diff --git a/src/openvic-dataloader/v2script/EffectGrammar.hpp b/src/openvic-dataloader/v2script/EffectGrammar.hpp index 1b85382..10f8348 100644 --- a/src/openvic-dataloader/v2script/EffectGrammar.hpp +++ b/src/openvic-dataloader/v2script/EffectGrammar.hpp @@ -6,37 +6,24 @@ #include #include "SimpleGrammar.hpp" +#include "detail/dsl.hpp" namespace ovdl::v2script::grammar { struct EffectStatement { - static constexpr auto rule = lexy::dsl::inline_>; + static constexpr auto rule = lexy::dsl::p>; - static constexpr auto value = lexy::callback( - [](auto name, auto&& initalizer) { - return ast::make_node_ptr(ast::ExecutionNode::Type::Effect, LEXY_MOV(name), LEXY_MOV(initalizer)); - }); + static constexpr auto value = lexy::forward; }; struct EffectList { - static constexpr auto rule = lexy::dsl::list(lexy::dsl::p>); - - static constexpr auto value = - lexy::as_list> >> - lexy::callback( - [](auto&& list) { - return ast::make_node_ptr(ast::ExecutionNode::Type::Effect, LEXY_MOV(list)); - }); + static constexpr auto rule = lexy::dsl::list(lexy::dsl::p); + + static constexpr auto value = lexy::as_list; }; struct EffectBlock { - static constexpr auto rule = lexy::dsl::curly_bracketed.opt(lexy::dsl::p); - - static constexpr auto value = lexy::callback( - [](auto&& list) { - return LEXY_MOV(list); - }, - [](lexy::nullopt = {}) { - return lexy::nullopt {}; - }); + static constexpr auto rule = dsl::curly_bracketed.opt(lexy::dsl::p); + + static constexpr auto value = construct_list; }; } \ No newline at end of file -- cgit v1.2.3-56-ga3b1