WIP: Phase 6 review

This commit is contained in:
2026-05-10 15:14:54 -04:00
parent 7974f661b3
commit 2a71aff18c
10 changed files with 290 additions and 66 deletions
+13
View File
@@ -0,0 +1,13 @@
from src.file_cache import ASTParser
from pathlib import Path
parser = ASTParser('cpp')
code = Path('tests/assets/gencpp_samples/ast.hpp').read_text()
tree = parser.get_cached_tree(None, code)
code_bytes = code.encode('utf8')
def find_node(node):
start = node.start_point.row + 1
if start == 296:
print(f'LINE 296 NODE: {node.type}, NAME: {parser._get_name(node, code_bytes)}, TEXT: {code_bytes[node.start_byte:node.end_byte].decode("utf8")[:50].strip()}...')
for child in node.children:
find_node(child)
find_node(tree.root_node)