← 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, and a lone ) inside does not end the string. The lone ) sits on the line before the opener on purpose, so a counter that ends the raw string at the first ) meets the opener with nothing open, and the comment it opens runs to the last line. 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. The file ends with a block comment of its own, so the comment opened by mistake has a closer to reach, and a counter that ignores an opener nobody closes cannot pass by accident
| 1 | codecodecodecodecodecodecode | const char *raw = R"(a lone " quote and |
| 2 | codecodecodecodecodecodecode | still inside, and a lone ) is not the end |
| 3 | codecodecodecodecodecodecode | /* this opens nothing, it is inside the raw string |
| 4 | codecodecodecodecodecodecode | )"; |
| 5 | codecodecodecodecodecodecode | printf(")"); |
| 6 | commentscommentscommentscommentscommentscommentscomments | /* a real block comment */ |
stringcommentthe tag around another language
the /* on the third line opens a comment, which the block comment ending the file closes. A /* inside an ordinary string on one line opens one as well, so no string keeps it out
cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2140-raw_string_holding_its_own_closing_bracket/input.cpp
--strip-str-comments
the /* on the third line opens a comment, which the block comment ending the file closes. A /* inside an ordinary string on one line opens one as well, so no string keeps it out
cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2140-raw_string_holding_its_own_closing_bracket/input.cpp --strip-str-comments
the /* on the third line opens a comment, which the block comment ending the file closes. A /* inside an ordinary string on one line opens one as well, so no string keeps it out
cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2140-raw_string_holding_its_own_closing_bracket/input.cpp --docstring-as-code
codestats cases/2000-string_forms/2140-raw_string_holding_its_own_closing_bracket/input.cpp --output json-compact --include-generated --no-gitignore --hidden --no-config
mezura cases/2000-string_forms/2140-raw_string_holding_its_own_closing_bracket/input.cpp --output json --hide timing --no-default-config --no-local --counting content
mezura cases/2000-string_forms/2140-raw_string_holding_its_own_closing_bracket/input.cpp --output json --hide timing --no-default-config --no-local --counting region
scc --format json --no-config 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