<s> __author__ = '<STR_LIT>' <EOL> class ASTVisitor ( object ) : <EOL> """<STR_LIT>""" <EOL> def visit ( self , node ) : <EOL> method = '<STR_LIT>' % node . __class__ . __name__ <EOL> return getattr ( self , method , self . generic_visit ) ( node ) <EOL> def generic_visit ( self , node ) : <EOL> for child in node : <EOL> self . visit ( child ) <EOL> class NodeVisitor ( object ) : <EOL> """<STR_LIT>""" <EOL> def visit ( self , node ) : <EOL> """<STR_LIT>""" <EOL> for child in node : <EOL> yield child <EOL> for subchild in self . visit ( child ) : <EOL> yield subchild <EOL> def visit ( node ) : <EOL> visitor = NodeVisitor ( ) <EOL> for child in visitor . visit ( node ) : <EOL> yield child </s>
