← every case · 2000 · string forms
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
| 1 | codecodecodecodecode | const char *raw = R"(a lone " quote and |
| 2 | codecodecodecodecode | /* this opens nothing, it is inside the raw string |
| 3 | codecodecodecodecode | still inside, and a lone ) is not the end |
| 4 | codecodecodecodecode | )"; |
| 5 | codecodecodecodecode | printf(")"); |
stringcommentthe tag around another language
cloc --json cases/2000-string_forms/2140-raw_string_holding_its_own_closing_bracket/input.cpp
mezura cases/2000-string_forms/2140-raw_string_holding_its_own_closing_bracket/input.cpp --output json --hide timing --counting content
mezura cases/2000-string_forms/2140-raw_string_holding_its_own_closing_bracket/input.cpp --output json --hide timing --counting region
scc --format json cases/2000-string_forms/2140-raw_string_holding_its_own_closing_bracket/input.cpp
tokei --output json cases/2000-string_forms/2140-raw_string_holding_its_own_closing_bracket/input.cpp