← every case · 2000 · string forms
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
| 1 | codecodecodecodecodecodecode | let s = r##"a "# /* is not the end"##; |
| 2 | codecodecodecodecodecodecode | let y = 1; |
| 3 | commentscommentscommentscommentscommentscommentscomments | // a real comment */ |
stringcommentthe tag around another language
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
cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2135-raw_string_holding_a_shorter_closer/input.rs
--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
cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2135-raw_string_holding_a_shorter_closer/input.rs --strip-str-comments
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
cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2135-raw_string_holding_a_shorter_closer/input.rs --docstring-as-code
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 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 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 --format json --no-config cases/2000-string_forms/2135-raw_string_holding_a_shorter_closer/input.rs
tokei --output json cases/2000-string_forms/2135-raw_string_holding_a_shorter_closer/input.rs