Mercurial > lcfOS
view ide/compiler/display.py @ 4:0d5ef85b8698
Improved link between ast viewer and code edit
author | windel-eee |
---|---|
date | Wed, 21 Sep 2011 19:05:18 +0200 |
parents | 92df07bc2081 |
children |
line wrap: on
line source
from .nodes import * def printNode(node, indent=0): """ Print visitor all printing goes in here """ print(' '*indent+str(node)) if type(node) is Procedure: print(' '*indent+' PARAMETERS:') for p in node.parameters: printNode(p, indent+4) if node.block: print(' '*indent+' CODE:') printNode(node.block, indent+4) elif type(node) is Module: print(node.symtable) printNode(node.initcode, indent+2) else: for c in node.getChildren(): printNode(c, indent+2)