← every case · 2000 · string forms
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
| 1 | codecodecodecodecodecodecode | var hint = @"Type ""C:\temp\"" |
| 2 | codecodecodecodecodecodecode | // still inside the string |
| 3 | codecodecodecodecodecodecode | // and so is this line |
| 4 | codecodecodecodecodecodecode | "; |
| 5 | commentscommentscommentscommentscommentscommentscomments | // a real comment |
| 6 | codecodecodecodecodecodecode | var x = 1; |
stringcommentthe tag around another language
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
cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2072-verbatim_string_holding_a_doubled_quote/input.cs
--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
cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2072-verbatim_string_holding_a_doubled_quote/input.cs --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
cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2072-verbatim_string_holding_a_doubled_quote/input.cs --docstring-as-code
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 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 cases/2000-string_forms/2072-verbatim_string_holding_a_doubled_quote/input.cs --output json --hide timing --no-default-config --no-local --counting region
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
scc --format json --no-config cases/2000-string_forms/2072-verbatim_string_holding_a_doubled_quote/input.cs
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
tokei --output json cases/2000-string_forms/2072-verbatim_string_holding_a_doubled_quote/input.cs