Free Electron
Public Member Functions | Private Member Functions | Private Attributes | List of all members
YAML::Parser Class Reference

A parser turns a stream of bytes into one stream of "events" per YAML document in the input stream. More...

#include <parser.h>

Public Member Functions

 Parser ()
 Constructs an empty parser (with no input. More...
 
 Parser (const Parser &)=delete
 
 Parser (Parser &&)=delete
 
Parseroperator= (const Parser &)=delete
 
Parseroperator= (Parser &&)=delete
 
 Parser (std::istream &in)
 Constructs a parser from the given input stream. More...
 
 operator bool () const
 Evaluates to true if the parser has some valid input to be read. More...
 
void Load (std::istream &in)
 Resets the parser with the given input stream. More...
 
bool HandleNextDocument (EventHandler &eventHandler)
 Handles the next document by calling events on the. More...
 
void PrintTokens (std::ostream &out)
 

Private Member Functions

void ParseDirectives ()
 Reads any directives that are next in the queue, setting the internal. More...
 
void HandleDirective (const Token &token)
 
void HandleYamlDirective (const Token &token)
 Handles a "YAML" directive, which should be of the form 'major.minor' (like a version number). More...
 
void HandleTagDirective (const Token &token)
 Handles a "TAG" directive, which should be of the form 'handle prefix', where 'handle' is converted to 'prefix' in the file. More...
 

Private Attributes

std::unique_ptr< Scannerm_pScanner
 
std::unique_ptr< Directives > m_pDirectives
 

Detailed Description

A parser turns a stream of bytes into one stream of "events" per YAML document in the input stream.

Constructor & Destructor Documentation

◆ Parser() [1/2]

YAML::Parser::Parser ( )

Constructs an empty parser (with no input.

◆ Parser() [2/2]

YAML::Parser::Parser ( std::istream &  in)
explicit

Constructs a parser from the given input stream.

The input stream must live as long as the parser.

Member Function Documentation

◆ HandleNextDocument()

bool YAML::Parser::HandleNextDocument ( EventHandler &  eventHandler)

Handles the next document by calling events on the.

eventHandler

.

Exceptions
aParserException on error.
Returns
false if there are no more documents

◆ HandleTagDirective()

void YAML::Parser::HandleTagDirective ( const Token &  token)
private

Handles a "TAG" directive, which should be of the form 'handle prefix', where 'handle' is converted to 'prefix' in the file.

◆ HandleYamlDirective()

void YAML::Parser::HandleYamlDirective ( const Token &  token)
private

Handles a "YAML" directive, which should be of the form 'major.minor' (like a version number).

◆ Load()

void YAML::Parser::Load ( std::istream &  in)

Resets the parser with the given input stream.

Any existing state is erased.

◆ operator bool()

YAML::Parser::operator bool ( ) const
explicit

Evaluates to true if the parser has some valid input to be read.

◆ ParseDirectives()

void YAML::Parser::ParseDirectives ( )
private

Reads any directives that are next in the queue, setting the internal.

m_pDirectives

state.


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