← every case · 1000 · comments
MATLAB's %{ and %} open and close a block comment only when they are alone on their line, spaces aside. The %} followed by words inside the block closes nothing, and the %{ followed by words is an ordinary % comment, so the line under it is code. A counter that takes either symbol anywhere on its line closes the block early and opens one over the last line, and the two mistakes do not cancel
| 1 | codecodecodecodecodecodecode | function z = f(x) |
| 2 | commentscommentscommentsextracommentscommentscomments | %{ |
| 3 | commentscommentscommentscommentscommentscommentscomments | %} not the end |
| 4 | commentscommentscommentscommentscommentscommentscomments | z = x; |
| 5 | commentscommentscommentsextracommentscommentscomments | %} |
| 6 | commentscommentscommentscommentscommentscommentscomments | %{ note |
| 7 | codecodecodecodecodecodecode | z = x + 1; |
stringcommentthe tag around another language
the %} with words after it on line 3 closes the block, so those words and line 4 count as code, and the %{ with words after it on line 6 opens one over line 7. With the words on those two lines written as plain text the file reads right
cloc --json --config /tmp/linejudge-empty-file cases/1000-comments/1280-matlab_block_markers_sharing_their_line/input.m
--strip-str-comments
the %} with words after it on line 3 closes the block, so those words and line 4 count as code, and the %{ with words after it on line 6 opens one over line 7. With the words on those two lines written as plain text the file reads right
cloc --json --config /tmp/linejudge-empty-file cases/1000-comments/1280-matlab_block_markers_sharing_their_line/input.m --strip-str-comments
the %} with words after it on line 3 closes the block, so those words and line 4 count as code, and the %{ with words after it on line 6 opens one over line 7. With the words on those two lines written as plain text the file reads right
cloc --json --config /tmp/linejudge-empty-file cases/1000-comments/1280-matlab_block_markers_sharing_their_line/input.m --docstring-as-code
codestats cases/1000-comments/1280-matlab_block_markers_sharing_their_line/input.m --output json-compact --include-generated --no-gitignore --hidden --no-config
mezura cases/1000-comments/1280-matlab_block_markers_sharing_their_line/input.m --output json --hide timing --no-default-config --no-local --counting content
mezura cases/1000-comments/1280-matlab_block_markers_sharing_their_line/input.m --output json --hide timing --no-default-config --no-local --counting region
the %} with words after it on line 3 closes the block, so those words and line 4 count as code, and the %{ with words after it on line 6 opens one over line 7. With the words on those two lines written as plain text the file reads right
scc --format json --no-config cases/1000-comments/1280-matlab_block_markers_sharing_their_line/input.m
knows no MATLAB and counts every .m file as Objective-C, whose comments do not begin with %, so every line is code
tokei --output json cases/1000-comments/1280-matlab_block_markers_sharing_their_line/input.m