Your IP : 18.219.247.59


Current Path : /opt/alt/python35/lib64/python3.5/lib2to3/pgen2/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/lib2to3/pgen2/__pycache__/driver.cpython-35.opt-2.pyc



���]Y�@s�dZddgZddlZddlZddlZddlZddlZddlmZm	Z	m
Z
mZmZGdd�de
�Zdd	�Zd
ddddd
d�Zdd�Zdd�Zedkr�ejee���dS)z#Guido van Rossum <guido@python.org>�Driver�load_grammar�N�)�grammar�parse�token�tokenize�pgenc@speZdZdddd�Zddd�Zddd�Zdd	d
�Zdddd�Zdd
d�ZdS)rNcCs7||_|dkr!tj�}||_||_dS)N)r�logging�	getLogger�logger�convert)�selfrr
r�r�+/opt/alt/python35/lib64/python3.5/driver.py�__init__s
		zDriver.__init__FcCs�tj|j|j�}|j�d}d}d}}}}	}
d}x�|D]~}|\}}}}	}
|||fkr�|\}
}||
kr�|d|
|7}|
}d}||kr�||
||�7}|}|tjtjfkr*||7}|	\}}|jd�rQ|d7}d}qQ|t	j
krFtj|}|rl|jj
dt	j|||�|j||||f�r�|r�|jj
d�Pd}|	\}}|jd�rQ|d7}d}qQWtjd||||f��|jS)Nrr��
z%s %r (prefix=%r)zStop.zincomplete input)rZParserrr
Zsetupr�COMMENT�NL�endswithr�OPZopmapr�debug�tok_nameZaddtokenZ
ParseError�rootnode)r�tokensr�p�lineno�column�type�value�start�endZ	line_text�prefixZ	quintupleZs_linenoZs_columnrrr�parse_tokens&sR






	zDriver.parse_tokenscCs"tj|j�}|j||�S)N)r�generate_tokens�readliner$)r�streamrrrrr�parse_stream_rawVszDriver.parse_stream_rawcCs|j||�S)N)r()rr'rrrr�parse_stream[szDriver.parse_streamc
Cs;tj|d|�}z|j||�SWd|j�XdS)N�r)�codecs�openr)�close)r�filename�encodingrr'rrr�
parse_file_szDriver.parse_filecCs+tjtj|�j�}|j||�S)N)rr%�io�StringIOr&r$)r�textrrrrr�parse_stringgszDriver.parse_string)	�__name__�
__module__�__qualname__rr$r(r)r0r4rrrrrs0cCsOtjj|�\}}|dkr*d}||djtttj��dS)Nz.txtr�.z.pickle)�os�path�splitext�join�map�str�sys�version_info)�gt�head�tailrrr�_generate_pickle_namemsrDzGrammar.txtTFcCs�|dkrtj�}|dkr0t|�n|}|sLt||�r�|jd|�tj|�}|r�|jd|�y|j|�Wq�tk
r�}z|jd|�WYdd}~Xq�Xnt	j
�}|j|�|S)Nz!Generating grammar tables from %szWriting grammar tables to %szWriting failed: %s)r
rrD�_newer�infor	Zgenerate_grammar�dump�OSErrorrZGrammar�load)rAZgp�save�forcer�g�errrrts&
cCsNtjj|�sdStjj|�s,dStjj|�tjj|�kS)NFT)r9r:�exists�getmtime)�a�brrrrE�s
rEcGsf|stjdd�}tjdtjdtjdd�x$|D]}t|dddd�qBWdS)	Nr�levelr'�formatz%(message)srJTrK)r?�argvr
�basicConfig�INFO�stdoutr)�argsrArrr�main�s
rY�__main__)�
__author__�__all__r+r1r9r
r?rrrrrr	�objectrrDrrErYr5�exit�intrrrr�<module>s(P	


?>