4 #ifndef LEXY_DSL_OPTION_HPP_INCLUDED
5 #define LEXY_DSL_OPTION_HPP_INCLUDED
27 template <
typename T,
typename = _detect_optional_like<T>>
28 constexpr
operator T()
const
39 template <
typename NextParser>
42 template <
typename Context,
typename Reader,
typename... Args>
55 template <
typename Branch>
58 template <
typename NextParser>
61 template <
typename Context,
typename Reader,
typename... Args>
65 if (branch.try_parse(context.control_block, reader))
67 return branch.template finish<NextParser>(context, reader,
LEXY_FWD(args)...);
71 branch.cancel(context);
80 template <
typename Rule>
81 constexpr
auto opt(Rule)
84 if constexpr (lexy::is_unconditional_branch_rule<Rule>)
94 template <
typename Term,
typename Rule>
97 template <
typename NextParser>
100 template <
typename Context,
typename Reader,
typename... Args>
105 if (term.try_parse(context.control_block, reader))
107 return term.template finish<NextParser>(context, reader,
LEXY_FWD(args)...,
109 term.cancel(context);
119 #endif // LEXY_DSL_OPTION_HPP_INCLUDED