ignore comments

This commit is contained in:
Niels Lohmann 2020-06-16 12:28:59 +02:00
parent e7452d8778
commit b53c6e2f81
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
3 changed files with 190 additions and 6 deletions

View file

@ -127,6 +127,8 @@ TEST_CASE("lexer class")
// store scan() result
const auto res = scan_string(s.c_str());
CAPTURE(s);
switch (c)
{
// single characters that are valid tokens
@ -161,6 +163,9 @@ TEST_CASE("lexer class")
break;
}
// case ('/'):
// break;
// anything else is not expected
default:
{
@ -179,4 +184,19 @@ TEST_CASE("lexer class")
s += "\"";
CHECK((scan_string(s.c_str()) == json::lexer::token_type::value_string));
}
// SECTION("ignore comments")
// {
// CHECK((scan_string("/") == json::lexer::token_type::parse_error));
//
// CHECK((scan_string("/!") == json::lexer::token_type::parse_error));
// CHECK((scan_string("/*") == json::lexer::token_type::parse_error));
// CHECK((scan_string("/**") == json::lexer::token_type::parse_error));
//
// CHECK((scan_string("//") == json::lexer::token_type::end_of_input));
// CHECK((scan_string("/**/") == json::lexer::token_type::end_of_input));
// CHECK((scan_string("/** /") == json::lexer::token_type::parse_error));
//
// CHECK((scan_string("/***/") == json::lexer::token_type::end_of_input));
// }
}