Template Class parser

Class Documentation

template<typename BasicJsonType, typename InputAdapterType>
class parser

syntax analysis

This class implements a recursive descent parser.

Public Functions

inline explicit parser(InputAdapterType &&adapter, const parser_callback_t<BasicJsonType> cb = nullptr, const bool allow_exceptions_ = true, const bool skip_comments = false)

a parser reading from an input adapter

inline void parse(const bool strict, BasicJsonType &result)

public parser interface

Parameters:
  • strict[in] whether to expect the last token to be EOF

  • result[inout] parsed JSON value

Throws:
  • parse_error.101 – in case of an unexpected token

  • parse_error.102 – if to_unicode fails or surrogate error

  • parse_error.103 – if to_unicode fails

inline bool accept(const bool strict = true)

public accept interface

Parameters:

strict[in] whether to expect the last token to be EOF

Returns:

whether the input is a proper JSON text

template<typename SAX>
inline bool sax_parse(SAX *sax, const bool strict = true)