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 static_assert(lexy::is_char_encoding<typename Reader::encoding>);
55 typename Reader::iterator
begin;
56 typename Reader::iterator
end;
58 constexpr
bool try_parse(
const void*, Reader reader)
60 begin = reader.position();
64 _look_trie<typename Reader::encoding, Needle, End>, 0>;
68 auto result = matcher::try_match(reader);
83 end = reader.position();
87 template <
typename Context>
88 constexpr
void cancel(Context& context)
93 template <
typename NextParser,
typename Context,
typename... Args>
101 template <
typename NextParser>
104 template <
typename Context,
typename Reader,
typename... Args>
107 static_assert(lexy::is_char_encoding<typename Reader::encoding>);
109 if (!impl.try_parse(context.control_block, reader))
124 template <
typename Error>
130 template <
typename Needle,
typename End>
135 return _look<decltype(needle), decltype(
end),
void>{};
139 #endif // LEXY_DSL_LOOKAHEAD_HPP_INCLUDED