← every case · 2000 · string forms

2010-comment_symbol_inside_string

a comment symbol inside a string is text. The address holds //, which opens a line comment anywhere outside a string, so a counter that takes it for one also hides the block comment opened after the string and counts the second line of that comment as code

read ascloc.defaultcloc.docstring-as-codecodestats.defaultmezura.contentmezura.regionscc.defaulttokei.default
input.js
1codeconst url = "http://example.com/"; /* a real comment
2commentsthat closes on this line */
3codelet value = 1;

stringcommentthe tag around another language

What each tool answered

cloc.default ✗ fails

the // of the address inside the string is read as a line comment, which hides the /* after the string, so the line closing that comment counts as code

the rules ask3 lines · 0 blanks · 2 code · 1 comments
it answers3 lines · 0 blanks · 3 code · 0 comments

cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2010-comment_symbol_inside_string/input.js

cloc.default ✓ agrees

--strip-str-comments

the rules ask3 lines · 0 blanks · 2 code · 1 comments
it answers3 lines · 0 blanks · 2 code · 1 comments

cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2010-comment_symbol_inside_string/input.js --strip-str-comments

cloc.docstring-as-code ✗ fails

the // of the address inside the string is read as a line comment, which hides the /* after the string, so the line closing that comment counts as code

the rules ask3 lines · 0 blanks · 2 code · 1 comments
it answers3 lines · 0 blanks · 3 code · 0 comments

cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2010-comment_symbol_inside_string/input.js --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/2010-comment_symbol_inside_string/input.js --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/2010-comment_symbol_inside_string/input.js --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/2010-comment_symbol_inside_string/input.js --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/2010-comment_symbol_inside_string/input.js

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/2010-comment_symbol_inside_string/input.js