10688 {
10689
10690 std::size_t size{};
10692
10693 if (JSON_HEDLEY_UNLIKELY(!res))
10694 {
10695 return res;
10696 }
10697
10698
10699 std::vector<char> number_vector;
10700
10701 for (std::size_t i = 0; i < size; ++i)
10702 {
10704
10705 if (JSON_HEDLEY_UNLIKELY(!
unexpect_eof(input_format_t::ubjson,
"number")))
10706 {
10707 return false;
10708 }
10709
10710 number_vector.push_back(
static_cast<char>(
current));
10711 }
10712
10713
10714 using ia_type = decltype(detail::input_adapter(number_vector));
10715 auto number_lexer = detail::lexer<BasicJsonType, ia_type>(detail::input_adapter(number_vector), false);
10716 const auto result_number = number_lexer.scan();
10717 const auto number_string = number_lexer.get_token_string();
10718 const auto result_remainder = number_lexer.scan();
10720
10721 if (JSON_HEDLEY_UNLIKELY(result_remainder != token_type::end_of_input))
10722 {
10724 }
10725
10726 switch (result_number)
10727 {
10728 case token_type::value_integer:
10729 return sax->number_integer(number_lexer.get_number_integer());
10730
10731 case token_type::value_unsigned:
10732 return sax->number_unsigned(number_lexer.get_number_unsigned());
10733
10734 case token_type::value_float:
10735 return sax->number_float(number_lexer.get_number_float(), std::move(number_string));
10736
10737 case token_type::uninitialized:
10738 case token_type::literal_true:
10739 case token_type::literal_false:
10740 case token_type::literal_null:
10741 case token_type::value_string:
10742 case token_type::begin_array:
10743 case token_type::begin_object:
10744 case token_type::end_array:
10745 case token_type::end_object:
10746 case token_type::name_separator:
10747 case token_type::value_separator:
10748 case token_type::parse_error:
10749 case token_type::end_of_input:
10750 case token_type::literal_or_value:
10751 default:
10753 }
10754 }
bool unexpect_eof(const input_format_t format, const char *context) const
std::string exception_message(const input_format_t format, const std::string &detail, const std::string &context) const
std::size_t chars_read
the number of characters read
char_int_type current
the current character
json_sax_t * sax
the SAX parser
bool get_ubjson_size_value(std::size_t &result)
char_int_type get()
get next character from the input
token_type
token types for the parser
static parse_error create(int id_, const position_t &pos, const std::string &what_arg, const BasicJsonType &context)
create a parse error exception