4 #ifndef LEXY_DSL_LOOKAHEAD_HPP_INCLUDED
5 #define LEXY_DSL_LOOKAHEAD_HPP_INCLUDED
18 return "lookahead failure";
25 template <
typename Encoding,
typename... Needle,
typename... End>
29 auto char_class = std::size_t(0);
32 ((result.node_value[Needle::lit_insert(result, 0, char_class)] = 0,
33 char_class += Needle::lit_char_classes.size),
37 ((result.node_value[End::lit_insert(result, 0, char_class)] = 1,
38 char_class += End::lit_char_classes.size),
43 template <
typename Encoding,
typename Needle,
typename End>
45 = _build_look_trie<Encoding>(
typename Needle::as_lset{},
typename End::as_lset{});
47 template <
typename Needle,
typename End,
typename Tag>
50 template <
typename Reader>
53 typename Reader::iterator
begin;
54 typename Reader::iterator
end;
56 constexpr
bool try_parse(
const void*, Reader reader)
58 begin = reader.position();
62 _look_trie<typename Reader::encoding, Needle, End>, 0>;
66 auto result = matcher::try_match(reader);
81 end = reader.position();
85 template <
typename Context>
86 constexpr
void cancel(Context& context)
91 template <
typename NextParser,
typename Context,
typename... Args>
99 template <
typename NextParser>
102 template <
typename Context,
typename Reader,
typename... Args>
106 if (!impl.try_parse(context.control_block, reader))
121 template <
typename Error>
127 template <
typename Needle,
typename End>
132 return _look<decltype(needle), decltype(
end),
void>{};
136 #endif // LEXY_DSL_LOOKAHEAD_HPP_INCLUDED