chore: Checkpoint commit of unstaged changes, including new tests and debug scripts

This commit is contained in:
2026-02-26 21:39:03 -05:00
parent 94a1c320a5
commit 51918d9bc3
18 changed files with 226 additions and 28 deletions

29
inspect_ast.py Normal file
View File

@@ -0,0 +1,29 @@
import tree_sitter
import tree_sitter_python
language = tree_sitter.Language(tree_sitter_python.language())
parser = tree_sitter.Parser(language)
code = """
@core_logic
def decorated_func():
"""Docstring."""
print("core logic here")
def hot_func():
# [HOT]
print("hot logic here")
def normal_func():
print("normal logic here")
"""
tree = parser.parse(bytes(code, "utf8"))
def print_node(node, indent=0):
print(" " * indent + f"{node.type} [{node.start_byte}-{node.end_byte}] " + (f"'{code[node.start_byte:node.end_byte]}'" if node.type in ["decorator", "comment", "identifier"] else ""))
for child in node.children:
print_node(child, indent + 1)
print_node(tree.root_node)