♻️ allow to continue after parse error

This commit is contained in:
Niels Lohmann 2024-11-30 13:54:43 +01:00
parent 17b5262e7d
commit 7c97655f59
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
2 changed files with 4 additions and 0 deletions

View File

@ -354,6 +354,7 @@ class parser
} }
break; break;
} }
case token_type::end_of_input: case token_type::end_of_input:
{ {
if (JSON_HEDLEY_UNLIKELY(m_lexer.get_position().chars_read_total == 1)) if (JSON_HEDLEY_UNLIKELY(m_lexer.get_position().chars_read_total == 1))
@ -371,6 +372,7 @@ class parser
m_lexer.get_token_string(), m_lexer.get_token_string(),
parse_error::create(101, m_lexer.get_position(), exception_message(token_type::literal_or_value, "value"), nullptr)); parse_error::create(101, m_lexer.get_position(), exception_message(token_type::literal_or_value, "value"), nullptr));
} }
case token_type::uninitialized: case token_type::uninitialized:
case token_type::end_array: case token_type::end_array:
case token_type::end_object: case token_type::end_object:

View File

@ -12710,6 +12710,7 @@ class parser
} }
break; break;
} }
case token_type::end_of_input: case token_type::end_of_input:
{ {
if (JSON_HEDLEY_UNLIKELY(m_lexer.get_position().chars_read_total == 1)) if (JSON_HEDLEY_UNLIKELY(m_lexer.get_position().chars_read_total == 1))
@ -12727,6 +12728,7 @@ class parser
m_lexer.get_token_string(), m_lexer.get_token_string(),
parse_error::create(101, m_lexer.get_position(), exception_message(token_type::literal_or_value, "value"), nullptr)); parse_error::create(101, m_lexer.get_position(), exception_message(token_type::literal_or_value, "value"), nullptr));
} }
case token_type::uninitialized: case token_type::uninitialized:
case token_type::end_array: case token_type::end_array:
case token_type::end_object: case token_type::end_object: