← every case · 2000 · string forms

2150-delimited_raw_string_names_its_own_closer

a C++ raw string that puts a word of its own between the R" and the bracket, and then ends only at that same word. The closer is chosen where the string is written, so no fixed list of symbols can say what ends this one. Its first line holds )", the closer of the plain form, so a counter that ends every raw string at the first )" closes this one there and reads the block opener on the next line as a comment. A lone quote earlier on that line keeps the count of quotes even, so a counter that only pairs quotes reaches the block opener with nothing open as well. 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

read ascloc.defaultcloc.docstring-as-codecodestats.defaultmezura.contentmezura.regionscc.defaulttokei.default
input.cpp
1codeconst char *raw = R"xy(a lone " then ")" in it
2code/* this opens nothing, it is inside the raw string
3code)xy";
4codeprintf("done");
5comments/* a real comment */

stringcommentthe tag around another language

What each tool answered

cloc.default ✗ fails

the /* on the second 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

the rules ask5 lines · 0 blanks · 4 code · 1 comments
it answers5 lines · 0 blanks · 1 code · 4 comments

cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2150-delimited_raw_string_names_its_own_closer/input.cpp

cloc.default ✗ fails

--strip-str-comments

the /* on the second 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

the rules ask5 lines · 0 blanks · 4 code · 1 comments
it answers5 lines · 0 blanks · 1 code · 4 comments

cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2150-delimited_raw_string_names_its_own_closer/input.cpp --strip-str-comments

cloc.docstring-as-code ✗ fails

the /* on the second 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

the rules ask5 lines · 0 blanks · 4 code · 1 comments
it answers5 lines · 0 blanks · 1 code · 4 comments

cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2150-delimited_raw_string_names_its_own_closer/input.cpp --docstring-as-code

codestats.default ✓ agrees
the rules ask5 lines · 0 blanks · 4 code · 1 comments
it answers5 lines · 0 blanks · 4 code · 1 comments

codestats cases/2000-string_forms/2150-delimited_raw_string_names_its_own_closer/input.cpp --output json-compact --include-generated --no-gitignore --hidden --no-config

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

mezura cases/2000-string_forms/2150-delimited_raw_string_names_its_own_closer/input.cpp --output json --hide timing --no-default-config --no-local --counting content

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

mezura cases/2000-string_forms/2150-delimited_raw_string_names_its_own_closer/input.cpp --output json --hide timing --no-default-config --no-local --counting region

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

scc --format json --no-config cases/2000-string_forms/2150-delimited_raw_string_names_its_own_closer/input.cpp

tokei.default ✗ fails

the delimited form is not recognised, so the four quotes of the opening line pair off as ordinary strings and the block opener under them opens a comment, which the block comment ending the file closes

the rules ask5 lines · 0 blanks · 4 code · 1 comments
it answers5 lines · 0 blanks · 1 code · 4 comments

tokei --output json cases/2000-string_forms/2150-delimited_raw_string_names_its_own_closer/input.cpp