A single slash is interpreted as the potential start of a comment and is ignored even if a full comment couldn't be matched. This causes "/1"_json or R"({"a": ////////"b"})"_json to be parsed without errors, while they aren't valid json.
When a slash is encountered, match_pattern() is called to parse the comment, which will return match_result::unmatched. This result is then ignored in tokenizer::next() and the token will be treated as valid. The single slash will then be treated as a full, valid comment.
The unmatched result should result in a parse error instead.
A single slash is interpreted as the potential start of a comment and is ignored even if a full comment couldn't be matched. This causes
"/1"_json
orR"({"a": ////////"b"})"_json
to be parsed without errors, while they aren't valid json.When a slash is encountered,
match_pattern()
is called to parse the comment, which will returnmatch_result::unmatched
. This result is then ignored intokenizer::next()
and the token will be treated as valid. The single slash will then be treated as a full, valid comment.The
unmatched
result should result in a parse error instead.