Skip to main content

Module syntax

Module syntax 

Source
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, map and gate’s size check all count with it, so a unit’s size means the same everywhere.
named_children
parse
Parses text; None only 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
text with its <!-- --> comments removed (a pom.xml, a project file).