Skip to content

Commit

Permalink
Remove fraction and exp number states
Browse files Browse the repository at this point in the history
  • Loading branch information
danielaparker committed Nov 6, 2024
1 parent 35c05f1 commit 9fd5505
Showing 1 changed file with 12 additions and 46 deletions.
58 changes: 12 additions & 46 deletions include/jsoncons/json_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ enum class json_parse_state : uint8_t
minus,
zero,
integer,
fraction1,
fraction2,
exp1,
exp2,
exp3,
cr,
done
};
Expand Down Expand Up @@ -1355,17 +1350,6 @@ class basic_json_parser : public ser_context
parse_string(visitor, ec);
if (ec) return;
break;
case json_parse_state::minus:
case json_parse_state::zero:
case json_parse_state::integer:
case json_parse_state::fraction1:
case json_parse_state::fraction2:
case json_parse_state::exp1:
case json_parse_state::exp2:
case json_parse_state::exp3:
parse_number(visitor, ec);
if (ec) return;
break;
case json_parse_state::slash:
{
switch (*input_ptr_)
Expand Down Expand Up @@ -1592,16 +1576,6 @@ class basic_json_parser : public ser_context
goto zero;
case json_parse_state::integer:
goto integer;
case json_parse_state::fraction1:
goto fraction1;
case json_parse_state::fraction2:
goto fraction2;
case json_parse_state::exp1:
goto exp1;
case json_parse_state::exp2:
goto exp2;
case json_parse_state::exp3:
goto exp3;
default:
JSONCONS_UNREACHABLE();
}
Expand Down Expand Up @@ -1815,7 +1789,6 @@ class basic_json_parser : public ser_context
err_handler_(json_errc::invalid_number, *this);
ec = json_errc::invalid_number;
more_ = false;
state_ = json_parse_state::fraction1;
return;
}
fraction2:
Expand Down Expand Up @@ -1895,7 +1868,6 @@ class basic_json_parser : public ser_context
err_handler_(json_errc::invalid_number, *this);
ec = json_errc::invalid_number;
more_ = false;
state_ = json_parse_state::fraction2;
return;
}
exp1:
Expand Down Expand Up @@ -1927,7 +1899,6 @@ class basic_json_parser : public ser_context
err_handler_(json_errc::invalid_number, *this);
ec = json_errc::expected_value;
more_ = false;
state_ = json_parse_state::exp1;
return;
}
exp2:
Expand All @@ -1950,7 +1921,6 @@ class basic_json_parser : public ser_context
err_handler_(json_errc::invalid_number, *this);
ec = json_errc::expected_value;
more_ = false;
state_ = json_parse_state::exp2;
return;
}

Expand Down Expand Up @@ -2026,7 +1996,6 @@ class basic_json_parser : public ser_context
err_handler_(json_errc::invalid_number, *this);
ec = json_errc::invalid_number;
more_ = false;
state_ = json_parse_state::exp3;
return;
}

Expand All @@ -2039,8 +2008,19 @@ class basic_json_parser : public ser_context
const char_type* sb = input_ptr_;

string_u1:
while (input_ptr_ < local_input_end)
while (true)
{
if (input_ptr_ == local_input_end)
{
string_buffer_.append(sb,input_ptr_-sb);
position_ += (input_ptr_ - sb);
if (!chunk_rdr_->read_chunk(ec))
{
return;
}
local_input_end = input_end_;
sb = input_ptr_;
}
switch (*input_ptr_)
{
JSONCONS_ILLEGAL_CONTROL_CHARACTER:
Expand Down Expand Up @@ -2139,20 +2119,6 @@ class basic_json_parser : public ser_context
++input_ptr_;
}

// Buffer exhausted

{
string_buffer_.append(sb,input_ptr_-sb);
position_ += (input_ptr_ - sb);
if (!chunk_rdr_->read_chunk(ec))
{
return;
}
local_input_end = input_end_;
sb = input_ptr_;
goto string_u1;
}

escape:
if (JSONCONS_UNLIKELY(input_ptr_ >= local_input_end)) // Buffer exhausted
{
Expand Down

0 comments on commit 9fd5505

Please sign in to comment.