#pragma once #include #include #include #include "SimpleGrammar.hpp" namespace ovdl::v2script::grammar { struct TriggerStatement { static constexpr auto rule = lexy::dsl::inline_; static constexpr auto value = lexy::callback( [](auto name, auto&& initalizer) { return ast::make_node_ptr({}, ast::ExecutionNode::Type::Trigger, LEXY_MOV(name), LEXY_MOV(initalizer)); }); }; struct TriggerList { 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::Trigger, LEXY_MOV(list)); }); }; struct TriggerBlock { 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 {}; }); }; }