Files
manual_slop/debug_line_296.py
T
2026-05-10 15:14:54 -04:00

14 lines
559 B
Python

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)