1 #ifndef _C4_YML_EVENT_HANDLER_STACK_HPP_
2 #define _C4_YML_EVENT_HANDLER_STACK_HPP_
4 #ifndef _C4_YML_DETAIL_STACK_HPP_
5 #include "c4/yml/detail/stack.hpp"
8 #ifndef _C4_YML_NODE_TYPE_HPP_
12 #ifndef _C4_YML_DETAIL_DBGPRINT_HPP_
13 #include "c4/yml/detail/dbgprint.hpp"
16 #ifndef _C4_YML_PARSER_STATE_HPP_
21 #ifndef _C4_YML_DETAIL_PRINT_HPP_
22 #include "c4/yml/detail/print.hpp"
36 template<
class HandlerImpl,
class HandlerState>
39 static_assert(std::is_base_of<ParserState, HandlerState>::value,
40 "ParserState must be a base of HandlerState");
93 m_curr->reset_after_push();
106 _c4dbgpf(
"popped! top is now node={} (parent={})",
m_curr->node_id,
m_parent->node_id);
108 _c4dbgpf(
"popped! top is now node={} @ ROOT",
m_curr->node_id);
115 #define _has_any_(bits) (static_cast<HandlerImpl const* C4_RESTRICT>(this)->template _has_any__<bits>())
123 const bool is_root = (
m_stack.size() == 1u);
129 const bool is_root = (
m_stack.size() == 1u);
@ MAP
a map: a parent of KEYVAL/KEYSEQ/KEYMAP nodes
@ VAL
a scalar: has a scalar (ie string) value, possibly empty. must be a leaf node, and cannot be MAP or S...
@ SEQ
a seq: a parent of VAL/SEQ/MAP nodes
(Undefined by default) Use shorter error message from checks/asserts: do not show the check condition...
A c-style callbacks class to customize behavior on errors or allocation.
Use this class a base of implementations of event handler to simplify the stack logic.
void _stack_finish_parse()
void _stack_reset_non_root()
state * m_curr
current stack level: top of the stack. cached here for easier access.
bool _stack_should_push_on_begin_doc() const
EventHandlerStack(Callbacks const &cb)
void _stack_start_parse(const char *filename, substr ymlsrc)
detail::stack< state > m_stack
state * m_parent
parent of the current stack level.
bool _stack_should_pop_on_end_doc() const