Ñò -!Lc@s dZddklZlZlZddkZdefd„ƒYZdefd„ƒYZdefd „ƒYZ d efd „ƒYZ d e fd „ƒYZ dS(skutilities for analyzing expressions and blocks of Python code, as well as generating Python from AST nodesiÿÿÿÿ(t exceptionstpyparsertutilNt PythonCodecBseZdZd„ZRS(s<represents information about a string containing Python codecKsy||_tƒ|_tƒ|_t|tƒoti|iƒd|}n|}ti ||}|i |ƒdS(Ntexec( tcodetsettdeclared_identifierstundeclared_identifierst isinstancet basestringRtparsetlstriptFindIdentifierstvisit(tselfRtexception_kwargstexprtf((s,/usr/lib/python2.6/site-packages/mako/ast.pyt__init__s   (t__name__t __module__t__doc__R(((s,/usr/lib/python2.6/site-packages/mako/ast.pyR st ArgumentListcBseZdZd„ZRS(sBparses a fragment of code as a comma-separated list of expressionscKs´g|_g|_tƒ|_tƒ|_t|tƒoNtid|ƒo"tid|ƒ o|d7}nt i |d|}n|}t i |t |}|i |ƒdS(Ns\Ss,\s*$t,R(tcodeargstargsRRRR R tretmatchRR t FindTupleRR(RRRRR((s,/usr/lib/python2.6/site-packages/mako/ast.pyR+s    '(RRRR(((s,/usr/lib/python2.6/site-packages/mako/ast.pyR)stPythonFragmentcBseZdZd„ZRS(s³extends PythonCode to provide identifier lookups in partial control statements e.g. for x in 5: elif y==9: except (MyException, e): etc. cKs2tid|iƒtiƒ}|ptid||‚n|idƒo||idƒ }n|iddƒ\}}|djo|d }n}|d jo|d }nb|d jp |d jod|d }n6|djod|d }ntid||‚tt |ƒi ||dS(Ns^(\w+)(?:\s+(.*?))?:\s*(#|$)s0Fragment '%s' is not a partial control statementiiitfortiftwhiletpassttryspass except:passteliftelsesif False:pass texcepts try:pass s!Unsupported control keyword: '%s'(RR R!( RRtstriptSRtCompileExceptiontgrouptstarttsuperRR(RRRtmtkeywordR((s,/usr/lib/python2.6/site-packages/mako/ast.pyREs(    (RRRR(((s,/usr/lib/python2.6/site-packages/mako/ast.pyR<st FunctionDeclcBs&eZdZed„Zed„ZRS(sfunction declarationcKsž||_ti|d|}ti||}|i|ƒt|dƒptid||‚n| o+|io!tid|i d|‚ndS(NRtfuncnames'Code '%s' is not a function declarations('**%s' keyword argument not allowed hereiÿÿÿÿ( RRR t ParseFuncRthasattrRR)tkwargstargnames(RRt allow_kwargsRRR((s,/usr/lib/python2.6/site-packages/mako/ast.pyR_s   c Cs&g}g}|iD] }||q~}|i}|i}g}|iD] } || qJ~} | iƒxµ| D]­} d} |od| } t}n<|od| } t}n!t|ƒo |iƒpd} |o4| o-|i dd| t i | ƒi ƒfƒqq|i d| ƒqqW|S(sJreturn the argument declarations of this FunctionDecl as a printable list.s**t*is%s=%sN( tdefaultsR3tvarargsR4treversetNonetFalsetlentpoptinsertRtExpressionGeneratortvalue( Rtinclude_defaultst namedeclst_[1]tdR7R3R8t_[2]RR4targtdefault((s,/usr/lib/python2.6/site-packages/mako/ast.pytget_argument_expressionsns,$  $       (RRRtTrueRRH(((s,/usr/lib/python2.6/site-packages/mako/ast.pyR/]s t FunctionArgscBseZdZd„ZRS(s.the argument portion of a function declarationcKs!tt|ƒid||dS(Nsdef ANON(%s):pass(R,RJR(RRR3((s,/usr/lib/python2.6/site-packages/mako/ast.pyRŽs(RRRR(((s,/usr/lib/python2.6/site-packages/mako/ast.pyRJ‹s( RtmakoRRRRtobjectRRRR/RJ(((s,/usr/lib/python2.6/site-packages/mako/ast.pyts !.