4 #ifndef LEXY_DSL_PARSE_AS_HPP_INCLUDED
5 #define LEXY_DSL_PARSE_AS_HPP_INCLUDED
14 template <
typename Handler>
23 template <typename H, typename = decltype(static_cast<H&>(
LEXY_DECLVAL(Handler&)))>
24 constexpr
operator H&()
const
33 template <
typename Production,
typename State>
35 = std::conditional_t<lexy::production_has_value_callback<Production, State>,
42 template <
typename Context,
typename Reader,
typename T,
typename... Args>
46 value.emplace_result(lexy::construct<T>,
LEXY_FWD(args)...);
51 template <
typename Handler>
57 template <
typename Handler>
63 template <
typename T,
typename Rule,
bool Front = false>
66 template <
typename Reader>
71 template <
typename ControlBlock>
72 constexpr
bool try_parse(
const ControlBlock* cb,
const Reader& reader)
77 template <
typename Context>
78 constexpr
void cancel(Context& context)
84 template <
typename NextParser,
typename Context,
typename... Args>
90 =
lexy::_pc<decltype(handler),
typename Context::state_type,
91 typename Context::production,
typename Context::whitespace_production>;
92 context_type sub_context(&cb);
93 sub_context.handler =
LEXY_MOV(context).handler;
97 =
rule_parser.template finish<_pas_final_parser>(sub_context, reader, value);
99 context.control_block->copy_vars_from(&cb);
100 context.handler =
LEXY_MOV(sub_context).handler;
104 else if constexpr (std::is_void_v<T>)
107 else if constexpr (Front)
114 template <
typename NextParser>
117 template <
typename Context,
typename Reader,
typename... Args>
123 =
lexy::_pc<decltype(handler),
typename Context::state_type,
124 typename Context::production,
typename Context::whitespace_production>;
125 context_type sub_context(&cb);
126 sub_context.handler =
LEXY_MOV(context).handler;
132 context.control_block->copy_vars_from(&cb);
133 context.handler =
LEXY_MOV(sub_context).handler;
137 else if constexpr (std::is_void_v<T>)
140 else if constexpr (Front)
148 template <
typename T,
typename Rule>
155 #endif // LEXY_DSL_PARSE_AS_HPP_INCLUDED