AlkantarClanX12

Your IP : 3.145.85.74


Current Path : /opt/alt/python33/lib64/python3.3/lib2to3/pgen2/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/lib2to3/pgen2/__pycache__/driver.cpython-33.pyc

�
��f!c@s�dZdZddgZddlZddlZddlZddlZddlZddlm	Z	m
Z
mZmZm
Z
Gdd�de�Zd	ddddd
d�Zdd�Zd
d�Zedkr�ejee���ndS(uZParser driver.

This provides a high-level interface to parse a file into a syntax tree.

u#Guido van Rossum <guido@python.org>uDriveruload_grammariNi(ugrammaruparseutokenutokenizeupgencBst|EeZdZd
d
dd�Zddd�Zddd�Zddd�Zd
dd	d
�Z	ddd�Z
d
S(uDrivercCs:||_|dkr$tj�}n||_||_dS(N(ugrammaruNoneuloggingu	getLoggeruloggeruconvert(uselfugrammaruconvertulogger((u9/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/driver.pyu__init__s
		uDriver.__init__cCs@tj|j|j�}|j�d}d}d}}}}	}
d}x�|D]�}|\}}}}	}
|||fkr
||f|ks�t||f|f��|\}
}||
kr�|d|
|7}|
}d}n||kr
||
||�7}|}q
n|tjtj	fkrc||7}|	\}}|j
d�rQ|d7}d}qQqQn|tjkr�tj
|}n|r�|jjdtj|||�n|j||||f�r�|r�|jjd�nPnd}|	\}}|j
d�rQ|d7}d}qQqQWtjd||||f��|jS(	u4Parse a series of tokens and return the syntax tree.iiuu
u%s %r (prefix=%r)uStop.uincomplete inputN(uparseuParserugrammaruconvertusetupuNoneuAssertionErrorutokenizeuCOMMENTuNLuendswithutokenuOPuopmapuloggerudebugutok_nameuaddtokenu
ParseErrorurootnode(uselfutokensudebugupulinenoucolumnutypeuvalueustartuendu	line_textuprefixu	quintupleus_linenous_column((u9/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/driver.pyuparse_tokens&sT

*	

	

	uDriver.parse_tokenscCs"tj|j�}|j||�S(u*Parse a stream and return the syntax tree.(utokenizeugenerate_tokensureadlineuparse_tokens(uselfustreamudebugutokens((u9/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/driver.pyuparse_stream_rawVsuDriver.parse_stream_rawcCs|j||�S(u*Parse a stream and return the syntax tree.(uparse_stream_raw(uselfustreamudebug((u9/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/driver.pyuparse_stream[suDriver.parse_streamc
Cs;tj|d|�}z|j||�SWd|j�XdS(u(Parse a file and return the syntax tree.urN(ucodecsuopenuparse_streamuclose(uselfufilenameuencodingudebugustream((u9/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/driver.pyu
parse_file_suDriver.parse_filecCs+tjtj|�j�}|j||�S(u*Parse a string and return the syntax tree.(utokenizeugenerate_tokensuiouStringIOureadlineuparse_tokens(uselfutextudebugutokens((u9/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/driver.pyuparse_stringgsuDriver.parse_stringNF(u__name__u
__module__u__qualname__uNoneu__init__uFalseuparse_tokensuparse_stream_rawuparse_streamu
parse_fileuparse_string(u
__locals__((u9/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/driver.pyuDrivers0uGrammar.txtc	Cs<|dkrtj�}n|dkr~tjj|�\}}|dkrTd}n||djttt	j
��d}n|s�t||�r|jd|�t
j|�}|r8|jd|�y|j|�Wqtk
r}z|jdt|��WYdd}~XqXq8ntj�}|j|�|S(	u'Load the grammar (maybe from a pickle).u.txtuu.u.pickleu!Generating grammar tables from %suWriting grammar tables to %suWriting failed:N(uNoneuloggingu	getLoggeruosupathusplitextujoinumapustrusysuversion_infou_neweruinfoupgenugenerate_grammarudumpuIOErrorugrammaruGrammaruload(	ugtugpusaveuforceuloggeruheadutailugue((u9/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/driver.pyuload_grammarms&	*0
cCsNtjj|�sdStjj|�s,dStjj|�tjj|�kS(u0Inquire whether file a was written since file b.FT(uosupathuexistsuFalseuTrueugetmtime(uaub((u9/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/driver.pyu_newer�s
u_newercGsi|stjdd�}ntjdtjdtjdd�x$|D]}t|dd	dd	�qEWd	S(
u�Main program, when run as a script: produce grammar pickle files.

    Calls load_grammar for each argument, a path to a grammar text file.
    iNulevelustreamuformatu%(message)susaveuforceT(usysuargvuloggingubasicConfiguINFOustdoutuload_grammaruTrue(uargsugt((u9/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/driver.pyumain�s
umainu__main__TF(u__doc__u
__author__u__all__ucodecsuiouosuloggingusysuugrammaruparseutokenutokenizeupgenuobjectuDriveruNoneuTrueuFalseuload_grammaru_newerumainu__name__uexituint(((u9/opt/alt/python33/lib64/python3.3/lib2to3/pgen2/driver.pyu<module>s(P