Expand description
Small helpers over tree-sitter syntax trees, shared by the language plugins.
Functions§
- code_
lines - Lines that are neither blank nor start with one of
comment. - line
- 1-based line of a node.
- loc
- Lines of code: lines that are neither blank nor a comment.
analyze,mapandgate’s size check all count with it, so a unit’s size means the same everywhere. - named_
children - parse
- Parses
text;Noneonly when the grammar cannot be loaded. - text
- walk
- Every node in the tree, depth first.
- without_
slash_ comments - A build file with its comments removed, so a commented-out
implementation("a:b:1")is not read as a dependency the project declares.//counts only at the start of a line: a trailing one follows code the project does declare. - without_
xml_ comments textwith its<!-- -->comments removed (apom.xml, a project file).