← every case · 1000 · comments

1215-nesting_openers_sharing_bytes_with_closers

Rust block comments nest, and on /*/*/ the two openers take the first four bytes. Each */ that seems to sit on that line shares a byte with one of them and closes nothing, so the comment is two levels deep when the line ends and needs both closers below. A counter that does not nest, or that nests but reads a closer out of bytes an opener already took, closes everything on the first line

read ascloc.defaultcloc.docstring-as-codecodestats.defaultmezura.contentmezura.regionscc.defaulttokei.default
input.rs
1comments/*/*/
2comments*/
3commentslet x = 1;
4comments*/
5codelet y = 2;

stringcommentthe tag around another language

What each tool answered

cloc.default ✗ fails

the */ ending the first line closes the comment although Rust's pair nests, so the lines under it up to and including the second closer are left as code

the rules ask5 lines · 0 blanks · 1 code · 4 comments
it answers5 lines · 0 blanks · 4 code · 1 comments

cloc --json --config /tmp/linejudge-empty-file cases/1000-comments/1215-nesting_openers_sharing_bytes_with_closers/input.rs

cloc.default ✗ fails

--strip-str-comments

the */ ending the first line closes the comment although Rust's pair nests, so the lines under it up to and including the second closer are left as code

the rules ask5 lines · 0 blanks · 1 code · 4 comments
it answers5 lines · 0 blanks · 4 code · 1 comments

cloc --json --config /tmp/linejudge-empty-file cases/1000-comments/1215-nesting_openers_sharing_bytes_with_closers/input.rs --strip-str-comments

cloc.docstring-as-code ✗ fails

the */ ending the first line closes the comment although Rust's pair nests, so the lines under it up to and including the second closer are left as code

the rules ask5 lines · 0 blanks · 1 code · 4 comments
it answers5 lines · 0 blanks · 4 code · 1 comments

cloc --json --config /tmp/linejudge-empty-file cases/1000-comments/1215-nesting_openers_sharing_bytes_with_closers/input.rs --docstring-as-code

codestats.default ✓ agrees
the rules ask5 lines · 0 blanks · 1 code · 4 comments
it answers5 lines · 0 blanks · 1 code · 4 comments

codestats cases/1000-comments/1215-nesting_openers_sharing_bytes_with_closers/input.rs --output json-compact --include-generated --no-gitignore --hidden --no-config

mezura.content ✓ agrees
the rules ask5 lines · 1 code · 1 comments · 3 extra
it answers5 lines · 1 code · 1 comments · 3 extra

mezura cases/1000-comments/1215-nesting_openers_sharing_bytes_with_closers/input.rs --output json --hide timing --no-default-config --no-local --counting content

mezura.region ✓ agrees
the rules ask5 lines · 0 blanks · 1 code · 4 comments
it answers5 lines · 0 blanks · 1 code · 4 comments

mezura cases/1000-comments/1215-nesting_openers_sharing_bytes_with_closers/input.rs --output json --hide timing --no-default-config --no-local --counting region

scc.default ✓ agrees
the rules ask5 lines · 0 blanks · 1 code · 4 comments
it answers5 lines · 0 blanks · 1 code · 4 comments

scc --format json --no-config cases/1000-comments/1215-nesting_openers_sharing_bytes_with_closers/input.rs

tokei.default ✓ agrees
the rules ask5 lines · 0 blanks · 1 code · 4 comments
it answers5 lines · 0 blanks · 1 code · 4 comments

tokei --output json cases/1000-comments/1215-nesting_openers_sharing_bytes_with_closers/input.rs