← 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

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

stringcommentthe tag around another language

What each tool answered

cloc.default ✓ agrees
the rules ask4 lines · 0 blanks · 4 code · 0 comments
it answers4 lines · 0 blanks · 4 code · 0 comments

cloc --json cases/2000-string_forms/2150-delimited_raw_string_names_its_own_closer/input.cpp

mezura.content ✗ fails

the plain R"( is declared and this delimited form is not, so the block opener inside the string opens a comment

the rules ask4 lines · 4 code · 0 comments · 0 extra
it answers4 lines · 1 code · 3 comments · 0 extra

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

mezura.region ✗ fails

the plain R"( is declared and this delimited form is not, so the block opener inside the string opens a comment

the rules ask4 lines · 0 blanks · 4 code · 0 comments
it answers4 lines · 0 blanks · 1 code · 3 comments

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

scc.default ✗ fails

the delimited form is not recognised, so the two quotes on the opening line pair off as an ordinary string and the block opener under them, outside it, opens a comment. Without the lone quote the file comes out right

the rules ask4 lines · 0 blanks · 4 code · 0 comments
it answers4 lines · 0 blanks · 1 code · 3 comments

scc --format json 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 two quotes on the opening line pair off as an ordinary string and the block opener under them, outside it, opens a comment. Without the lone quote the file comes out right

the rules ask4 lines · 0 blanks · 4 code · 0 comments
it answers4 lines · 0 blanks · 1 code · 3 comments

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