rapidyaml  0.7.2
parse and emit YAML, and do it fast
c4::yml::EventHandlerYamlStdState Struct Reference

The stack state needed specifically by EventHandlerYamlStd. More...

#include <test_suite_event_handler.hpp>

Inheritance diagram for c4::yml::EventHandlerYamlStdState:
c4::yml::ParserState

Public Member Functions

void start_parse (const char *file, id_type node_id_)
 
void reset_after_push ()
 
void reset_before_pop (ParserState const &to_pop)
 
bool at_line_beginning () const noexcept
 
bool indentation_eq () const noexcept
 
bool indentation_ge () const noexcept
 
bool indentation_gt () const noexcept
 
bool indentation_lt () const noexcept
 

Public Attributes

NodeData ev_data
 
LineContents line_contents
 
Location pos
 
ParserFlag_t flags
 
size_t indref
 the reference indentation in the current block scope More...
 
id_type level
 
id_type node_id
 don't hold a pointer to the node as it will be relocated during tree resizes More...
 
size_t scalar_col
 
bool more_indented
 
bool has_children
 

Detailed Description

The stack state needed specifically by EventHandlerYamlStd.

Definition at line 34 of file test_suite_event_handler.hpp.

Member Function Documentation

◆ start_parse()

void c4::yml::ParserState::start_parse ( const char *  file,
id_type  node_id_ 
)
inlineinherited

Definition at line 143 of file parser_state.hpp.

144  {
145  level = 0;
146  pos.name = to_csubstr(file);
147  pos.offset = 0;
148  pos.line = 1;
149  pos.col = 1;
150  node_id = node_id_;
151  more_indented = false;
152  scalar_col = 0;
153  indref = 0;
154  has_children = false;
155  }
csubstr to_csubstr(substr s) noexcept
neutral version for use in generic code
Definition: substr.hpp:2189
size_t col
column
Definition: common.hpp:302
size_t line
line
Definition: common.hpp:300
size_t offset
number of bytes from the beginning of the source buffer
Definition: common.hpp:298
csubstr name
file name
Definition: common.hpp:304
size_t indref
the reference indentation in the current block scope
id_type node_id
don't hold a pointer to the node as it will be relocated during tree resizes

References c4::yml::Location::col, c4::yml::ParserState::has_children, c4::yml::ParserState::indref, c4::yml::ParserState::level, c4::yml::Location::line, c4::yml::ParserState::more_indented, c4::yml::Location::name, c4::yml::ParserState::node_id, c4::yml::Location::offset, c4::yml::ParserState::pos, c4::yml::ParserState::scalar_col, and c4::to_csubstr().

◆ reset_after_push()

void c4::yml::ParserState::reset_after_push ( )
inlineinherited

Definition at line 157 of file parser_state.hpp.

158  {
159  node_id = NONE;
160  indref = npos;
161  more_indented = false;
162  ++level;
163  has_children = false;
164  }
@ npos
a null string position
Definition: common.hpp:266
@ NONE
an index to none
Definition: common.hpp:259

References c4::yml::ParserState::has_children, c4::yml::ParserState::indref, c4::yml::ParserState::level, c4::yml::ParserState::more_indented, c4::yml::ParserState::node_id, c4::yml::NONE, and c4::yml::npos.

◆ reset_before_pop()

void c4::yml::ParserState::reset_before_pop ( ParserState const &  to_pop)
inlineinherited

Definition at line 166 of file parser_state.hpp.

167  {
168  pos = to_pop.pos;
169  line_contents = to_pop.line_contents;
170  }
LineContents line_contents

References c4::yml::ParserState::line_contents, and c4::yml::ParserState::pos.

◆ at_line_beginning()

bool c4::yml::ParserState::at_line_beginning ( ) const
inlinenoexceptinherited

Definition at line 174 of file parser_state.hpp.

175  {
176  return line_contents.rem.str == line_contents.full.str;
177  }
substr rem
the stripped line remainder; initially starts at the first non-space character
substr full
the full line, including newlines on the right

References c4::yml::LineContents::full, c4::yml::ParserState::line_contents, and c4::yml::LineContents::rem.

◆ indentation_eq()

bool c4::yml::ParserState::indentation_eq ( ) const
inlinenoexceptinherited

Definition at line 178 of file parser_state.hpp.

179  {
180  RYML_ASSERT(indref != npos);
182  }
size_t indentation
the number of spaces on the beginning of the line

References c4::yml::LineContents::indentation, c4::yml::ParserState::indref, c4::yml::ParserState::line_contents, and c4::yml::npos.

◆ indentation_ge()

bool c4::yml::ParserState::indentation_ge ( ) const
inlinenoexceptinherited

◆ indentation_gt()

bool c4::yml::ParserState::indentation_gt ( ) const
inlinenoexceptinherited

◆ indentation_lt()

bool c4::yml::ParserState::indentation_lt ( ) const
inlinenoexceptinherited

Member Data Documentation

◆ ev_data

NodeData c4::yml::EventHandlerYamlStdState::ev_data

Definition at line 36 of file test_suite_event_handler.hpp.

◆ line_contents

◆ pos

Location c4::yml::ParserState::pos
inherited

◆ flags

ParserFlag_t c4::yml::ParserState::flags
inherited

Definition at line 133 of file parser_state.hpp.

◆ indref

◆ level

id_type c4::yml::ParserState::level
inherited

◆ node_id

id_type c4::yml::ParserState::node_id
inherited

don't hold a pointer to the node as it will be relocated during tree resizes

Definition at line 136 of file parser_state.hpp.

Referenced by c4::yml::ParserState::reset_after_push(), and c4::yml::ParserState::start_parse().

◆ scalar_col

size_t c4::yml::ParserState::scalar_col
inherited

Definition at line 137 of file parser_state.hpp.

Referenced by c4::yml::ParserState::start_parse().

◆ more_indented

bool c4::yml::ParserState::more_indented
inherited

◆ has_children

bool c4::yml::ParserState::has_children
inherited

The documentation for this struct was generated from the following file: