← every case · 2000 · string forms

2140-raw_string_holding_its_own_closing_bracket

a C++ raw string, R"( to )", holding a block comment opener on a line of its own. Only the raw pair keeps that opener from starting a comment that never closes, and a lone ) inside does not end the string. The body of the opening line holds one further quote on purpose, so that counting the quotes on that line gives an even number: a counter that only tracks quotes then reaches the comment opener with nothing open, and cannot swallow it by accident and pass without reading the raw string at all

read ascloc.defaultmezura.contentmezura.regionscc.defaulttokei.default
input.cpp
1codeconst char *raw = R"(a lone " quote and
2code/* this opens nothing, it is inside the raw string
3codestill inside, and a lone ) is not the end
4code)";
5codeprintf(")");

stringcommentthe tag around another language

What each tool answered

cloc.default ✓ agrees
the rules ask5 lines · 0 blanks · 5 code · 0 comments
it answers5 lines · 0 blanks · 5 code · 0 comments

cloc --json cases/2000-string_forms/2140-raw_string_holding_its_own_closing_bracket/input.cpp

mezura.content ✓ agrees
the rules ask5 lines · 5 code · 0 comments · 0 extra
it answers5 lines · 5 code · 0 comments · 0 extra

mezura cases/2000-string_forms/2140-raw_string_holding_its_own_closing_bracket/input.cpp --output json --hide timing --counting content

mezura.region ✓ agrees
the rules ask5 lines · 0 blanks · 5 code · 0 comments
it answers5 lines · 0 blanks · 5 code · 0 comments

mezura cases/2000-string_forms/2140-raw_string_holding_its_own_closing_bracket/input.cpp --output json --hide timing --counting region

scc.default ✓ agrees
the rules ask5 lines · 0 blanks · 5 code · 0 comments
it answers5 lines · 0 blanks · 5 code · 0 comments

scc --format json cases/2000-string_forms/2140-raw_string_holding_its_own_closing_bracket/input.cpp

tokei.default ✓ agrees
the rules ask5 lines · 0 blanks · 5 code · 0 comments
it answers5 lines · 0 blanks · 5 code · 0 comments

tokei --output json cases/2000-string_forms/2140-raw_string_holding_its_own_closing_bracket/input.cpp