Your IP : 18.227.105.110


Current Path : /opt/alt/python312/lib64/python3.12/lib2to3/pgen2/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/lib2to3/pgen2/__pycache__/driver.cpython-312.opt-2.pyc

�

�Q�fQ����	dZddgZddlZddlZddlZddlZddlZddlmZm	Z	m
Z
mZmZGd�de
�Zd�Z		dd	�Zd
�Zd�Zd�Zed
k(rej*ee���yy)z#Guido van Rossum <guido@python.org>�Driver�load_grammar�N�)�grammar�parse�token�tokenize�pgenc�<�eZdZdd�Zd	d�Zd	d�Zd	d�Zd
d�Zd	d�Zy)rNc�Z�||_|�tj�}||_||_y�N)r�logging�	getLogger�logger�convert)�selfrrrs    �;/opt/alt/python312/lib64/python3.12/lib2to3/pgen2/driver.py�__init__zDriver.__init__s*������>��&�&�(�F�������c�D�	tj|j|j�}|j	�d}d}dx}x}x}x}	}
d}|D�]6}|\}}}}	}
|||fk7r(|\}
}||
kr|d|
|z
zz
}|
}d}||kr
||
||z
}|}|t
jt
jfvr#||z
}|	\}}|jd�r|dz
}d}��|tjk(rtj|}|r/|jjdtj|||�|j||||f�r*|r|jjd�|j"Sd}|	\}}|jd�s��0|dz
}d}��9tj d||||f��)Nrr��
z%s %r (prefix=%r)zStop.zincomplete input)r�Parserrr�setupr	�COMMENT�NL�endswithr�OP�opmapr�debug�tok_name�addtoken�
ParseError�rootnode)r�tokensr �p�lineno�column�type�value�start�end�	line_text�prefix�	quintuple�s_lineno�s_columns               r�parse_tokenszDriver.parse_tokens&s���B��L�L����t�|�|�4��	���	�����15�5��5�u�5�u�5�s�Y����I�1:�.�D�%���Y����(�(�%*�"��(��H�$��d�h��&7�8�8�F�%�F��F��H�$��i��x�8�8�F�%�F���(�(�(�+�+�6�6��%���!$�����>�>�$�'��a�K�F��F���u�x�x���}�}�U�+������!�!�"5�"'�.�.��"6��v�G��z�z�$�����7���K�K�%�%�g�.���z�z���F� �N�F�F��~�~�d�#��!�����A �F�"�"�#5�#'�����A�
Arc�f�	tj|j�}|j||�Sr
)r	�generate_tokens�readliner2)r�streamr r%s    r�parse_stream_rawzDriver.parse_stream_rawVs,��8��)�)�&�/�/�:��� � ���/�/rc�(�	|j||�Sr
)r7)rr6r s   r�parse_streamzDriver.parse_stream[s��8��$�$�V�U�3�3rc��	tj|d|��5}|j||�cddd�S#1swYyxYw)N�r)�encoding)�io�openr9)r�filenamer<r r6s     r�
parse_filezDriver.parse_file_s8��6�
�W�W�X�s�X�
6�&��$�$�V�U�3�	4�	4�
6�
6�s�6�?c��	tjtj|�j�}|j||�Sr
)r	r4r=�StringIOr5r2)r�textr r%s    r�parse_stringzDriver.parse_stringds7��8��)�)�"�+�+�d�*;�*D�*D�E��� � ���/�/r)NN)F)NF)	�__name__�
__module__�__qualname__rr2r7r9r@rD�rrrrs!���.�`0�
4�4�
0rc��tjj|�\}}|dk(rd}||zdjt	t
tj��zdzS)Nz.txtr�.z.pickle)�os�path�splitext�join�map�str�sys�version_info)�gt�head�tails   r�_generate_pickle_namerVjsP�����!�!�"�%�J�D�$��v�~����$�;����#�c�3�+;�+;�"<�=�=�	�I�Irc��	|�tj�}|�t|�n|}|st||�sQ|j	d|�tj|�}|r&|j	d|�	|j|�|S|Stj�}|j|�|S#t$r}|j	d|�Yd}~|Sd}~wwxYw)Nz!Generating grammar tables from %szWriting grammar tables to %szWriting failed: %s)rrrV�_newer�infor
�generate_grammar�dump�OSErrorr�Grammar�load)rS�gp�save�forcer�g�es       rrrqs���1�
�~��"�"�$��&(�j�	�r�	"�b�B��F�2�r�N����7��<��!�!�"�%����K�K�6��;�
5����r�
�
�H�1�H�
�O�O���	���r�
��H���
5����0�!�4�4�
�H��
5�s�1B-�-	C�6C�Cc��	tjj|�sytjj|�sytjj|�tjj|�k\S)NFT)rKrL�exists�getmtime)�a�bs  rrXrX�sT��:�
�7�7�>�>�!���
�7�7�>�>�!���
�7�7���A��"�'�'�"2�"2�1�"5�5�5rc�"�	tjj|�rt|�St	tjj|��}t
j||�}tj�}|j|�|Sr
)rKrL�isfilerrV�basename�pkgutil�get_datarr]�loads)�package�grammar_source�pickled_name�datarbs     r�load_packaged_grammarrs�sk��	�
�w�w�~�~�n�%��N�+�+�(����)9�)9�.�)I�J�L����G�\�2�D�����A��G�G�D�M��Hrc���	|stjdd}tjtjtj
d��|D]}t
|dd���y)Nrz%(message)s)�levelr6�formatT)r`ra)rQ�argvr�basicConfig�INFO�stdoutr)�argsrSs  r�mainr|�sQ�����x�x���|�����g�l�l�3�:�:�,�.����R�d�$�/��r�__main__)zGrammar.txtNTFN)�
__author__�__all__r=rKrrlrQrrrrr	r
�objectrrVrrXrsr|rE�exit�intrHrr�<module>r�s����3�
��^�
$��
�	���
�4�3�J0�V�J0�ZJ�'+�04�
�*6�
�(��z���C�H�H�S�T�V��_��r

?>