← every case · 2000 · string forms
a template literal opens inside the hole of another one and runs on to the next line. Templates and holes nest, so the second backtick on the first line opens the inner template and ends nothing. A counter that pairs the backticks in order ends the outer template there, and the line inside the inner template comes out as a comment
| 1 | codecodecodecodecodecodecode | const s = `a ${ `b |
| 2 | codecodecodecodecodecodecode | // still inside the inner template |
| 3 | codecodecodecodecodecodecode | c` } d`; |
| 4 | commentscommentscommentscommentscommentscommentscomments | // a real comment |
| 5 | codecodecodecodecodecodecode | let y = 1; |
stringcommentthe tag around another language
a // at the head of a line opens a comment inside a backtick template as readily as outside one, so the line inside the inner template counts as a comment. One template over the same three lines, with no hole, is counted the same way
cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2064-template_inside_a_template_hole/input.js
--strip-str-comments
a // at the head of a line opens a comment inside a backtick template as readily as outside one, so the line inside the inner template counts as a comment. One template over the same three lines, with no hole, is counted the same way
cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2064-template_inside_a_template_hole/input.js --strip-str-comments
a // at the head of a line opens a comment inside a backtick template as readily as outside one, so the line inside the inner template counts as a comment. One template over the same three lines, with no hole, is counted the same way
cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2064-template_inside_a_template_hole/input.js --docstring-as-code
codestats cases/2000-string_forms/2064-template_inside_a_template_hole/input.js --output json-compact --include-generated --no-gitignore --hidden --no-config
mezura cases/2000-string_forms/2064-template_inside_a_template_hole/input.js --output json --hide timing --no-default-config --no-local --counting content
mezura cases/2000-string_forms/2064-template_inside_a_template_hole/input.js --output json --hide timing --no-default-config --no-local --counting region
the backticks pair off in order, hole or no hole, so the second one ends the outer template and the line inside the inner template counts as a comment. The file is counted the same with the ${ taken out
scc --format json --no-config cases/2000-string_forms/2064-template_inside_a_template_hole/input.js
the backticks pair off in order, hole or no hole, so the second one ends the outer template and the line inside the inner template counts as a comment. The file is counted the same with the ${ taken out
tokei --output json cases/2000-string_forms/2064-template_inside_a_template_hole/input.js