← every case · 4000 · a quote that opens nothing

4055-apostrophe_inside_a_comment

an apostrophe inside a comment, in the word don't, two lines above a real character literal. The apostrophe is text there and pairs with nothing, so a counter pairing it with the literal's own quote swallows every line between them. The block comment further down holds it's and carries code after it closes, which is the same trap on one line. The literal holds a double quote, so a counter with no character literal form whose strings run across lines opens a string there and cannot pass this file either. The file ends with a line comment holding */, so a block comment left open by a mistake earlier has a closer to reach whether the counter nests block comments or not, and a counter that ignores an opener nobody closes cannot pass by accident

read ascloc.defaultcloc.docstring-as-codecodestats.defaultmezura.contentmezura.regionscc.defaulttokei.default
input.rs
1comments// don't change the quote below
2comments// the line under this one is code
3codelet c = '"';
4code/* it's fine as it is */ let d = 'x';
5codelet y = 1;
6comments// a real comment
7comments// a second real comment
8comments// a third real comment */

stringcommentthe tag around another language

What each tool answered

cloc.default ✓ agrees
the rules ask8 lines · 0 blanks · 3 code · 5 comments
it answers8 lines · 0 blanks · 3 code · 5 comments

cloc --json --config /tmp/linejudge-empty-file cases/4000-a_quote_that_opens_nothing/4055-apostrophe_inside_a_comment/input.rs

cloc.default ✓ agrees

--strip-str-comments

the rules ask8 lines · 0 blanks · 3 code · 5 comments
it answers8 lines · 0 blanks · 3 code · 5 comments

cloc --json --config /tmp/linejudge-empty-file cases/4000-a_quote_that_opens_nothing/4055-apostrophe_inside_a_comment/input.rs --strip-str-comments

cloc.docstring-as-code ✓ agrees
the rules ask8 lines · 0 blanks · 3 code · 5 comments
it answers8 lines · 0 blanks · 3 code · 5 comments

cloc --json --config /tmp/linejudge-empty-file cases/4000-a_quote_that_opens_nothing/4055-apostrophe_inside_a_comment/input.rs --docstring-as-code

codestats.default ✓ agrees
the rules ask8 lines · 0 blanks · 3 code · 5 comments
it answers8 lines · 0 blanks · 3 code · 5 comments

codestats cases/4000-a_quote_that_opens_nothing/4055-apostrophe_inside_a_comment/input.rs --output json-compact --include-generated --no-gitignore --hidden --no-config

mezura.content ✓ agrees
the rules ask8 lines · 3 code · 5 comments · 0 extra
it answers8 lines · 3 code · 5 comments · 0 extra

mezura cases/4000-a_quote_that_opens_nothing/4055-apostrophe_inside_a_comment/input.rs --output json --hide timing --no-default-config --no-local --counting content

mezura.region ✓ agrees
the rules ask8 lines · 0 blanks · 3 code · 5 comments
it answers8 lines · 0 blanks · 3 code · 5 comments

mezura cases/4000-a_quote_that_opens_nothing/4055-apostrophe_inside_a_comment/input.rs --output json --hide timing --no-default-config --no-local --counting region

scc.default ✗ fails

the double quote inside the character literal '"' opens a string that runs to the end of the file, so the three comment lines at the bottom count as code. With both apostrophes taken out the answer is the same

the rules ask8 lines · 0 blanks · 3 code · 5 comments
it answers8 lines · 0 blanks · 6 code · 2 comments

scc --format json --no-config cases/4000-a_quote_that_opens_nothing/4055-apostrophe_inside_a_comment/input.rs

tokei.default ✗ fails

the double quote inside the character literal '"' opens a string that runs to the end of the file, so the three comment lines at the bottom count as code. With both apostrophes taken out the answer is the same

the rules ask8 lines · 0 blanks · 3 code · 5 comments
it answers8 lines · 0 blanks · 6 code · 2 comments

tokei --output json cases/4000-a_quote_that_opens_nothing/4055-apostrophe_inside_a_comment/input.rs