← every case · 4000 · a quote that opens nothing

4020-two_char_literals_holding_escapes

two character literals on one line, one holding an escaped backslash and one holding a quote. Ordinary Rust that any escaping routine is written with, nothing contrived for this suite. The comment after them opens a block, so a counter that is left inside a string at the end of the line hides the opener whether its strings end with the line or run on

read ascloc.defaultcloc.docstring-as-codecodestats.defaultmezura.contentmezura.regionscc.defaulttokei.default
input.rs
1codefn js_escape(s: &str) -> String {
2code s.replace('\\', "\\\\").replace('"', "\\\"") /* backslashes first,
3comments then quotes */
4code}
5comments// one
6comments// two
7comments// three

stringcommentthe tag around another language

What each tool answered

cloc.default ✓ agrees
the rules ask7 lines · 0 blanks · 3 code · 4 comments
it answers7 lines · 0 blanks · 3 code · 4 comments

cloc --json --config /tmp/linejudge-empty-file cases/4000-a_quote_that_opens_nothing/4020-two_char_literals_holding_escapes/input.rs

cloc.default ✓ agrees

--strip-str-comments

the rules ask7 lines · 0 blanks · 3 code · 4 comments
it answers7 lines · 0 blanks · 3 code · 4 comments

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

cloc.docstring-as-code ✓ agrees
the rules ask7 lines · 0 blanks · 3 code · 4 comments
it answers7 lines · 0 blanks · 3 code · 4 comments

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

codestats.default ✓ agrees
the rules ask7 lines · 0 blanks · 3 code · 4 comments
it answers7 lines · 0 blanks · 3 code · 4 comments

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

mezura.content ✓ agrees
the rules ask7 lines · 2 code · 4 comments · 1 extra
it answers7 lines · 2 code · 4 comments · 1 extra

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

mezura.region ✓ agrees
the rules ask7 lines · 0 blanks · 3 code · 4 comments
it answers7 lines · 0 blanks · 3 code · 4 comments

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

scc.default ✗ fails

the quote inside '"' opens a string that is still open when the line ends, so the comment after it and every comment under it count as code. Without that character literal the line reads right

the rules ask7 lines · 0 blanks · 3 code · 4 comments
it answers7 lines · 0 blanks · 7 code · 0 comments

scc --format json --no-config cases/4000-a_quote_that_opens_nothing/4020-two_char_literals_holding_escapes/input.rs

tokei.default ✗ fails

the quote inside '"' opens a string that is still open when the line ends, so the comment after it and every comment under it count as code. Without that character literal the line reads right

the rules ask7 lines · 0 blanks · 3 code · 4 comments
it answers7 lines · 0 blanks · 7 code · 0 comments

tokei --output json cases/4000-a_quote_that_opens_nothing/4020-two_char_literals_holding_escapes/input.rs