← every case · 2000 · string forms
an interpolated C# string runs code between { and }, and that code may hold the string's own closing quote, here inside the character '"'. The quote belongs to the code and ends nothing, so the string still runs across the lines below the hole. A counter that reads the string as text from end to end closes it at that quote, and the two lines below come out as comments
| 1 | codecodecodecodecodecodecode | var row = $@"Name: {(quoted ? '"' : ' ')} |
| 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 string count as comments, and they do the same when the string holds no hole at all
cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2077-interpolation_hole_holding_the_strings_own_quote/input.cs
--strip-str-comments
the two // lines inside the string count as comments, and they do the same when the string holds no hole at all
cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2077-interpolation_hole_holding_the_strings_own_quote/input.cs --strip-str-comments
the two // lines inside the string count as comments, and they do the same when the string holds no hole at all
cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2077-interpolation_hole_holding_the_strings_own_quote/input.cs --docstring-as-code
codestats cases/2000-string_forms/2077-interpolation_hole_holding_the_strings_own_quote/input.cs --output json-compact --include-generated --no-gitignore --hidden --no-config
mezura cases/2000-string_forms/2077-interpolation_hole_holding_the_strings_own_quote/input.cs --output json --hide timing --no-default-config --no-local --counting content
mezura cases/2000-string_forms/2077-interpolation_hole_holding_the_strings_own_quote/input.cs --output json --hide timing --no-default-config --no-local --counting region
the quote of the character in the hole ends the string, and the apostrophes after it are read as quotes that cross lines. Three of them leave one open, which keeps the two lines below inside a string by chance and swallows the real comment under the closing quote
scc --format json --no-config cases/2000-string_forms/2077-interpolation_hole_holding_the_strings_own_quote/input.cs
the quote of the character in the hole ends the string, so the two lines below count as comments, and the real closing quote then opens a string that takes the real comment under it as code
tokei --output json cases/2000-string_forms/2077-interpolation_hole_holding_the_strings_own_quote/input.cs