Crossfire Server, Trunk
|
syntax analysis More...
#include <json.hpp>
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 (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... | |
template<typename SAX > | |
bool | sax_parse (SAX *sax, const bool strict=true) |
Private Types | |
using | lexer_t = lexer< BasicJsonType, InputAdapterType > |
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 | |
std::string | exception_message (const token_type expected, const std::string &context) |
token_type | get_token () |
get next token from lexer More... | |
template<typename SAX > | |
bool | sax_parse_internal (SAX *sax) |
Private Attributes | |
const bool | allow_exceptions = true |
whether to throw exceptions in case of errors More... | |
const parser_callback_t< BasicJsonType > | callback = nullptr |
callback function 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 descent parser.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
inlineexplicit |
a parser reading from an input adapter
Definition at line 10870 of file json.hpp.
References nlohmann::detail::parser< BasicJsonType, InputAdapterType >::get_token().
|
inline |
public accept interface
[in] | strict | whether to expect the last token to be EOF |
Definition at line 10952 of file json.hpp.
References nlohmann::detail::parser< BasicJsonType, InputAdapterType >::sax_parse(), and nlohmann::detail::strict.
|
inlineprivate |
Definition at line 11265 of file json.hpp.
References nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::get_error_message(), nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::get_token_string(), nlohmann::detail::parser< BasicJsonType, InputAdapterType >::last_token, nlohmann::detail::parser< BasicJsonType, InputAdapterType >::m_lexer, and nlohmann::detail::lexer_base< BasicJsonType >::token_type_name().
Referenced by nlohmann::detail::parser< BasicJsonType, InputAdapterType >::parse(), nlohmann::detail::parser< BasicJsonType, InputAdapterType >::sax_parse(), and nlohmann::detail::parser< BasicJsonType, InputAdapterType >::sax_parse_internal().
|
inlineprivate |
get next token from lexer
Definition at line 11260 of file json.hpp.
References nlohmann::detail::parser< BasicJsonType, InputAdapterType >::last_token, nlohmann::detail::parser< BasicJsonType, InputAdapterType >::m_lexer, and nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::scan().
Referenced by nlohmann::detail::parser< BasicJsonType, InputAdapterType >::parse(), nlohmann::detail::parser< BasicJsonType, InputAdapterType >::parser(), nlohmann::detail::parser< BasicJsonType, InputAdapterType >::sax_parse(), and nlohmann::detail::parser< BasicJsonType, InputAdapterType >::sax_parse_internal().
|
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 |
Definition at line 10892 of file json.hpp.
References nlohmann::detail::parser< BasicJsonType, InputAdapterType >::allow_exceptions, nlohmann::detail::parser< BasicJsonType, InputAdapterType >::callback, nlohmann::detail::parse_error::create(), nlohmann::detail::discarded, nlohmann::detail::parser< BasicJsonType, InputAdapterType >::exception_message(), nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::get_position(), nlohmann::detail::parser< BasicJsonType, InputAdapterType >::get_token(), nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::get_token_string(), nlohmann::detail::json_sax_dom_parser< BasicJsonType >::is_errored(), nlohmann::detail::json_sax_dom_callback_parser< BasicJsonType >::is_errored(), nlohmann::detail::parser< BasicJsonType, InputAdapterType >::m_lexer, nlohmann::detail::json_sax_dom_parser< BasicJsonType >::parse_error(), nlohmann::detail::json_sax_dom_callback_parser< BasicJsonType >::parse_error(), rotate-tower::result, nlohmann::detail::parser< BasicJsonType, InputAdapterType >::sax_parse_internal(), and nlohmann::detail::strict.
|
inline |
Definition at line 10960 of file json.hpp.
References nlohmann::detail::parse_error::create(), nlohmann::detail::parser< BasicJsonType, InputAdapterType >::exception_message(), nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::get_position(), nlohmann::detail::parser< BasicJsonType, InputAdapterType >::get_token(), nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::get_token_string(), nlohmann::detail::parser< BasicJsonType, InputAdapterType >::m_lexer, rotate-tower::result, nlohmann::detail::parser< BasicJsonType, InputAdapterType >::sax_parse_internal(), nlohmann::detail::strict, and nlohmann::detail::void().
Referenced by nlohmann::detail::parser< BasicJsonType, InputAdapterType >::accept().
|
inlineprivate |
Definition at line 10979 of file json.hpp.
References nlohmann::detail::parse_error::create(), nlohmann::detail::out_of_range::create(), nlohmann::detail::parser< BasicJsonType, InputAdapterType >::exception_message(), nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::get_number_float(), nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::get_number_integer(), nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::get_number_unsigned(), nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::get_position(), nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::get_string(), nlohmann::detail::parser< BasicJsonType, InputAdapterType >::get_token(), nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::get_token_string(), JSON_ASSERT, JSON_HEDLEY_LIKELY, JSON_HEDLEY_UNLIKELY, nlohmann::detail::parser< BasicJsonType, InputAdapterType >::last_token, nlohmann::detail::parser< BasicJsonType, InputAdapterType >::m_lexer, and altar_valkyrie::res.
Referenced by nlohmann::detail::parser< BasicJsonType, InputAdapterType >::parse(), and nlohmann::detail::parser< BasicJsonType, InputAdapterType >::sax_parse().
|
private |
whether to throw exceptions in case of errors
Definition at line 11302 of file json.hpp.
Referenced by nlohmann::detail::parser< BasicJsonType, InputAdapterType >::parse().
|
private |
callback function
Definition at line 11296 of file json.hpp.
Referenced by nlohmann::detail::parser< BasicJsonType, InputAdapterType >::parse().
|
private |
the type of the last read token
Definition at line 11298 of file json.hpp.
Referenced by nlohmann::detail::parser< BasicJsonType, InputAdapterType >::exception_message(), nlohmann::detail::parser< BasicJsonType, InputAdapterType >::get_token(), and nlohmann::detail::parser< BasicJsonType, InputAdapterType >::sax_parse_internal().
|
private |
the lexer
Definition at line 11300 of file json.hpp.
Referenced by nlohmann::detail::parser< BasicJsonType, InputAdapterType >::exception_message(), nlohmann::detail::parser< BasicJsonType, InputAdapterType >::get_token(), nlohmann::detail::parser< BasicJsonType, InputAdapterType >::parse(), nlohmann::detail::parser< BasicJsonType, InputAdapterType >::sax_parse(), and nlohmann::detail::parser< BasicJsonType, InputAdapterType >::sax_parse_internal().