← every case · 6000 · another language inside the file
three languages deep, the everyday shape of a page: the php file holds html between its blocks, and the html holds a script. Every line belongs to the innermost language, and a tag's own line to the language that encloses the tag, so the script tags are html and the html sits between the php blocks
| 1 | codecodecodecodecode | <?php |
| 2 | codeextracodecodecode | ?> |
| 3 | code HTMLcode HTMLcode HTMLcode HTMLcode HTML | <div> |
| 4 | code HTMLcode HTMLcode HTMLcode HTMLcode HTML | <script> |
| 5 | comments JavaScriptcomments JavaScriptcomments JavaScriptcomments JavaScriptcomments JavaScript | // a js comment |
| 6 | code JavaScriptcode JavaScriptcode JavaScriptcode JavaScriptcode JavaScript | var x = 1; |
| 7 | code HTMLcode HTMLcode HTMLcode HTMLcode HTML | </script> |
| 8 | code HTMLcode HTMLcode HTMLcode HTMLcode HTML | </div> |
| 9 | codecodecodecodecode | <?php |
| 10 | codecodecodecodecode | echo "hi"; |
| 11 | codeextracodecodecode | ?> |
stringcommentthe tag around another language
the file is read as php from beginning to end, so the js comment two languages deep survives only because php spells its line comment the same way, and neither language inside is named
cloc --json cases/6000-another_language_inside_the_file/6120-script_inside_html_inside_php/input.php
the file is read as php from beginning to end, so neither block is found; the totals survive because php happens to bucket every line the same way the three languages do
mezura cases/6000-another_language_inside_the_file/6120-script_inside_html_inside_php/input.php --output json --hide timing --counting content
the file is read as php from beginning to end, so neither block is found
mezura cases/6000-another_language_inside_the_file/6120-script_inside_html_inside_php/input.php --output json --hide timing --counting region
it has no notion of a file holding a second language, and the js comment survives only because php spells its line comment the same way
scc --format json cases/6000-another_language_inside_the_file/6120-script_inside_html_inside_php/input.php
a php file never yields children, so the page that nests two levels deep in a markdown fence is counted flat here, everything php
tokei --output json cases/6000-another_language_inside_the_file/6120-script_inside_html_inside_php/input.php