Your IP : 3.14.255.58


Current Path : /opt/alt/python310/lib64/python3.10/lib2to3/pgen2/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/lib2to3/pgen2/__pycache__/driver.cpython-310.opt-2.pyc

o

6��fQ�@s�	dZddgZddlZddlZddlZddlZddlZddlmZm	Z	m
Z
mZmZGdd�de
�Zdd	�Z		dd
d�Zdd�Zdd�Zdd�ZedkrWe�ee���dSdS)z#Guido van Rossum <guido@python.org>�Driver�load_grammar�N�)�grammar�parse�token�tokenize�pgenc@sHeZdZddd�Zddd�Zddd�Zdd	d
�Zddd�Zdd
d�ZdS)rNcCs&||_|durt��}||_||_dS�N)r�logging�	getLogger�logger�convert)�selfrrr
�r�;/opt/alt/python310/lib64/python3.10/lib2to3/pgen2/driver.py�__init__s

zDriver.__init__FcCsj	t�|j|j�}|��d}d}d}}}}	}
d}|D]�}|\}}}}	}
|||fkrP|\}
}||
krB|d|
|7}|
}d}||krP||
||�7}|}|tjtjfvrl||7}|	\}}|�d�rk|d7}d}q|t	j
krvtj|}|r�|j�
dt	j|||�|�||||f�r�|r�|j�
d�|jSd}|	\}}|�d�r�|d7}d}qt�d||||f��)Nrr��
z%s %r (prefix=%r)zStop.zincomplete input)rZParserrrZsetupr�COMMENT�NL�endswithr�OPZopmapr
�debug�tok_nameZaddtokenZ
ParseErrorZrootnode)r�tokensr�p�lineno�column�type�value�start�endZ	line_text�prefixZ	quintupleZs_linenoZs_columnrrr�parse_tokens&sZ


�
�
�
�zDriver.parse_tokenscCs	t�|j�}|�||�Sr
)r�generate_tokens�readliner$)r�streamrrrrr�parse_stream_rawVszDriver.parse_stream_rawcCs	|�||�Sr
)r()rr'rrrr�parse_stream[szDriver.parse_streamcCsB	tj|d|d��}|�||�Wd�S1swYdS)N�r)�encoding)�io�openr))r�filenamer+rr'rrr�
parse_file_s
$�zDriver.parse_filecCs 	t�t�|�j�}|�||�Sr
)rr%r,�StringIOr&r$)r�textrrrrr�parse_stringdszDriver.parse_string)NN)F)NF)	�__name__�
__module__�__qualname__rr$r(r)r/r2rrrrrs


0

cCs:tj�|�\}}|dkrd}||d�tttj��dS)Nz.txtr�.z.pickle)�os�path�splitext�join�map�str�sys�version_info)�gt�head�tailrrr�_generate_pickle_namejsrB�Grammar.txtTFc
Cs�	|dur	t��}|durt|�n|}|st||�sQ|�d|�t�|�}|rO|�d|�z|�|�W|StyN}z
|�d|�WYd}~|Sd}~ww|St	�
�}|�|�|S)Nz!Generating grammar tables from %szWriting grammar tables to %szWriting failed: %s)rrrB�_newer�infor	Zgenerate_grammar�dump�OSErrorr�Grammar�load)r?Zgp�save�forcer
�g�errrrqs*
����
cCs:	tj�|�s	dStj�|�sdStj�|�tj�|�kS)NFT)r7r8�exists�getmtime)�a�brrrrD�srDcCsH	tj�|�rt|�Sttj�|��}t�||�}t�	�}|�
|�|Sr
)r7r8�isfilerrB�basename�pkgutil�get_datarrH�loads)�packageZgrammar_sourceZpickled_name�datarLrrr�load_packaged_grammar�s

rYcGsD	|s
tjdd�}tjtjtjdd�|D]	}t|ddd�qdS)Nrz%(message)s)�levelr'�formatT)rJrK)r=�argvrZbasicConfig�INFO�stdoutr)�argsr?rrr�main�s�r`�__main__)rCNTFN)�
__author__�__all__r,r7rrTr=rrrrrr	�objectrrBrrDrYr`r3�exit�intrrrr�<module>s(M
�	
�

?>