1
0
Fork 0
Code Issues Pull requests Projects Releases 2 Packages Wiki Activity Actions Pages

Ignore comments in Tree-sitter logic graphs

This commit is contained in:
Andraxion 2026-07-25 22:46:01 -04:00
parent 9161889492
commit 6d659ba381
2 changed files with 46 additions and 0 deletions

View file

@ -20,6 +20,8 @@ from tree_sitter import Language, Node, Parser
from .errors import DocForgeError
from .models import LogicEdge, LogicNode, LogicProjection
_TRIVIA_NODE_TYPES = frozenset({"comment"})
@dataclass(frozen=True)
class TreeSitterLogicOwner:
@ -432,6 +434,8 @@ class _TreeSitterFunctionBuilder:
*,
control: _Control | None,
) -> tuple[_Tail, ...]:
if statement.type in _TRIVIA_NODE_TYPES:
return incoming
if statement.type in self.profile.block_types:
return self._statements(statement.named_children, incoming, control=control)
if statement.type == "if_statement":