Orcus
Loading...
Searching...
No Matches
Classes | Protected Member Functions | Static Protected Attributes | List of all members
orcus::yaml::parser_base Class Reference
Inheritance diagram for orcus::yaml::parser_base:
orcus::parser_base orcus::yaml_parser< HandlerT >

Classes

struct  key_value
 

Protected Member Functions

 parser_base (const parser_base &)=delete
 
parser_baseoperator= (const parser_base &)=delete
 
 parser_base (std::string_view content)
 
void push_parse_token (detail::parse_token_t t)
 
detail::parse_token_t get_last_parse_token () const
 
size_t offset_last_char_of_line () const
 
size_t parse_indent ()
 
std::string_view parse_to_end_of_line ()
 
void skip_comment ()
 
void reset_on_new_line ()
 
size_t get_scope () const
 
void push_scope (size_t scope_width)
 
void clear_scopes ()
 
detail::scope_t get_scope_type () const
 
void set_scope_type (detail::scope_t type)
 
size_t pop_scope ()
 
void push_line_back (const char *p, size_t n)
 
std::string_view pop_line_front ()
 
bool has_line_buffer () const
 
size_t get_line_buffer_count () const
 
std::string_view merge_line_buffer ()
 
const char * get_doc_hash () const
 
void set_doc_hash (const char *hash)
 
detail::keyword_t parse_keyword (const char *p, size_t len)
 
key_value parse_key_value (const char *p, size_t len)
 
std::string_view parse_single_quoted_string_value (const char *&p, size_t max_length)
 
std::string_view parse_double_quoted_string_value (const char *&p, size_t max_length)
 
void skip_blanks (const char *&p, size_t len)
 
void start_literal_block ()
 
bool in_literal_block () const
 
void handle_line_in_literal (size_t indent)
 
void handle_line_in_multi_line_string ()
 
- Protected Member Functions inherited from orcus::parser_base
 parser_base (const char *p, size_t n)
 
void set_numeric_parser (const numeric_parser_type &func)
 
bool has_char () const
 
bool has_next () const
 
void next (size_t inc=1)
 
void prev (size_t dec=1)
 
char cur_char () const
 
char peek_char (std::size_t offset=1) const
 
std::string_view peek_chars (std::size_t length) const
 
void skip_bom ()
 
void skip (std::string_view chars_to_skip)
 
void skip_space_and_control ()
 
bool parse_expected (std::string_view expected)
 
double parse_double ()
 
size_t remaining_size () const
 
size_t available_size () const
 
std::ptrdiff_t offset () const
 

Static Protected Attributes

static const size_t parse_indent_blank_line
 
static const size_t parse_indent_end_of_stream
 
static const size_t scope_empty
 

Additional Inherited Members

- Protected Types inherited from orcus::parser_base
using numeric_parser_type = std::function< const char *(const char *, const char *, double &)>
 
- Protected Attributes inherited from orcus::parser_base
const char *const mp_begin
 
const char * mp_char
 
const char * mp_end
 

Member Function Documentation

◆ get_doc_hash()

const char * orcus::yaml::parser_base::get_doc_hash ( ) const
protected

Get the hash value of current document, or nullptr if a document has not started.

Returns
hash value of current document.

◆ offset_last_char_of_line()

size_t orcus::yaml::parser_base::offset_last_char_of_line ( ) const
protected

Get the offset position of the last character of the current line without comment or trailing whitespaces (if present). Call this only after the current line has been parsed to the end, that is, only after parse_to_end_of_line() has been called.

Returns
offset position of the last character of the current line.

◆ parse_indent()

size_t orcus::yaml::parser_base::parse_indent ( )
protected

Parse the prefix indent part of a line.

Returns
number of whitespace characters encountered.

◆ parse_to_end_of_line()

std::string_view orcus::yaml::parser_base::parse_to_end_of_line ( )
protected

Once a non-whitespace character is reached, parse until the end of the line.

◆ pop_scope()

size_t orcus::yaml::parser_base::pop_scope ( )
protected

Pop the current scope and return the new scope width after the pop.

Returns
new scope width after the pop.

◆ set_doc_hash()

void orcus::yaml::parser_base::set_doc_hash ( const char *  hash)
protected

Set the hash value representing the current document. For now the memory address of the first character of the document is used as its hash value.

Parameters
hashhash value of a document.

◆ skip_comment()

void orcus::yaml::parser_base::skip_comment ( )
protected

Upon encountering a '#', skip until either the line-feed or the end-of-stream is reached.