← every case · 2000 · string forms

2130-raw_string_holding_quotes

a Rust raw string, opened with r#" and closed with "#, so the plain quote written inside it is text and closes nothing. A counter that ends the string at that quote reads the /* after it as a comment opener. 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 a = r#"say "hi /* and stay code"#;
2codelet b = 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/2130-raw_string_holding_quotes/input.rs

cloc.default ✗ fails

--strip-str-comments

Rust has no raw string here, so the string ends at the plain quote inside it and the /* after that quote 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/2130-raw_string_holding_quotes/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/2130-raw_string_holding_quotes/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/2130-raw_string_holding_quotes/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/2130-raw_string_holding_quotes/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/2130-raw_string_holding_quotes/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/2130-raw_string_holding_quotes/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/2130-raw_string_holding_quotes/input.rs