![]() |
TerraForge3D
2.3.1
3D Terrain And Landscape Generator
|
lexical analysis More...
#include <json.hpp>
Public Types | |
using | token_type = typename lexer_base< BasicJsonType >::token_type |
![]() | |
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 | |
lexer (InputAdapterType &&adapter, bool ignore_comments_=false) noexcept | |
lexer (const lexer &)=delete | |
lexer (lexer &&)=default | |
lexer & | operator= (lexer &)=delete |
lexer & | operator= (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 |
return the last read token (for errors only). More... | |
JSON_HEDLEY_RETURNS_NON_NULL constexpr const 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 () |
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 | char_type = typename InputAdapterType::char_type |
using | char_int_type = typename std::char_traits< char_type >::int_type |
Private Member Functions | |
int | get_codepoint () |
get codepoint from 4 hex characters following \u More... | |
bool | next_byte_in_range (std::initializer_list< char_int_type > ranges) |
check if the next byte(s) are inside a given range More... | |
token_type | scan_string () |
scan a string literal More... | |
bool | scan_comment () |
scan a comment More... | |
token_type | scan_number () |
scan a number literal More... | |
token_type | scan_literal (const char_type *literal_text, const std::size_t length, token_type return_type) |
void | reset () noexcept |
reset token_buffer; current character is beginning of token More... | |
char_int_type | get () |
void | unget () |
unget current character (read it again on next get) More... | |
void | add (char_int_type c) |
add a character to token_buffer More... | |
Static Private Member Functions | |
static JSON_HEDLEY_PURE char | get_decimal_point () noexcept |
return the locale-dependent decimal point More... | |
static void | strtof (float &f, const char *str, char **endptr) noexcept |
static void | strtof (double &f, const char *str, char **endptr) noexcept |
static void | strtof (long double &f, const char *str, char **endptr) noexcept |
Private Attributes | |
InputAdapterType | ia |
input adapter More... | |
const bool | ignore_comments = false |
whether comments should be ignored (true) or signaled as errors (false) More... | |
char_int_type | current = std::char_traits<char_type>::eof() |
the current character More... | |
bool | next_unget = false |
whether the next get() call should just return current More... | |
position_t | position {} |
the start position of the current token More... | |
std::vector< char_type > | token_string {} |
raw input token string (for error messages) More... | |
string_t | token_buffer {} |
buffer for variable-length tokens (numbers, strings) More... | |
const char * | error_message = "" |
a description of occurred lexer errors More... | |
number_integer_t | value_integer = 0 |
number_unsigned_t | value_unsigned = 0 |
number_float_t | value_float = 0 |
const char_int_type | decimal_point_char = '.' |
the decimal point More... | |
Additional Inherited Members | |
![]() | |
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... | |
lexical analysis
This class organizes the lexical analysis during JSON deserialization.