nlohmann::detail::parser< BasicJsonType > Class Template Reference

syntax analysis More...

`#include <json.hpp>`

## Public Types

enum | parse_event_t : uint8_t { parse_event_t::object_start, parse_event_t::object_end, parse_event_t::array_start, parse_event_t::array_end, parse_event_t::key, parse_event_t::value }
using | parser_callback_t = std::function< bool(int depth, parse_event_t event, BasicJsonType &parsed)>

## Public Member Functions

| parser (detail::input_adapter_t &&adapter, const parser_callback_t cb=nullptr, const bool allow_exceptions_=true)
| a parser reading from an input adapter More...
void | parse (const bool strict, BasicJsonType &result)
| public parser interface More...
bool | accept (const bool strict=true)
| public accept interface More...
template<typename SAX >
bool | sax_parse (SAX *sax, const bool strict=true)
| 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 More...
void | parse (const bool strict, BasicJsonType &result)
| public parser interface More...
bool | accept (const bool strict=true)
| public accept interface More...
template<typename SAX >
bool | sax_parse (SAX *sax, const bool strict=true)

## Detailed Description

### template<typename BasicJsonType>
class nlohmann::detail::parser< BasicJsonType >

syntax analysis

This class implements a recursive decent parser.

This class implements a recursive descent parser.

## Member Typedef Documentation

## parser_callback_t

template<typename BasicJsonType >

using nlohmann::detail::parser< BasicJsonType >::parser_callback_t = std::function<bool(int depth, parse_event_t event, BasicJsonType& parsed)>

## Member Enumeration Documentation

## parse_event_t

template<typename BasicJsonType >

enum nlohmann::detail::parser::parse_event_t : uint8_t

strong

Enumerator
object_start | the parser read `{` and started to process a JSON object
object_end | the parser read `}` and finished processing a JSON object
array_start | the parser read `[` and started to process a JSON array
array_end | the parser read `]` and finished processing a JSON array
key | the parser read a key of a value in an object
value | the parser finished reading a JSON value

## Constructor & Destructor Documentation

## parser() [1/2]

template<typename BasicJsonType >

nlohmann::detail::parser< BasicJsonType >::parser | ( | detail::input_adapter_t && | adapter,
|  | const parser_callback_t | cb = `nullptr`,
|  | const bool | allow_exceptions_ = `true`
| ) |  |

inlineexplicit

a parser reading from an input adapter

## parser() [2/2]

template<typename BasicJsonType >

nlohmann::detail::parser< BasicJsonType >::parser | ( | InputAdapterType && | adapter,
|  | const parser_callback_t< BasicJsonType > | cb = `nullptr`,
|  | const bool | allow_exceptions_ = `true`,
|  | const bool | skip_comments = `false`
| ) |  |

inlineexplicit

a parser reading from an input adapter

## Member Function Documentation

## accept() [1/2]

template<typename BasicJsonType >

bool nlohmann::detail::parser< BasicJsonType >::accept | ( | const bool | strict = `true` | ) |

inline

public accept interface

Parameters

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

Returns
  whether the input is a proper JSON text

## accept() [2/2]

template<typename BasicJsonType >

bool nlohmann::detail::parser< BasicJsonType >::accept | ( | const bool | strict = `true` | ) |

inline

public accept interface

Parameters

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

Returns
  whether the input is a proper JSON text

## parse() [1/2]

template<typename BasicJsonType >

void nlohmann::detail::parser< BasicJsonType >::parse | ( | const bool | strict,
|  | BasicJsonType & | result
| ) |  |

inline

public parser interface

Parameters

  [in] | strict | whether to expect the last token to be EOF
  [in,out] | result | parsed JSON value

Exceptions

  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

## parse() [2/2]

template<typename BasicJsonType >

void nlohmann::detail::parser< BasicJsonType >::parse | ( | const bool | strict,
|  | BasicJsonType & | result
| ) |  |

inline

public parser interface

Parameters

  [in] | strict | whether to expect the last token to be EOF
  [in,out] | result | parsed JSON value

Exceptions

  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

## sax_parse() [1/2]

template<typename BasicJsonType >
template<typename SAX >

bool nlohmann::detail::parser< BasicJsonType >::sax_parse | ( | SAX * | sax,
|  | const bool | strict = `true`
| ) |  |

inline

## sax_parse() [2/2]

template<typename BasicJsonType >
template<typename SAX >

bool nlohmann::detail::parser< BasicJsonType >::sax_parse | ( | SAX * | sax,
|  | const bool | strict = `true`
| ) |  |

inline

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

- build/_deps/json-src/include/nlohmann/json.hpp