feat: add AST checker engine framework with 9 Phase 1 engines

This commit is contained in:
2026-05-25 20:39:31 -06:00
parent c36e6623bd
commit 811b065e05
7 changed files with 169 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
class BaseEngine:
@staticmethod
def collect_nodes(node, node_type):
results = []
if node.type == node_type:
results.append(node)
for child in node.children:
results.extend(BaseEngine.collect_nodes(child, node_type))
return results
@staticmethod
def has_node(node, node_type):
if node.type == node_type:
return True
return any(BaseEngine.has_node(child, node_type) for child in node.children)
def check(self, tree, rule, language, mapping) -> list[str]:
raise NotImplementedError