← every case · 2000 · string forms

2072-verbatim_string_holding_a_doubled_quote

a C# verbatim string writes a quote of its text as two quotes, so "" ends nothing and only a quote standing alone closes it. A counter that ends the string at the first of the two reads the second as a plain string, and in a plain string the backslash before the last pair escapes a quote, so that reader closes on the first line, counts the two lines below as comments, and opens a string at the lone closing quote that swallows the real comment. The backslash is there because a doubled pair alone leaves such a reader inside a string at the end of the line, which is where the truth is too, and the second line inside the string is there because with one line the two mistakes cancel out

read ascloc.defaultcloc.docstring-as-codecodestats.defaultmezura.contentmezura.regionscc.defaulttokei.default
input.cs
1codevar hint = @"Type ""C:\temp\""
2code// still inside the string
3code// and so is this line
4code";
5comments// a real comment
6codevar x = 1;

stringcommentthe tag around another language

What each tool answered

cloc.default ✗ fails

the two // lines inside the verbatim string count as comments, and they do the same when the string holds no doubled quote and no backslash

the rules ask6 lines · 0 blanks · 5 code · 1 comments
it answers6 lines · 0 blanks · 3 code · 3 comments

cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2072-verbatim_string_holding_a_doubled_quote/input.cs

cloc.default ✗ fails

--strip-str-comments

the two // lines inside the verbatim string count as comments, and they do the same when the string holds no doubled quote and no backslash

the rules ask6 lines · 0 blanks · 5 code · 1 comments
it answers6 lines · 0 blanks · 3 code · 3 comments

cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2072-verbatim_string_holding_a_doubled_quote/input.cs --strip-str-comments

cloc.docstring-as-code ✗ fails

the two // lines inside the verbatim string count as comments, and they do the same when the string holds no doubled quote and no backslash

the rules ask6 lines · 0 blanks · 5 code · 1 comments
it answers6 lines · 0 blanks · 3 code · 3 comments

cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2072-verbatim_string_holding_a_doubled_quote/input.cs --docstring-as-code

codestats.default ✓ agrees
the rules ask6 lines · 0 blanks · 5 code · 1 comments
it answers6 lines · 0 blanks · 5 code · 1 comments

codestats cases/2000-string_forms/2072-verbatim_string_holding_a_doubled_quote/input.cs --output json-compact --include-generated --no-gitignore --hidden --no-config

mezura.content ✓ agrees
the rules ask6 lines · 5 code · 1 comments · 0 extra
it answers6 lines · 5 code · 1 comments · 0 extra

mezura cases/2000-string_forms/2072-verbatim_string_holding_a_doubled_quote/input.cs --output json --hide timing --no-default-config --no-local --counting content

mezura.region ✓ agrees
the rules ask6 lines · 0 blanks · 5 code · 1 comments
it answers6 lines · 0 blanks · 5 code · 1 comments

mezura cases/2000-string_forms/2072-verbatim_string_holding_a_doubled_quote/input.cs --output json --hide timing --no-default-config --no-local --counting region

scc.default ✗ fails

the verbatim string ends at the first quote of the first doubled pair, so the two lines below count as comments and the real comment counts as code

the rules ask6 lines · 0 blanks · 5 code · 1 comments
it answers6 lines · 0 blanks · 4 code · 2 comments

scc --format json --no-config cases/2000-string_forms/2072-verbatim_string_holding_a_doubled_quote/input.cs

tokei.default ✗ fails

the verbatim string ends at the first quote of the first doubled pair and the second opens a plain string, in which the backslash escapes the quote after it, so that string closes on the first line, the two lines below count as comments and the lone quote on the fourth line opens a string that runs to the end of the file

the rules ask6 lines · 0 blanks · 5 code · 1 comments
it answers6 lines · 0 blanks · 4 code · 2 comments

tokei --output json cases/2000-string_forms/2072-verbatim_string_holding_a_doubled_quote/input.cs