Ñò §ÚêLc @s´dZdZddgZddkZddkZddkZddkZddklZl Z l Z l Z l Z de fd„ƒYZd „Zd deedd „Zd „ZdS( sZParser driver. This provides a high-level interface to parse a file into a syntax tree. s#Guido van Rossum tDrivert load_grammariÿÿÿÿNi(tgrammartparsettokenttokenizetpgencBsVeZddd„Zed„Zed„Zed„Zded„Zed„Z RS(cCs<||_|djotiƒ}n||_||_dS(N(RtNonetloggingt getLoggertloggertconvert(tselfRR R ((s,/usr/lib64/python2.6/lib2to3/pgen2/driver.pyt__init__s    cCsPti|i|iƒ}|iƒd}d}d }}}} } d} xü|D]Ö} | \}}}} } |||fjo||f|jpt||f|f‚|\} }|| jo"| d| |7} | }d}n||jo| | ||!7} |}qn|titi fjoA| |7} | \}}|i dƒo|d7}d}qQqQn|t i joti |}n|o$|iidt i||| ƒn|i||| |fƒo |o|iidƒnPnd} | \}}|i dƒo|d7}d}qQqQWtid||| |fƒ‚|iS( s4Parse a series of tokens and return the syntax tree.iius s%s %r (prefix=%r)sStop.tsincomplete inputN(RtParserRR tsetupRtAssertionErrorRtCOMMENTtNLtendswithRtOPtopmapR tdebugttok_nametaddtokent ParseErrortrootnode(R ttokensRtptlinenotcolumnttypetvaluetstarttendt line_texttprefixt quintuplets_linenots_column((s,/usr/lib64/python2.6/lib2to3/pgen2/driver.pyt parse_tokens%sV )            cCs"ti|iƒ}|i||ƒS(s*Parse a stream and return the syntax tree.(Rtgenerate_tokenstreadlineR)(R tstreamRR((s,/usr/lib64/python2.6/lib2to3/pgen2/driver.pytparse_stream_rawUscCs|i||ƒS(s*Parse a stream and return the syntax tree.(R-(R R,R((s,/usr/lib64/python2.6/lib2to3/pgen2/driver.pyt parse_streamZscCs;ti|d|ƒ}z|i||ƒSWd|iƒXdS(s(Parse a file and return the syntax tree.trN(tcodecstopenR.tclose(R tfilenametencodingRR,((s,/usr/lib64/python2.6/lib2to3/pgen2/driver.pyt parse_file^scCs(tit|ƒiƒ}|i||ƒS(s*Parse a string and return the syntax tree.(RR*tgenerate_linestnextR)(R ttextRR((s,/usr/lib64/python2.6/lib2to3/pgen2/driver.pyt parse_stringfsN( t__name__t __module__RR tFalseR)R-R.R5R9(((s,/usr/lib64/python2.6/lib2to3/pgen2/driver.pyRs  0  ccs7x|itƒD] }|VqWxto dVq"WdS(s<Generator that behaves like readline without using StringIO.RN(t splitlinestTrue(R8tline((s,/usr/lib64/python2.6/lib2to3/pgen2/driver.pyR6ls  s Grammar.txtc Cs7|djotiƒ}n|djoZtii|ƒ\}}|djo d}n||dittt i ƒƒd}n|pt ||ƒ o~|i d|ƒt i|ƒ}|oT|i d|ƒy|i|ƒWqtj o }|i dt|ƒƒqXq3ntiƒ}|i|ƒ|S( s'Load the grammar (maybe from a pickle).s.txtRt.s.pickles!Generating grammar tables from %ssWriting grammar tables to %ssWriting failed:N(RRR tostpathtsplitexttjointmaptstrtsyst version_infot_newertinfoRtgenerate_grammartdumptIOErrorRtGrammartload( tgttgptsavetforceR theadttailtgte((s,/usr/lib64/python2.6/lib2to3/pgen2/driver.pyRts&    +$  cCsRtii|ƒptStii|ƒptStii|ƒtii|ƒjS(s0Inquire whether file a was written since file b.(RARBtexistsR<R>tgetmtime(tatb((s,/usr/lib64/python2.6/lib2to3/pgen2/driver.pyRIs (t__doc__t __author__t__all__R0RARRGRRRRRRtobjectRR6RR>R<RRI(((s,/usr/lib64/python2.6/lib2to3/pgen2/driver.pyt s     (P