Awali
Another Weighted Automata library
Data Structures | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
awali::json::parser_t Class Reference

#include <parser.hh>

Data Structures

struct  position_t
 

Public Member Functions

 parser_t (std::istream &i, bool only_metadata=false)
 
bool error ()
 
std::string error_message ()
 
std::list< uint_or_string_tmove_error_path ()
 
node_tparse_node ()
 
position_t position ()
 

Static Public Member Functions

static std::string const & escape (char)
 
static std::string escape (std::string const &)
 
static std::ostream & escape_and_put (std::ostream &, std::string const &)
 
static std::string unescape (std::string const &, bool quote=false)
 

Protected Member Functions

bool check (char e, std::string const &oth="", std::unordered_map< char, std::string > const &names_override={})
 
bool check (char e, std::unordered_map< char, std::string > const &names_override)
 
std::string extract_and_unescape_string (bool quote=true)
 
int get (bool ignore_spaces=true)
 
node_tparse_array ()
 
node_tparse_constant (std::string const &)
 
node_tparse_number ()
 
node_tparse_object ()
 
node_tparse_string ()
 
int peek (bool ignore_spaces=true)
 
position_t position_of (int pos)
 
void reset_lookahead ()
 
void unget (int c)
 

Protected Attributes

int _current_char = none
 
bool _error
 Whether on error occured. More...
 
std::stringstream _error_message
 Error message if on error occured. More...
 
std::list< uint_or_string_t_error_path
 Attempt to give localisation of parsing error (only set if an error occured). More...
 
std::istream & _in
 
bool _only_metadata
 

Static Protected Attributes

static std::string const false_repr
 
static int const none = -3455678
 
static std::string const null_repr
 
static std::string const true_repr
 

Constructor & Destructor Documentation

◆ parser_t()

awali::json::parser_t::parser_t ( std::istream &  i,
bool  only_metadata = false 
)

Member Function Documentation

◆ check() [1/2]

bool awali::json::parser_t::check ( char  e,
std::string const &  oth = "",
std::unordered_map< char, std::string > const &  names_override = {} 
)
protected

◆ check() [2/2]

bool awali::json::parser_t::check ( char  e,
std::unordered_map< char, std::string > const &  names_override 
)
protected

◆ error()

bool awali::json::parser_t::error ( )

◆ error_message()

std::string awali::json::parser_t::error_message ( )

◆ escape() [1/2]

static std::string const& awali::json::parser_t::escape ( char  )
static

◆ escape() [2/2]

static std::string awali::json::parser_t::escape ( std::string const &  )
static

◆ escape_and_put()

static std::ostream& awali::json::parser_t::escape_and_put ( std::ostream &  ,
std::string const &   
)
static

◆ extract_and_unescape_string()

std::string awali::json::parser_t::extract_and_unescape_string ( bool  quote = true)
protected

◆ get()

int awali::json::parser_t::get ( bool  ignore_spaces = true)
protected

◆ move_error_path()

std::list<uint_or_string_t> awali::json::parser_t::move_error_path ( )

◆ parse_array()

node_t* awali::json::parser_t::parse_array ( )
protected

◆ parse_constant()

node_t* awali::json::parser_t::parse_constant ( std::string const &  )
protected

◆ parse_node()

node_t* awali::json::parser_t::parse_node ( )

◆ parse_number()

node_t* awali::json::parser_t::parse_number ( )
protected

◆ parse_object()

node_t* awali::json::parser_t::parse_object ( )
protected

◆ parse_string()

node_t* awali::json::parser_t::parse_string ( )
protected

◆ peek()

int awali::json::parser_t::peek ( bool  ignore_spaces = true)
protected

◆ position()

position_t awali::json::parser_t::position ( )

◆ position_of()

position_t awali::json::parser_t::position_of ( int  pos)
protected

◆ reset_lookahead()

void awali::json::parser_t::reset_lookahead ( )
protected

◆ unescape()

static std::string awali::json::parser_t::unescape ( std::string const &  ,
bool  quote = false 
)
static

◆ unget()

void awali::json::parser_t::unget ( int  c)
protected

Field Documentation

◆ _current_char

int awali::json::parser_t::_current_char = none
protected

◆ _error

bool awali::json::parser_t::_error
protected

Whether on error occured.

◆ _error_message

std::stringstream awali::json::parser_t::_error_message
protected

Error message if on error occured.

◆ _error_path

std::list<uint_or_string_t> awali::json::parser_t::_error_path
protected

Attempt to give localisation of parsing error (only set if an error occured).

◆ _in

std::istream& awali::json::parser_t::_in
protected

◆ _only_metadata

bool awali::json::parser_t::_only_metadata
protected

◆ false_repr

std::string const awali::json::parser_t::false_repr
staticprotected

◆ none

int const awali::json::parser_t::none = -3455678
staticprotected

◆ null_repr

std::string const awali::json::parser_t::null_repr
staticprotected

◆ true_repr

std::string const awali::json::parser_t::true_repr
staticprotected

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