← every case · 2000 · string forms

2200-line_string_holding_a_comment_symbol_and_a_quote

a Zig multiline string literal is written as one \\ line per line of text, and each \\ opens a raw string that runs to the end of its own line with no closing symbol. The first line holds // right after \\, so a counter that reads no \\ string and ignores punctuation beside a comment counts that line as a comment, while the second holds a lone double quote, which opens an unclosed string in a counter whose double quotes cross lines. Two real comments follow the string, so taking the first line as a comment and losing the comments below to the lone quote cannot cancel out

read ascloc.defaultcloc.docstring-as-codecodestats.defaultmezura.contentmezura.regionscc.defaulttokei.default
input.zig
1codeconst msg =
2code \\// inside the string
3code \\it holds one " quote
4code;
5comments// a real comment
6comments// a second real comment
7codeconst x = 1;

stringcommentthe tag around another language

What each tool answered

cloc.default ✓ agrees
the rules ask7 lines · 0 blanks · 5 code · 2 comments
it answers7 lines · 0 blanks · 5 code · 2 comments

cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2200-line_string_holding_a_comment_symbol_and_a_quote/input.zig

cloc.default ✓ agrees

--strip-str-comments

the rules ask7 lines · 0 blanks · 5 code · 2 comments
it answers7 lines · 0 blanks · 5 code · 2 comments

cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2200-line_string_holding_a_comment_symbol_and_a_quote/input.zig --strip-str-comments

cloc.docstring-as-code ✓ agrees
the rules ask7 lines · 0 blanks · 5 code · 2 comments
it answers7 lines · 0 blanks · 5 code · 2 comments

cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2200-line_string_holding_a_comment_symbol_and_a_quote/input.zig --docstring-as-code

codestats.default ✓ agrees
the rules ask7 lines · 0 blanks · 5 code · 2 comments
it answers7 lines · 0 blanks · 5 code · 2 comments

codestats cases/2000-string_forms/2200-line_string_holding_a_comment_symbol_and_a_quote/input.zig --output json-compact --include-generated --no-gitignore --hidden --no-config

mezura.content ✓ agrees
the rules ask7 lines · 4 code · 2 comments · 1 extra
it answers7 lines · 4 code · 2 comments · 1 extra

mezura cases/2000-string_forms/2200-line_string_holding_a_comment_symbol_and_a_quote/input.zig --output json --hide timing --no-default-config --no-local --counting content

mezura.region ✓ agrees
the rules ask7 lines · 0 blanks · 5 code · 2 comments
it answers7 lines · 0 blanks · 5 code · 2 comments

mezura cases/2000-string_forms/2200-line_string_holding_a_comment_symbol_and_a_quote/input.zig --output json --hide timing --no-default-config --no-local --counting region

scc.default ✗ fails

the \\ on line 2 opens a string that does not close when the line ends, so every line from there to the end of the file counts as code, and the answer is the same with the quote on line 3 taken out

the rules ask7 lines · 0 blanks · 5 code · 2 comments
it answers7 lines · 0 blanks · 7 code · 0 comments

scc --format json --no-config cases/2000-string_forms/2200-line_string_holding_a_comment_symbol_and_a_quote/input.zig

tokei.default ✗ fails

its Zig carries no \\ string symbol, so the quote on line 3 opens a string that crosses lines and swallows both comments below it. With that quote taken out the file comes out right

the rules ask7 lines · 0 blanks · 5 code · 2 comments
it answers7 lines · 0 blanks · 7 code · 0 comments

tokei --output json cases/2000-string_forms/2200-line_string_holding_a_comment_symbol_and_a_quote/input.zig