← every case · 2000 · string forms

2135-raw_string_holding_a_shorter_closer

a Rust raw string opened with two hashes, r##", holding the one hash closer "# as text. Only a quote followed by as many hashes as the opener carried ends it, so a counter that ends a raw string at the first "# it meets reads the /* after it as a comment opener, and so does one that knows the one hash form alone. 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
1codelet s = r##"a "# /* is not the end"##;
2codelet y = 1;
3comments// a real comment */

stringcommentthe tag around another language

What each tool answered

cloc.default ✗ fails

the /* inside the raw string is read as a comment opener, as it is inside a plain string too, and the */ at the end of the last line closes it, so the line of code between them counts as a comment

the rules ask3 lines · 0 blanks · 2 code · 1 comments
it answers3 lines · 0 blanks · 1 code · 2 comments

cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2135-raw_string_holding_a_shorter_closer/input.rs

cloc.default ✗ fails

--strip-str-comments

Rust has no raw string here, so the quote after the two hashes opens an ordinary string that the quote of "# closes, and the /* after it opens a comment, which the */ at the end of the last line closes

the rules ask3 lines · 0 blanks · 2 code · 1 comments
it answers3 lines · 0 blanks · 1 code · 2 comments

cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2135-raw_string_holding_a_shorter_closer/input.rs --strip-str-comments

cloc.docstring-as-code ✗ fails

the /* inside the raw string is read as a comment opener, as it is inside a plain string too, and the */ at the end of the last line closes it, so the line of code between them counts as a comment

the rules ask3 lines · 0 blanks · 2 code · 1 comments
it answers3 lines · 0 blanks · 1 code · 2 comments

cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2135-raw_string_holding_a_shorter_closer/input.rs --docstring-as-code

codestats.default ✓ agrees
the rules ask3 lines · 0 blanks · 2 code · 1 comments
it answers3 lines · 0 blanks · 2 code · 1 comments

codestats cases/2000-string_forms/2135-raw_string_holding_a_shorter_closer/input.rs --output json-compact --include-generated --no-gitignore --hidden --no-config

mezura.content ✓ agrees
the rules ask3 lines · 2 code · 1 comments · 0 extra
it answers3 lines · 2 code · 1 comments · 0 extra

mezura cases/2000-string_forms/2135-raw_string_holding_a_shorter_closer/input.rs --output json --hide timing --no-default-config --no-local --counting content

mezura.region ✓ agrees
the rules ask3 lines · 0 blanks · 2 code · 1 comments
it answers3 lines · 0 blanks · 2 code · 1 comments

mezura cases/2000-string_forms/2135-raw_string_holding_a_shorter_closer/input.rs --output json --hide timing --no-default-config --no-local --counting region

scc.default ✓ agrees
the rules ask3 lines · 0 blanks · 2 code · 1 comments
it answers3 lines · 0 blanks · 2 code · 1 comments

scc --format json --no-config cases/2000-string_forms/2135-raw_string_holding_a_shorter_closer/input.rs

tokei.default ✓ agrees
the rules ask3 lines · 0 blanks · 2 code · 1 comments
it answers3 lines · 0 blanks · 2 code · 1 comments

tokei --output json cases/2000-string_forms/2135-raw_string_holding_a_shorter_closer/input.rs