nlohmann::detail::lexer< BasicJsonType, InputAdapterType > Class Template Reference

lexical analysis More...

#include <json.hpp>

Public Types

using token_type = typename lexer_base< BasicJsonType >::token_type
 
- Public Types inherited from nlohmann::detail::lexer_base< BasicJsonType >
enum class  token_type {
  uninitialized , literal_true , literal_false , literal_null ,
  value_string , value_unsigned , value_integer , value_float ,
  begin_array , begin_object , end_array , end_object ,
  name_separator , value_separator , parse_error , end_of_input ,
  literal_or_value
}
 token types for the parser More...
 

Public Member Functions

JSON_HEDLEY_RETURNS_NON_NULL constexpr const char * get_error_message () const noexcept
 return syntax error message More...
 
constexpr number_float_t get_number_float () const noexcept
 return floating-point value More...
 
constexpr number_integer_t get_number_integer () const noexcept
 return integer value More...
 
constexpr number_unsigned_t get_number_unsigned () const noexcept
 return unsigned integer value More...
 
constexpr position_t get_position () const noexcept
 return position of last read token More...
 
string_t & get_string ()
 return current string value (implicitly resets the token; useful only once) More...
 
std::string get_token_string () const
 return the last read token (for errors only). More...
 
 lexer (const lexer &)=delete
 
 lexer (InputAdapterType &&adapter, bool ignore_comments_=false)
 
 lexer (lexer &&)=default
 
lexeroperator= (lexer &&)=default
 
lexeroperator= (lexer &)=delete
 
token_type scan ()
 
bool skip_bom ()
 skip the UTF-8 byte order mark More...
 
void skip_whitespace ()
 
 ~lexer ()=default
 

Additional Inherited Members

- Static Public Member Functions inherited from nlohmann::detail::lexer_base< BasicJsonType >
JSON_HEDLEY_RETURNS_NON_NULL static JSON_HEDLEY_CONST const char * token_type_name (const token_type t) noexcept
 return name of values of type token_type (only used for errors) More...
 

Detailed Description

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

lexical analysis

This class organizes the lexical analysis during JSON deserialization.

Member Typedef Documentation

◆ token_type

template<typename BasicJsonType , typename InputAdapterType >
using nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::token_type = typename lexer_base<BasicJsonType>::token_type

Constructor & Destructor Documentation

◆ lexer() [1/3]

template<typename BasicJsonType , typename InputAdapterType >
nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::lexer ( InputAdapterType &&  adapter,
bool  ignore_comments_ = false 
)
explicit

◆ lexer() [2/3]

template<typename BasicJsonType , typename InputAdapterType >
nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::lexer ( const lexer< BasicJsonType, InputAdapterType > &  )
delete

◆ lexer() [3/3]

template<typename BasicJsonType , typename InputAdapterType >
nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::lexer ( lexer< BasicJsonType, InputAdapterType > &&  )
default

◆ ~lexer()

template<typename BasicJsonType , typename InputAdapterType >
nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::~lexer ( )
default

Member Function Documentation

◆ get_error_message()

template<typename BasicJsonType , typename InputAdapterType >
JSON_HEDLEY_RETURNS_NON_NULL constexpr const char * nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::get_error_message ( ) const
constexprnoexcept

return syntax error message

◆ get_number_float()

template<typename BasicJsonType , typename InputAdapterType >
constexpr number_float_t nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::get_number_float ( ) const
constexprnoexcept

return floating-point value

◆ get_number_integer()

template<typename BasicJsonType , typename InputAdapterType >
constexpr number_integer_t nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::get_number_integer ( ) const
constexprnoexcept

return integer value

◆ get_number_unsigned()

template<typename BasicJsonType , typename InputAdapterType >
constexpr number_unsigned_t nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::get_number_unsigned ( ) const
constexprnoexcept

return unsigned integer value

◆ get_position()

template<typename BasicJsonType , typename InputAdapterType >
constexpr position_t nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::get_position ( ) const
constexprnoexcept

return position of last read token

◆ get_string()

template<typename BasicJsonType , typename InputAdapterType >
string_t & nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::get_string ( )

return current string value (implicitly resets the token; useful only once)

◆ get_token_string()

template<typename BasicJsonType , typename InputAdapterType >
std::string nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::get_token_string ( ) const

return the last read token (for errors only).

Will never contain EOF (an arbitrary value that is not a valid char value, often -1), because 255 may legitimately occur. May contain NUL, which should be escaped.

◆ operator=() [1/2]

template<typename BasicJsonType , typename InputAdapterType >
lexer & nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::operator= ( lexer< BasicJsonType, InputAdapterType > &&  )
default

◆ operator=() [2/2]

template<typename BasicJsonType , typename InputAdapterType >
lexer & nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::operator= ( lexer< BasicJsonType, InputAdapterType > &  )
delete

◆ scan()

template<typename BasicJsonType , typename InputAdapterType >
token_type nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::scan ( )

◆ skip_bom()

template<typename BasicJsonType , typename InputAdapterType >
bool nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::skip_bom ( )

skip the UTF-8 byte order mark

Returns
true iff there is no BOM or the correct BOM has been skipped

References nlohmann::detail::get().

◆ skip_whitespace()

template<typename BasicJsonType , typename InputAdapterType >
void nlohmann::detail::lexer< BasicJsonType, InputAdapterType >::skip_whitespace ( )

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