BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
nlohmann::detail::parser< BasicJsonType, InputAdapterType > Class Template Reference

syntax analysis More...

#include <json.hpp>

Collaboration diagram for nlohmann::detail::parser< BasicJsonType, InputAdapterType >:

Public Member Functions

*a parser reading from an input adapter parser (InputAdapterType &&adapter, const parser_callback_t< BasicJsonType > cb=nullptr, const bool allow_exceptions_=true, const bool skip_comments=false)
void parse (const bool strict, BasicJsonType &result)
 public parser interface
bool accept (const bool strict=true)
 public accept interface
template<typename SAX>
bool sax_parse (SAX *sax, const bool strict=true)

Private Types

using number_integer_t = typename BasicJsonType::number_integer_t
using number_unsigned_t = typename BasicJsonType::number_unsigned_t
using number_float_t = typename BasicJsonType::number_float_t
using string_t = typename BasicJsonType::string_t
using lexer_t = lexer<BasicJsonType, InputAdapterType>
using token_type = typename lexer_t::token_type

Private Member Functions

template<typename SAX>
bool sax_parse_internal (SAX *sax)
*get next token from lexer token_type get_token ()
std::string exception_message (const token_type expected, const std::string &context)

Private Attributes

*callback function const parser_callback_t< BasicJsonType > callback = nullptr
*the type of the last read token token_type last_token = token_type::uninitialized
*the lexer lexer_t m_lexer
*whether to throw exceptions in case of errors const bool allow_exceptions = true

Detailed Description

template<typename BasicJsonType, typename InputAdapterType>
class nlohmann::detail::parser< BasicJsonType, InputAdapterType >

This class implements a recursive descent parser.

Definition at line 10383 of file json.hpp.

Member Typedef Documentation

◆ lexer_t

template<typename BasicJsonType, typename InputAdapterType>
using nlohmann::detail::parser< BasicJsonType, InputAdapterType >::lexer_t = lexer<BasicJsonType, InputAdapterType>
private

Definition at line 10389 of file json.hpp.

◆ number_float_t

template<typename BasicJsonType, typename InputAdapterType>
using nlohmann::detail::parser< BasicJsonType, InputAdapterType >::number_float_t = typename BasicJsonType::number_float_t
private

Definition at line 10387 of file json.hpp.

◆ number_integer_t

template<typename BasicJsonType, typename InputAdapterType>
using nlohmann::detail::parser< BasicJsonType, InputAdapterType >::number_integer_t = typename BasicJsonType::number_integer_t
private

Definition at line 10385 of file json.hpp.

◆ number_unsigned_t

template<typename BasicJsonType, typename InputAdapterType>
using nlohmann::detail::parser< BasicJsonType, InputAdapterType >::number_unsigned_t = typename BasicJsonType::number_unsigned_t
private

Definition at line 10386 of file json.hpp.

◆ string_t

template<typename BasicJsonType, typename InputAdapterType>
using nlohmann::detail::parser< BasicJsonType, InputAdapterType >::string_t = typename BasicJsonType::string_t
private

Definition at line 10388 of file json.hpp.

◆ token_type

template<typename BasicJsonType, typename InputAdapterType>
using nlohmann::detail::parser< BasicJsonType, InputAdapterType >::token_type = typename lexer_t::token_type
private

Definition at line 10390 of file json.hpp.

Constructor & Destructor Documentation

◆ parser()

template<typename BasicJsonType, typename InputAdapterType>
*a parser reading from an input adapter nlohmann::detail::parser< BasicJsonType, InputAdapterType >::parser ( InputAdapterType && adapter,
const parser_callback_t< BasicJsonType > cb = nullptr,
const bool allow_exceptions_ = true,
const bool skip_comments = false )
inlineexplicit

Definition at line 10394 of file json.hpp.

References allow_exceptions, callback, cb, get_token(), and m_lexer.

Here is the call graph for this function:

Member Function Documentation

◆ accept()

template<typename BasicJsonType, typename InputAdapterType>
bool nlohmann::detail::parser< BasicJsonType, InputAdapterType >::accept ( const bool strict = true)
inline
Parameters
[in]strictwhether to expect the last token to be EOF
Returns
whether the input is a proper JSON text

Definition at line 10469 of file json.hpp.

References sax_parse(), and nlohmann::detail::strict.

Here is the call graph for this function:

◆ exception_message()

template<typename BasicJsonType, typename InputAdapterType>
std::string nlohmann::detail::parser< BasicJsonType, InputAdapterType >::exception_message ( const token_type expected,
const std::string & context )
inlineprivate

Definition at line 10753 of file json.hpp.

References last_token, m_lexer, and nlohmann::detail::lexer_base< BasicJsonType >::token_type_name().

Referenced by parse(), sax_parse(), and sax_parse_internal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_token()

template<typename BasicJsonType, typename InputAdapterType>
*get next token from lexer token_type nlohmann::detail::parser< BasicJsonType, InputAdapterType >::get_token ( )
inlineprivate

Definition at line 10751 of file json.hpp.

References last_token, and m_lexer.

Referenced by parser(), parse(), sax_parse(), and sax_parse_internal().

Here is the caller graph for this function:

◆ parse()

template<typename BasicJsonType, typename InputAdapterType>
void nlohmann::detail::parser< BasicJsonType, InputAdapterType >::parse ( const bool strict,
BasicJsonType & result )
inline
Parameters
[in]strictwhether to expect the last token to be EOF
[in,out]resultparsed JSON value
Exceptions
parse_error.101in case of an unexpected token
parse_error.102if to_unicode fails or surrogate error
parse_error.103if to_unicode fails

Definition at line 10416 of file json.hpp.

References allow_exceptions, nlohmann::BasicJsonType(), callback, nlohmann::detail::parse_error::create(), nlohmann::detail::discarded, exception_message(), get_token(), nlohmann::detail::json_sax_dom_callback_parser< BasicJsonType >::is_errored(), nlohmann::detail::json_sax_dom_parser< BasicJsonType >::is_errored(), m_lexer, nlohmann::detail::json_sax_dom_callback_parser< BasicJsonType >::parse_error(), nlohmann::detail::json_sax_dom_parser< BasicJsonType >::parse_error(), nlohmann::result, sax_parse_internal(), and nlohmann::detail::strict.

Here is the call graph for this function:

◆ sax_parse()

template<typename BasicJsonType, typename InputAdapterType>
template<typename SAX>
bool nlohmann::detail::parser< BasicJsonType, InputAdapterType >::sax_parse ( SAX * sax,
const bool strict = true )
inline

Definition at line 10477 of file json.hpp.

References nlohmann::BasicJsonType(), nlohmann::detail::parse_error::create(), exception_message(), get_token(), m_lexer, nlohmann::result, sax_parse(), sax_parse_internal(), and nlohmann::detail::strict.

Referenced by accept(), and sax_parse().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sax_parse_internal()

template<typename BasicJsonType, typename InputAdapterType>
template<typename SAX>
bool nlohmann::detail::parser< BasicJsonType, InputAdapterType >::sax_parse_internal ( SAX * sax)
inlineprivate

Definition at line 10496 of file json.hpp.

References nlohmann::BasicJsonType(), nlohmann::detail::out_of_range::create(), nlohmann::detail::parse_error::create(), exception_message(), get_token(), JSON_ASSERT, JSON_HEDLEY_LIKELY, JSON_HEDLEY_UNLIKELY, last_token, m_lexer, nlohmann::res, and sax_parse_internal().

Referenced by parse(), sax_parse(), and sax_parse_internal().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ allow_exceptions

template<typename BasicJsonType, typename InputAdapterType>
* whether to throw exceptions in case of errors const bool nlohmann::detail::parser< BasicJsonType, InputAdapterType >::allow_exceptions = true
private

Definition at line 10784 of file json.hpp.

Referenced by parser(), and parse().

◆ callback

template<typename BasicJsonType, typename InputAdapterType>
* callback function const parser_callback_t<BasicJsonType> nlohmann::detail::parser< BasicJsonType, InputAdapterType >::callback = nullptr
private

Definition at line 10778 of file json.hpp.

Referenced by parser(), and parse().

◆ last_token

template<typename BasicJsonType, typename InputAdapterType>
* the type of the last read token token_type nlohmann::detail::parser< BasicJsonType, InputAdapterType >::last_token = token_type::uninitialized
private

Definition at line 10780 of file json.hpp.

Referenced by exception_message(), get_token(), and sax_parse_internal().

◆ m_lexer

template<typename BasicJsonType, typename InputAdapterType>
* the lexer lexer_t nlohmann::detail::parser< BasicJsonType, InputAdapterType >::m_lexer
private

Definition at line 10782 of file json.hpp.

Referenced by parser(), exception_message(), get_token(), parse(), sax_parse(), and sax_parse_internal().


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