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 | |
bool | accept (const bool strict=true) |
public accept interface More... | |
void | parse (const bool strict, BasicJsonType &result) |
public parser interface More... | |
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... | |
Private Types | |
using | lexer_t = lexer< BasicJsonType > |
using | number_float_t = typename BasicJsonType::number_float_t |
using | number_integer_t = typename BasicJsonType::number_integer_t |
using | number_unsigned_t = typename BasicJsonType::number_unsigned_t |
using | string_t = typename BasicJsonType::string_t |
using | token_type = typename lexer_t::token_type |
Private Member Functions | |
bool | accept_internal () |
the actual acceptor More... | |
bool | expect (token_type t) |
token_type | get_token () |
get next token from lexer More... | |
void | parse_internal (bool keep, BasicJsonType &result) |
the actual parser More... | |
void | throw_exception () const |
Private Attributes | |
const bool | allow_exceptions = true |
whether to throw exceptions in case of errors More... | |
const parser_callback_t | callback = nullptr |
callback function More... | |
int | depth = 0 |
current level of recursion More... | |
bool | errored = false |
whether a syntax error occurred More... | |
token_type | expected = token_type::uninitialized |
possible reason for the syntax error More... | |
token_type | last_token = token_type::uninitialized |
the type of the last read token More... | |
lexer_t | m_lexer |
the lexer More... | |
syntax analysis
This class implements a recursive decent parser.
|
private |
|
private |
|
private |
|
private |
using nlohmann::detail::parser< BasicJsonType >::parser_callback_t = std::function<bool(int depth, parse_event_t event, BasicJsonType& parsed)> |
|
private |
|
private |
|
strong |
|
inlineexplicit |
|
inline |
|
inlineprivate |
the actual acceptor
This invariant makes sure that no token needs to be "unput".
|
inlineprivate |
|
inlineprivate |
|
inline |
public parser interface
[in] | strict | whether to expect the last token to be EOF |
[in,out] | result | parsed JSON value |
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 |
|
inlineprivate |
|
inlineprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |