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

lexical analysis More...

`#include <json.hpp>`

## Public Types

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...
using | token_type = typename lexer_base< BasicJsonType >::token_type

## Public Member Functions

| lexer (detail::input_adapter_t &&adapter)
| lexer (const lexer &)=delete
| lexer (lexer &&)=delete
lexer & | operator= (lexer &)=delete
lexer & | operator= (lexer &&)=delete
| ~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 char * | get_error_message () const noexcept
| return syntax error message More...
bool | skip_bom ()
| skip the UTF-8 byte order mark More...
token_type | scan ()
| lexer (InputAdapterType &&adapter, bool ignore_comments_=false)
| lexer (const lexer &)=delete
| lexer (lexer &&)=default
lexer & | operator= (lexer &)=delete
lexer & | operator= (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 char * | get_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 ()

## Static Public Member Functions

JSON_HEDLEY_RETURNS_NON_NULL static const JSON_HEDLEY_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>
class nlohmann::detail::lexer< BasicJsonType >

lexical analysis

This class organizes the lexical analysis during JSON deserialization.

## Member Typedef Documentation

## token_type

template<typename BasicJsonType >

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

## Member Enumeration Documentation

## token_type

template<typename BasicJsonType >

enum nlohmann::detail::lexer::token_type

strong

token types for the parser

Enumerator
uninitialized | indicating the scanner is uninitialized
literal_true | the `true` literal
literal_false | the `false` literal
literal_null | the `null` literal
value_string | a string – use get_string() for actual value
value_unsigned | an unsigned integer – use get_number_unsigned() for actual value
value_integer | a signed integer – use get_number_integer() for actual value
value_float | an floating point number – use get_number_float() for actual value
begin_array | the character for array begin `[`
begin_object | the character for object begin `{`
end_array | the character for array end `]`
end_object | the character for object end `}`
name_separator | the name separator `:`
value_separator | the value separator `,`
parse_error | indicating a parse error
end_of_input | indicating the end of the input buffer
literal_or_value | a literal or the begin of a value (only for diagnostics)

## Constructor & Destructor Documentation

## lexer() [1/6]

template<typename BasicJsonType >

nlohmann::detail::lexer< BasicJsonType >::lexer | ( | detail::input_adapter_t && | adapter | ) |

inlineexplicit

## lexer() [2/6]

template<typename BasicJsonType >

nlohmann::detail::lexer< BasicJsonType >::lexer | ( | const lexer< BasicJsonType > & |  | ) |

delete

## lexer() [3/6]

template<typename BasicJsonType >

nlohmann::detail::lexer< BasicJsonType >::lexer | ( | lexer< BasicJsonType > && |  | ) |

delete

## ~lexer() [1/2]

template<typename BasicJsonType >

nlohmann::detail::lexer< BasicJsonType >::~lexer | ( |  | ) |

default

## lexer() [4/6]

template<typename BasicJsonType >

nlohmann::detail::lexer< BasicJsonType >::lexer | ( | InputAdapterType && | adapter,
|  | bool | ignore_comments_ = `false`
| ) |  |

inlineexplicit

## lexer() [5/6]

template<typename BasicJsonType >

nlohmann::detail::lexer< BasicJsonType >::lexer | ( | const lexer< BasicJsonType > & |  | ) |

delete

## lexer() [6/6]

template<typename BasicJsonType >

nlohmann::detail::lexer< BasicJsonType >::lexer | ( | lexer< BasicJsonType > && |  | ) |

default

## ~lexer() [2/2]

template<typename BasicJsonType >

nlohmann::detail::lexer< BasicJsonType >::~lexer | ( |  | ) |

default

## Member Function Documentation

## get_error_message() [1/2]

template<typename BasicJsonType >

constexpr const JSON_HEDLEY_RETURNS_NON_NULL char* nlohmann::detail::lexer< BasicJsonType >::get_error_message | ( |  | ) | const

inlineconstexprnoexcept

return syntax error message

## get_error_message() [2/2]

template<typename BasicJsonType >

constexpr const JSON_HEDLEY_RETURNS_NON_NULL char* nlohmann::detail::lexer< BasicJsonType >::get_error_message | ( |  | ) | const

inlineconstexprnoexcept

return syntax error message

## get_number_float() [1/2]

template<typename BasicJsonType >

constexpr number_float_t nlohmann::detail::lexer< BasicJsonType >::get_number_float | ( |  | ) | const

inlineconstexprnoexcept

return floating-point value

## get_number_float() [2/2]

template<typename BasicJsonType >

constexpr number_float_t nlohmann::detail::lexer< BasicJsonType >::get_number_float | ( |  | ) | const

inlineconstexprnoexcept

return floating-point value

## get_number_integer() [1/2]

template<typename BasicJsonType >

constexpr number_integer_t nlohmann::detail::lexer< BasicJsonType >::get_number_integer | ( |  | ) | const

inlineconstexprnoexcept

return integer value

## get_number_integer() [2/2]

template<typename BasicJsonType >

constexpr number_integer_t nlohmann::detail::lexer< BasicJsonType >::get_number_integer | ( |  | ) | const

inlineconstexprnoexcept

return integer value

## get_number_unsigned() [1/2]

template<typename BasicJsonType >

constexpr number_unsigned_t nlohmann::detail::lexer< BasicJsonType >::get_number_unsigned | ( |  | ) | const

inlineconstexprnoexcept

return unsigned integer value

## get_number_unsigned() [2/2]

template<typename BasicJsonType >

constexpr number_unsigned_t nlohmann::detail::lexer< BasicJsonType >::get_number_unsigned | ( |  | ) | const

inlineconstexprnoexcept

return unsigned integer value

## get_position() [1/2]

template<typename BasicJsonType >

constexpr position_t nlohmann::detail::lexer< BasicJsonType >::get_position | ( |  | ) | const

inlineconstexprnoexcept

return position of last read token

## get_position() [2/2]

template<typename BasicJsonType >

constexpr position_t nlohmann::detail::lexer< BasicJsonType >::get_position | ( |  | ) | const

inlineconstexprnoexcept

return position of last read token

## get_string() [1/2]

template<typename BasicJsonType >

string_t& nlohmann::detail::lexer< BasicJsonType >::get_string | ( |  | ) |

inline

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

## get_string() [2/2]

template<typename BasicJsonType >

string_t& nlohmann::detail::lexer< BasicJsonType >::get_string | ( |  | ) |

inline

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

## get_token_string() [1/2]

template<typename BasicJsonType >

std::string nlohmann::detail::lexer< BasicJsonType >::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.

## get_token_string() [2/2]

template<typename BasicJsonType >

std::string nlohmann::detail::lexer< BasicJsonType >::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.

## operator=() [1/4]

template<typename BasicJsonType >

lexer& nlohmann::detail::lexer< BasicJsonType >::operator= | ( | lexer< BasicJsonType > && |  | ) |

default

## operator=() [2/4]

template<typename BasicJsonType >

lexer& nlohmann::detail::lexer< BasicJsonType >::operator= | ( | lexer< BasicJsonType > && |  | ) |

delete

## operator=() [3/4]

template<typename BasicJsonType >

lexer& nlohmann::detail::lexer< BasicJsonType >::operator= | ( | lexer< BasicJsonType > & |  | ) |

delete

## operator=() [4/4]

template<typename BasicJsonType >

lexer& nlohmann::detail::lexer< BasicJsonType >::operator= | ( | lexer< BasicJsonType > & |  | ) |

delete

## scan() [1/2]

template<typename BasicJsonType >

token_type nlohmann::detail::lexer< BasicJsonType >::scan | ( |  | ) |

inline

## scan() [2/2]

template<typename BasicJsonType >

token_type nlohmann::detail::lexer< BasicJsonType >::scan | ( |  | ) |

inline

## skip_bom() [1/2]

template<typename BasicJsonType >

bool nlohmann::detail::lexer< BasicJsonType >::skip_bom | ( |  | ) |

inline

skip the UTF-8 byte order mark

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

## skip_bom() [2/2]

template<typename BasicJsonType >

bool nlohmann::detail::lexer< BasicJsonType >::skip_bom | ( |  | ) |

inline

skip the UTF-8 byte order mark

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

## skip_whitespace()

template<typename BasicJsonType >

void nlohmann::detail::lexer< BasicJsonType >::skip_whitespace | ( |  | ) |

inline

## token_type_name()

template<typename BasicJsonType >

JSON_HEDLEY_RETURNS_NON_NULL static const JSON_HEDLEY_CONST char* nlohmann::detail::lexer< BasicJsonType >::token_type_name | ( | const token_type | t | ) |

inlinestaticnoexcept

return name of values of type token_type (only used for errors)

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

- build/_deps/json-src/include/nlohmann/json.hpp