Skip to content

Commit

Permalink
🔨 working toward #367
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann committed May 20, 2017
1 parent 8a35fdd commit 16b63d3
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12532,6 +12532,7 @@ class basic_json

if (strict)
{
get_token();
expect(lexer::token_type::end_of_input);
}

Expand Down Expand Up @@ -12593,7 +12594,6 @@ class basic_json
// closing } -> we are done
if (last_token == lexer::token_type::end_object)
{
get_token();
if (keep and callback and not callback(--depth, parse_event_t::object_end, result))
{
result = basic_json(value_t::discarded);
Expand Down Expand Up @@ -12635,6 +12635,7 @@ class basic_json
}

// comma -> next value
get_token();
if (last_token == lexer::token_type::value_separator)
{
get_token();
Expand All @@ -12643,7 +12644,6 @@ class basic_json

// closing }
expect(lexer::token_type::end_object);
get_token();
break;
}

Expand Down Expand Up @@ -12671,7 +12671,6 @@ class basic_json
// closing ] -> we are done
if (last_token == lexer::token_type::end_array)
{
get_token();
if (callback and not callback(--depth, parse_event_t::array_end, result))
{
result = basic_json(value_t::discarded);
Expand All @@ -12690,6 +12689,7 @@ class basic_json
}

// comma -> next value
get_token();
if (last_token == lexer::token_type::value_separator)
{
get_token();
Expand All @@ -12698,7 +12698,6 @@ class basic_json

// closing ]
expect(lexer::token_type::end_array);
get_token();
break;
}

Expand All @@ -12713,46 +12712,40 @@ class basic_json
case lexer::token_type::literal_null:
{
result.m_type = value_t::null;
get_token();
break;
}

case lexer::token_type::value_string:
{
result = basic_json(m_lexer.get_string());
get_token();
break;
}

case lexer::token_type::literal_true:
{
result.m_type = value_t::boolean;
result.m_value = true;
get_token();
break;
}

case lexer::token_type::literal_false:
{
result.m_type = value_t::boolean;
result.m_value = false;
get_token();
break;
}

case lexer::token_type::value_unsigned:
{
result.m_type = value_t::number_unsigned;
result.m_value = m_lexer.get_number_unsigned();
get_token();
break;
}

case lexer::token_type::value_integer:
{
result.m_type = value_t::number_integer;
result.m_value = m_lexer.get_number_integer();
get_token();
break;
}

Expand All @@ -12767,7 +12760,6 @@ class basic_json
JSON_THROW(out_of_range::create(406, "number overflow parsing '" + m_lexer.get_token_string() + "'"));
}

get_token();
break;
}

Expand Down

0 comments on commit 16b63d3

Please sign in to comment.