MOON
Server: Apache/2.2.34 (Unix) mod_ssl/2.2.34 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 FrontPage/5.0.2.2635
System: Linux server.asjudinet.com 2.6.32-042stab141.3 #1 SMP Fri Nov 15 22:45:34 MSK 2019 i686
User: asjudine (504)
PHP: 5.2.17
Disabled: NONE
Upload Files
File: //proc/2/cwd/proc/2/root/proc/2/root/usr/lib/python2.4/compiler/visitor.pyo
mņ
‚=5Dc@sXdklZdfd„ƒYZdefd„ƒYZeZddd„Zd„ZdS((sastt
ASTVisitorcBs8tZdZdZd„Zd„Zd„Zd„ZRS(sPerforms a depth-first walk of the AST

    The ASTVisitor will walk the AST, performing either a preorder or
    postorder traversal depending on which method is called.

    methods:
    preorder(tree, visitor)
    postorder(tree, visitor)
        tree: an instance of ast.Node
        visitor: an instance with visitXXX methods

    The ASTVisitor is responsible for walking over the tree in the
    correct order.  For each node, it checks the visitor argument for
    a method named 'visitNodeType' where NodeType is the name of the
    node's class, e.g. Class.  If the method exists, it is called
    with the node as its sole argument.

    The visitor method for a particular node type can control how
    child nodes are visited during a preorder walk.  (It can't control
    the order during a postorder walk, because it is called _after_
    the walk has occurred.)  The ASTVisitor modifies the visitor
    argument by adding a visit method to the visitor; this method can
    be used to visit a child node of arbitrary type.
    icCsd|_h|_dS(N(tNonetselftnodet_cache(R((t&/usr/lib/python2.4/compiler/visitor.pyt__init__"s	cGs+x$|iƒD]}|i||Œq
WdS(N(Rt
getChildNodestchildRtdispatchtargs(RRR
R((Rtdefault&s
cGsw||_|i}|ii|dƒ}|djo6|i}t
|id||iƒ}||i|<n|||ŒS(Ntvisit(RRt	__class__tklassRtgetRtmetht__name__t	classNametgetattrtvisitorRR
(RRR
RRR((RR	*s		
	cGs)||_|i|_|i||ŒdS(s&Do preorder walk of tree using visitorN(RRR	RttreeR
(RRRR
((Rtpreorder;s	(Rt
__module__t__doc__tVERBOSERRR	R(((RRs			tExampleASTVisitorcBstZdZhZd„ZRS(sŪPrints examples of the nodes that aren't visited

    This visitor-driver is only useful for development, when it's
    helpful to develop a visitor incrementally, and get feedback on what
    you still have to do.
    cGs[||_|ii|idƒ}|ii}|djo-t	|i
d|dƒ}||i|i<n|idjo"dG|G|o
|ipdGHn|o|||Œn§|idjo–|i}|ii|ƒpf||i|<H|i
GH|GHxCt|ƒD]5}|ddjodGd|Gt	||ƒGHqqWHn|i||ŒSndS(	NRiiR	tt_s	s%-12.12s(RRRRR
RRRRRRRR
Rtexamplesthas_keytdirtattrR(RRR
R RRR((RR	Js.	
"	

"(RRRRR	(((RRAscCsK|djo
tƒ}n|dj	o
||_n|i||ƒ|iS(N(twalkerRt_walkertverboseRRRR(RRR!R#((Rtwalkes



cCsR|iGHxCt|ƒD]5}|ddjodGd|Gt||ƒGHqqWdS(NiRs	s%-10.10s(RR
RR R(RR ((RtdumpNodems

N(tcompilertastRRR"RR$R%(R'R%R$R"RR((Rt?s

;#