Goby3  3.1.5a
2024.05.23
detail::lexer< BasicJsonType, InputAdapterType > Class Template Reference

lexical analysis More...

#include <goby/util/thirdparty/nlohmann/json.hpp>

Inheritance diagram for detail::lexer< BasicJsonType, InputAdapterType >:
detail::lexer_base< BasicJsonType >

Public Types

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

Public Member Functions

 lexer (InputAdapterType &&adapter, bool ignore_comments_=false) noexcept
 
 lexer (const lexer &)=delete
 
 lexer (lexer &&)=default
 
lexeroperator= (lexer &)=delete
 
lexeroperator= (lexer &&)=default
 
 ~lexer ()=default
 
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 number_float_t get_number_float () const noexcept
 return floating-point value More...
 
string_t & get_string ()
 return current string value (implicitly resets the token; useful only once) More...
 
constexpr position_t get_position () const noexcept
 return position of last read token More...
 
std::string get_token_string () const
 
constexpr const JSON_HEDLEY_RETURNS_NON_NULL charget_error_message () const noexcept
 return syntax error message More...
 
bool skip_bom ()
 skip the UTF-8 byte order mark More...
 
void skip_whitespace ()
 
token_type scan ()
 

Additional Inherited Members

- Static Public Member Functions inherited from detail::lexer_base< BasicJsonType >
JSON_HEDLEY_RETURNS_NON_NULL static const JSON_HEDLEY_CONST chartoken_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 detail::lexer< BasicJsonType, InputAdapterType >

lexical analysis

This class organizes the lexical analysis during JSON deserialization.

Definition at line 7412 of file json.hpp.

Member Typedef Documentation

◆ token_type

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

Definition at line 7422 of file json.hpp.

Constructor & Destructor Documentation

◆ lexer() [1/3]

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

Definition at line 7424 of file json.hpp.

◆ lexer() [2/3]

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

◆ lexer() [3/3]

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

◆ ~lexer()

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

Member Function Documentation

◆ get_error_message()

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

return syntax error message

Definition at line 8774 of file json.hpp.

◆ get_number_float()

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

return floating-point value

Definition at line 8725 of file json.hpp.

◆ get_number_integer()

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

return integer value

Definition at line 8713 of file json.hpp.

◆ get_number_unsigned()

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

return unsigned integer value

Definition at line 8719 of file json.hpp.

◆ get_position()

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

return position of last read token

Definition at line 8741 of file json.hpp.

◆ get_string()

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

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

Definition at line 8731 of file json.hpp.

◆ get_token_string()

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

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.

Definition at line 8749 of file json.hpp.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ scan()

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

Definition at line 8810 of file json.hpp.

◆ skip_bom()

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

skip the UTF-8 byte order mark

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

Definition at line 8787 of file json.hpp.

◆ skip_whitespace()

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

Definition at line 8801 of file json.hpp.


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