checkpoint: massive refactor
This commit is contained in:
@@ -10,9 +10,9 @@ parser = tree_sitter.Parser(PY_LANGUAGE)
|
||||
tree = parser.parse(bytes(code, "utf8"))
|
||||
|
||||
def walk(node, indent=0):
|
||||
content = code[node.start_byte:node.end_byte].strip()
|
||||
print(f"{' ' * indent}{node.type} ({node.start_byte}-{node.end_byte}): {content[:20]}")
|
||||
for child in node.children:
|
||||
walk(child, indent + 1)
|
||||
content = code[node.start_byte:node.end_byte].strip()
|
||||
print(f"{' ' * indent}{node.type} ({node.start_byte}-{node.end_byte}): {content[:20]}")
|
||||
for child in node.children:
|
||||
walk(child, indent + 1)
|
||||
|
||||
walk(tree.root_node)
|
||||
|
||||
Reference in New Issue
Block a user