🚸 improve diagnostics

This commit is contained in:
Niels Lohmann 2020-06-21 13:28:00 +02:00
parent 139a0258cc
commit e22ce45065
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
4 changed files with 43 additions and 2 deletions

View file

@ -865,7 +865,10 @@ class lexer : public lexer_base<BasicJsonType>
{
case std::char_traits<char_type>::eof():
case '\0':
{
error_message = "invalid comment; missing closing '*/'";
return false;
}
case '*':
{
@ -890,7 +893,10 @@ class lexer : public lexer_base<BasicJsonType>
// unexpected character after reading '/'
default:
{
error_message = "invalid comment; expecting '/' or '*' after '/'";
return false;
}
}
}
@ -1504,7 +1510,6 @@ scan_number_done:
{
if (not scan_comment())
{
error_message = "invalid comment";
return token_type::parse_error;
}