Tree Sitter Upgrade #5

Open
acereca wants to merge 7 commits from 4-tree-sitter-upgrade into main
Showing only changes of commit d6bd5f4096 - Show all commits
+9 -5
View File
@@ -44,12 +44,16 @@ class SkillParser:
def _traverse_tree(
self,
node,
root_node,
content: str,
diagnostics: list[Diagnostic],
symbols: list[DocumentSymbol]
) -> None:
"""Recursively traverses the AST to find errors and symbols."""
"""Iteratively traverses the AST to find errors and symbols."""
stack = [root_node]
while stack:
node = stack.pop()
# 1. Handle Errors (Diagnostics)
if node.type in ERROR_NODE_TYPES:
@@ -73,9 +77,9 @@ class SkillParser:
if symbol:
symbols.append(symbol)
# 3. Continue traversal
for child in node.children:
self._traverse_tree(child, content, diagnostics, symbols)
# 3. Continue traversal - push children in reverse order to maintain original DFS order
for child in reversed(node.children):
stack.append(child)
def _is_symbol_node(self, node) -> bool:
"""Determines if a node is significant enough to be an outline symbol."""