��
���Lc@s�dZdZddgZddkZddkZddkZddkZddklZl Z l
Z
lZlZde
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 <guido@python.org>tDrivertload_grammari����Ni(tgrammartparsettokenttokenizetpgencBsVeZddd�Zed�Zed�Zed�Zded�Zed�Z RS(cCs<||_|djoti�}n||_||_dS(N(RtNonetloggingt getLoggertloggertconvert(tselfRRR
((s*/usr/lib/python2.6/lib2to3/pgen2/driver.pyt__init__s
cCs'ti|i|i�}|i�d}d}d }}}} }
d}x�|D]�}|\}}}} }
|||fjog|\}
}||
jo"|d|
|7}|
}d}n||jo||
||!7}|}q�n|titifjoA||7}| \}}|i d�o|d7}d}qQqQn|t
ijoti|}n|o$|i
idt
i|||�n|i||||f�o |o|i
id�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(RtParserRRtsetupRRtCOMMENTtNLtendswithRtOPtopmapR
tdebugttok_nametaddtokent
ParseErrortrootnode(RttokensRtptlinenotcolumnttypetvaluetstarttendt line_texttprefixt quintuplets_linenots_column((s*/usr/lib/python2.6/lib2to3/pgen2/driver.pytparse_tokens%sT
cCs"ti|i�}|i||�S(s*Parse a stream and return the syntax tree.(Rtgenerate_tokenstreadlineR((RtstreamRR((s*/usr/lib/python2.6/lib2to3/pgen2/driver.pytparse_stream_rawUscCs|i||�S(s*Parse a stream and return the syntax tree.(R,(RR+R((s*/usr/lib/python2.6/lib2to3/pgen2/driver.pytparse_streamZscCs;ti|d|�}z|i||�SWd|i�XdS(s(Parse a file and return the syntax tree.trN(tcodecstopenR-tclose(RtfilenametencodingRR+((s*/usr/lib/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((RttextRR((s*/usr/lib/python2.6/lib2to3/pgen2/driver.pytparse_stringfsN(
t__name__t
__module__RR
tFalseR(R,R-R4R8(((s*/usr/lib/python2.6/lib2to3/pgen2/driver.pyRs0ccs7x|it�D]}|VqWxto dVq"WdS(s<Generator that behaves like readline without using StringIO.RN(t
splitlinestTrue(R7tline((s*/usr/lib/python2.6/lib2to3/pgen2/driver.pyR5ls sGrammar.txtc Cs7|djoti�}n|djoZtii|�\}}|djo
d}n||dittt i
��d}n|pt||�o~|id|�t
i|�}|oT|id|�y|i|�Wqtj
o }|idt|��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 tostpathtsplitexttjointmaptstrtsystversion_infot_newertinfoRtgenerate_grammartdumptIOErrorRtGrammartload( tgttgptsavetforceR
theadttailtgte((s*/usr/lib/python2.6/lib2to3/pgen2/driver.pyRts&
+$
cCsRtii|�ptStii|�ptStii|�tii|�jS(s0Inquire whether file a was written since file b.(R@RAtexistsR;R=tgetmtime(tatb((s*/usr/lib/python2.6/lib2to3/pgen2/driver.pyRH�s
(t__doc__t
__author__t__all__R/R@RRFRRRRRRtobjectRR5RR=R;RRH(((s*/usr/lib/python2.6/lib2to3/pgen2/driver.pyt<module>s(P