← every case · 2000 · string forms

2077-interpolation_hole_holding_the_strings_own_quote

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

read ascloc.defaultcloc.docstring-as-codecodestats.defaultmezura.contentmezura.regionscc.defaulttokei.default
input.cs
1codevar row = $@"Name: {(quoted ? '"' : ' ')}
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 string count as comments, and they do the same when the string holds no hole at all

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/2077-interpolation_hole_holding_the_strings_own_quote/input.cs

cloc.default ✗ fails

--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

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/2077-interpolation_hole_holding_the_strings_own_quote/input.cs --strip-str-comments

cloc.docstring-as-code ✗ fails

the two // lines inside the string count as comments, and they do the same when the string holds no hole at all

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/2077-interpolation_hole_holding_the_strings_own_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/2077-interpolation_hole_holding_the_strings_own_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/2077-interpolation_hole_holding_the_strings_own_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/2077-interpolation_hole_holding_the_strings_own_quote/input.cs --output json --hide timing --no-default-config --no-local --counting region

scc.default ✗ fails

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

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

scc --format json --no-config cases/2000-string_forms/2077-interpolation_hole_holding_the_strings_own_quote/input.cs

tokei.default ✗ fails

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

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/2077-interpolation_hole_holding_the_strings_own_quote/input.cs