Go to the documentation of this file.
4 #ifndef LEXY_ACTION_PARSE_AS_TREE_HPP_INCLUDED
5 #define LEXY_ACTION_PARSE_AS_TREE_HPP_INCLUDED
14 template <
typename Tree,
typename Reader>
18 template <
typename Input,
typename Sink>
46 reader.set_position(pos);
48 auto end = reader.position();
62 handler.
_tree->clear();
78 return handler.
_builder->start_container();
80 template <
typename Operation>
85 handler.
_builder->set_container_production(
op);
87 template <
typename Marker>
94 template <
typename TokenKind>
100 template <
typename Error>
106 template <
typename Event,
typename... Args>
107 auto on(
_pth& handler, Event ev, Args&&... args)
117 template <
typename Production,
typename State>
120 template <
typename T>
136 template <
typename State,
typename Input,
typename ErrorCallback,
typename TokenKind =
void,
137 typename MemoryResource =
void>
156 template <
typename U = State>
162 template <
typename Production>
167 auto reader =
input.reader();
168 return lexy::do_action<Production, result_type>(
handler(*
_tree, input_holder, sink),
_state,
173 template <
typename Production,
typename TokenKind,
typename MemoryResource,
typename Input,
174 typename ErrorCallback>
176 const Input& input,
const ErrorCallback&
callback)
180 MemoryResource>(tree,
callback)(Production{}, input);
182 template <
typename Production,
typename TokenKind,
typename MemoryResource,
typename Input,
183 typename State,
typename ErrorCallback>
185 const Input& input, State& state,
const ErrorCallback&
callback)
189 MemoryResource>(state, tree,
callback)(Production{}, input);
191 template <
typename Production,
typename TokenKind,
typename MemoryResource,
typename Input,
192 typename State,
typename ErrorCallback>
194 const Input& input,
const State& state,
const ErrorCallback&
callback)
198 MemoryResource>(state, tree,
callback)(Production{}, input);
202 #endif // LEXY_ACTION_PARSE_AS_TREE_HPP_INCLUDED
constexpr parse_as_tree_action(tree_type &tree, const ErrorCallback &callback)
lexy::_detail::lazy_init< typename Tree::builder > _builder
auto on(_pth &handler, Event ev, Args &&... args)
void on(_pth &handler, parse_events::production_cancel, iterator pos)
void on(_pth &handler, parse_events::production_finish, iterator pos)
constexpr auto operator()(Production, const Input &input) const
void on(_pth &handler, parse_events::error ev, Error &&error)
#define LEXY_PRECONDITION(Expr)
void on(_pth &handler, parse_events::token, TokenKind kind, iterator begin, iterator end)
constexpr parse_as_tree_action(U &state, tree_type &tree, const ErrorCallback &callback)
constexpr auto end(const C &c) -> decltype(c.end())
constexpr auto callback(Fns &&... fns)
Creates a callback.
constexpr auto _get_error_sink(const Callback &callback)
constexpr T & emplace(Args &&... args)
constexpr LEXY_FORCE_INLINE auto try_match_token(TokenRule, Reader &reader)
Tree::builder::marker _marker
typename Reader::iterator iterator
auto parse_as_tree(parse_tree< lexy::input_reader< Input >, TokenKind, MemoryResource > &tree, const Input &input, const ErrorCallback &callback) -> validate_result< ErrorCallback >
void on(_pth &handler, parse_events::production_start ev, iterator pos)
auto get(const nlohmann::detail::iteration_proxy_value< IteratorType > &i) -> decltype(i.key())
typename LEXY_DECAY_DECLTYPE(Operator)::op_tag_type op
constexpr auto begin(const C &c) -> decltype(c.begin())
event_handler(production_info info)
constexpr auto get_result(bool rule_parse_result) &&
void on(_pth &handler, lexy::parse_events::operation_chain_finish, Marker &&marker, iterator)
_pth(Tree &tree, const _detail::any_holder< const Input * > &input, _detail::any_holder< Sink > &sink)
_pth< tree_type, lexy::input_reader< Input > > handler
_vh< Reader >::event_handler _validate
const ErrorCallback * _callback
constexpr auto any
Matches anything and consumes all remaining characters.
decltype(LEXY_DECLVAL(Input).reader()) input_reader
void on(_pth &handler, lexy::parse_events::operation_chain_op, Operation op, iterator)
auto on(_pth &handler, lexy::parse_events::operation_chain_start, iterator)