ó o®¸Qc@s=dZddlmZddlmZmZmZmZmZm Z ddl m Z ddl Z ddl Z dZddd„ƒYZd efd „ƒYZd efd „ƒYZd efd„ƒYZdefd„ƒYZdefd„ƒYZddd„ƒYZd„Zedkr9ddl Z ddlmZmZddlZd„Zxäe jdD]ÒZeGHeeƒZej ƒZ!ej"ƒeje!edƒZ#ee#ƒZ$eeƒZ%eƒZ&ee%e&ƒe&j'e%jƒZ(ee$e(ƒs"HdGeGHe)e$ƒGHe)e(ƒGHe j*dƒniZ+e+j,e&j'ƒe+e%=e+j-ƒZ'[+xáe#j.ƒD]ÓZ&e&j/ƒr[ge'D]!Z0e0j1e&j2ƒkrte0^qtZ3e4e3ƒdkr¿dGe&j2ƒGHq.eee&j5ƒƒe3djƒƒs.e&j2ƒGHe)ee&j5ƒƒƒGHe)e3djƒƒGHe j*dƒq.q[q[Wq`WndS( sModule symbol-table generatoriÿÿÿÿ(tast(tSC_LOCALtSC_GLOBAL_IMPLICITtSC_GLOBAL_EXPLICITtSC_FREEtSC_CELLt SC_UNKNOWN(tmangleNitScopecBs¤eZdd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d„Z d „Z d „Z d „Zd „Zd „Zd„Zd„Zd„ZRS(cCs½||_||_i|_i|_i|_i|_i|_i|_g|_d|_ d|_ d|_ |dk r¹x>t t|ƒƒD]'}||dkr‹|||_ Pq‹q‹WndS(Nt_(tnametmoduletdefstusestglobalstparamstfreestcellstchildrentNonetnestedt generatortklasstrangetlen(tselfR R Rti((s&/sys/lib/python2.7/compiler/symbols.pyt__init__s"              cCsd|jj|jfS(Ns<%s: %s>(t __class__t__name__R (R((s&/sys/lib/python2.7/compiler/symbols.pyt__repr__%scCs#|jdkr|St||jƒS(N(RRR(RR ((s&/sys/lib/python2.7/compiler/symbols.pyR(scCsd|j|j|ƒ¬s R8cBseZRS((RR=(((s&/sys/lib/python2.7/compiler/symbols.pyR8²st GenExprScopecBs,eZejZdZdd„Zd„ZRS(icCs@|j}|jd7_|jd|||ƒ|jdƒdS(Nisgenerator expression<%d>s.0(t_GenExprScope__countert_GenExprScope__super_initR#(RR RR((s&/sys/lib/python2.7/compiler/symbols.pyRºs cCstj|ƒ}|S(N(RR'(RR%((s&/sys/lib/python2.7/compiler/symbols.pyR'ÀsN(RR=RRRCRBRR'(((s&/sys/lib/python2.7/compiler/symbols.pyRAµs  t LambdaScopecBs#eZejZdZdd„ZRS(icCs3|j}|jd7_|jd|||ƒdS(Nis lambda.%d(t_LambdaScope__countert_LambdaScope__super_init(RR RR((s&/sys/lib/python2.7/compiler/symbols.pyRÉs N(RR=RRRFRER(((s&/sys/lib/python2.7/compiler/symbols.pyRDÄs R7cBseZejZd„ZRS(cCs|j|||ƒdS(N(t_ClassScope__super_init(RR R ((s&/sys/lib/python2.7/compiler/symbols.pyRÑs(RR=RRRG(((s&/sys/lib/python2.7/compiler/symbols.pyR7Îs t SymbolVisitorcBseZd„Zd„ZeZd„Zd„Zd„Zd„Zd„Z dd„Z d „Z d „Z d „Z dd „Zd „Zd„Zd„Zd„Zd„Zdd„Zdd„Zdd„Zdd„Zd„ZejejejfZd„Zd„ZRS(cCsi|_d|_dS(N(tscopesRR(R((s&/sys/lib/python2.7/compiler/symbols.pyRÕs cCs2tƒ}|_|j|<|j|j|ƒdS(N(R>R RItvisittnode(RRKtscope((s&/sys/lib/python2.7/compiler/symbols.pyt visitModuleÛscCsÙ|jr|j|j|ƒn|j|jƒx!|jD]}|j||ƒq9Wt|j|j|jƒ}|js†t |tƒr’d|_n||j |<|j ||j ƒ|j|j |ƒ|j||ƒdS(Ni(t decoratorsRJRR tdefaultsR8R RRR6RIt_do_argstargnamestcodethandle_free_vars(RRKtparenttnRL((s&/sys/lib/python2.7/compiler/symbols.pyt visitFunctionás   cCs|t|j|jƒ}|js<t|tƒs<t|tƒrHd|_n||j|<|j|j|ƒ|j ||ƒdS(Ni( RAR RRR6R8RIRJRRRS(RRKRTRL((s&/sys/lib/python2.7/compiler/symbols.pyt visitGenExprïs  cCs;x!|jD]}|j||ƒq W|j|j|ƒdS(N(tqualsRJtexpr(RRKRLtgenfor((s&/sys/lib/python2.7/compiler/symbols.pytvisitGenExprInnerúscCsQ|j|j|dƒ|j|j|ƒx!|jD]}|j||ƒq3WdS(Ni(RJtassigntitertifs(RRKRLtif_((s&/sys/lib/python2.7/compiler/symbols.pytvisitGenExprForscCs|j|j|ƒdS(N(RJttest(RRKRL((s&/sys/lib/python2.7/compiler/symbols.pytvisitGenExprIfsicCs¤x!|jD]}|j||ƒq Wt|j|jƒ}|jsQt|tƒr]d|_n||j|<|j ||j ƒ|j|j |ƒ|j ||ƒdS(Ni( RORJRDR RRR6R8RIRPRQRRRS(RRKRTR\RURL((s&/sys/lib/python2.7/compiler/symbols.pyt visitLambda s  cCsJxC|D];}t|ƒtjkr5|j||ƒq|j|ƒqWdS(N(ttypettypest TupleTypeRPR#(RRLtargsR ((s&/sys/lib/python2.7/compiler/symbols.pyRPs cCs|j|ƒ|jƒdS(N(R*R5(RRLRT((s&/sys/lib/python2.7/compiler/symbols.pyRS s cCsë|j|jƒx!|jD]}|j||ƒqWt|j|jƒ}|jsat|tƒrmd|_n|j dk rŒ|jdƒn|jdƒ||j |<|j }|j|_ |j|j |ƒ||_ |j||ƒdS(Nit__doc__R=(RR tbasesRJR7R RR6R8tdocRRIRRRRS(RRKRTRURLtprev((s&/sys/lib/python2.7/compiler/symbols.pyt visitClass$s      cCs-|r|j|jƒn|j|jƒdS(N(RR R (RRKRLR\((s&/sys/lib/python2.7/compiler/symbols.pyt visitName;scCs_|j|j|dƒ|j|j|ƒ|j|j|ƒ|jr[|j|j|ƒndS(Ni(RJR\tlisttbodytelse_(RRKRL((s&/sys/lib/python2.7/compiler/symbols.pytvisitForCs  cCsCx<|jD]1\}}|dkr(q n|j|p7|ƒq WdS(Nt*(R9R(RRKRLR tasname((s&/sys/lib/python2.7/compiler/symbols.pyt visitFromJs cCsYxR|jD]G\}}|jdƒ}|dkr>|| }n|j|pM|ƒq WdS(Nt.iÿÿÿÿ(R9tfindR(RRKRLR RsR((s&/sys/lib/python2.7/compiler/symbols.pyt visitImportPs   cCs%x|jD]}|j|ƒq WdS(N(R9R"(RRKRLR ((s&/sys/lib/python2.7/compiler/symbols.pyt visitGlobalWscCs>x$|jD]}|j||dƒq W|j|j|ƒdS(s.Propagate assignment flag down to child nodes. The Assign node doesn't itself contains the variables being assigned to. Instead, the children in node.nodes are visited with the assign flag set to true. When the names occur in those nodes, they are marked as defs. Some names that occur in an assignment target are not bound by the assignment, e.g. a name occurring inside a slice. The visitor handles these nodes specially; they do not propagate the assign flag to their children. iN(tnodesRJRY(RRKRLRU((s&/sys/lib/python2.7/compiler/symbols.pyt visitAssign[s icCs|j|jƒdS(N(RR (RRKRLR\((s&/sys/lib/python2.7/compiler/symbols.pyt visitAssNamelscCs|j|j|dƒdS(Ni(RJRY(RRKRLR\((s&/sys/lib/python2.7/compiler/symbols.pyt visitAssAttroscCsA|j|j|dƒx$|jD]}|j||dƒq WdS(Ni(RJRYtsubs(RRKRLR\RU((s&/sys/lib/python2.7/compiler/symbols.pytvisitSubscriptrscCs^|j|j|dƒ|jr8|j|j|dƒn|jrZ|j|j|dƒndS(Ni(RJRYtlowertupper(RRKRLR\((s&/sys/lib/python2.7/compiler/symbols.pyt visitSlicews   cCsX|j|j|ƒt|jtjƒrA|j|j|dƒn|j|j|ƒdS(Ni(RJRKR6RtNameRY(RRKRL((s&/sys/lib/python2.7/compiler/symbols.pytvisitAugAssign~scCsœxv|jD]k\}}t|tjƒrUt|jƒ|jkrU|jsRq qRqUn|j||ƒ|j||ƒq W|jr˜|j|j|ƒndS(N( ttestsR6RtConstRdtvaluet _const_typesRJRp(RRKRLRaRo((s&/sys/lib/python2.7/compiler/symbols.pytvisitIfŠs   cCs d|_|j|j|ƒdS(Ni(RRJR†(RRKRL((s&/sys/lib/python2.7/compiler/symbols.pyt visitYield—s ( RR=RRMtvisitExpressionRVRWR[R`RbRcRPRSRlRmRqRtRwRxRzR{R|R~RRƒRet StringTypetIntTypet FloatTypeR‡RˆR‰(((s&/sys/lib/python2.7/compiler/symbols.pyRHÔs4                      cCst|ƒt|ƒkS(N(tsorted(tl1tl2((s&/sys/lib/python2.7/compiler/symbols.pytlist_eq›st__main__(t parseFiletwalkcCsTgg|jƒD]}|jƒ^qD]*}|jdƒpG|jdƒs&|^q&S(Ns_[Ru(t get_symbolstget_namet startswith(tsymsts((s&/sys/lib/python2.7/compiler/symbols.pyR'£s,itexectoopstskippingi(((6RhtcompilerRtcompiler.constsRRRRRRt compiler.miscRReR-t MANGLE_LENRR>R8RARDR7RHR‘RR“R”tsymtableR'targvtfiletopentftreadtbuftcloseR˜t mod_namesttreeR™RItnames2RŽtexitR&R$tvaluesR•t is_namespaceR;R R–tlRt get_namespace(((s&/sys/lib/python2.7/compiler/symbols.pytsj.  ž Ç                  !