Your IP : 3.138.114.198


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

o

6��f�%�@s0	ddlZddlmZmZGdd�dej�ZdS)�N)�grammar�tokenc@s.eZdZ	dd�Zdd�Zdd�Zdd�Zd	S)
�	ConvertercCs"	|�|�|�|�|��dS�N)�parse_graminit_h�parse_graminit_c�
finish_off)�selfZ
graminit_hZ
graminit_c�r
�9/opt/alt/python310/lib64/python3.10/lib2to3/pgen2/conv.py�run/s

z
Converter.runc	
Cs�	zt|�}Wnty"}ztd||f�WYd}~dSd}~wwi|_i|_d}|D]2}|d7}t�d|�}|sK|��rKtd|||��f�q-|��\}}t	|�}||j|<||j|<q-dS)N�Can't open %s: %sFr�z^#define\s+(\w+)\s+(\d+)$z%s(%s): can't parse %sT)
�open�OSError�printZ
symbol2numberZ
number2symbol�re�match�strip�groups�int)	r	�filename�f�err�lineno�line�mo�symbol�numberr
r
rr5s.��
�
zConverter.parse_graminit_hc!
Cs�	zt|�}Wnty"}ztd||f�WYd}~dSd}~wwd}|dt|�}}|dt|�}}|dt|�}}i}g}|�d��r|�d�r�t�d|�}ttt	|�
���\}	}
}g}t|�D]#}
|dt|�}}t�d|�}ttt	|�
���\}}|�||f�qg|dt|�}}|||	|
f<|dt|�}}|�d�sOt�d|�}ttt	|�
���\}}g}t|�D](}
|dt|�}}t�d	|�}ttt	|�
���\}}	}
||	|
f}|�|�q�|�|�|dt|�}}|dt|�}}|�d�sJ||_
i}t�d
|�}t	|�d��}t|�D]o}|dt|�}}t�d|�}|�d�}ttt	|�dd
dd���\}}}}||}|dt|�}}t�d|�}i}t|�d��}t|�D] \}}t|�}td�D]}|d|>@�r~d||d|<�qm�qa||f||<�q|dt|�}}||_g}|dt|�}}t�d|�}t	|�d��}t|�D]/}|dt|�}}t�d|�}|�
�\}}t	|�}|dk�r�d}nt|�}|�||f��q�|dt|�}}||_|dt|�}}|dt|�}}t�d|�}t	|�d��}|dt|�}}|dt|�}}t�d|�}t	|�d��}|dt|�}}t�d|�}t	|�d��} | |_|dt|�}}z|dt|�}}WdSt�yeYdSw)Nr
Frrzstatic arc z)static arc arcs_(\d+)_(\d+)\[(\d+)\] = {$z\s+{(\d+), (\d+)},$z'static state states_(\d+)\[(\d+)\] = {$z\s+{(\d+), arcs_(\d+)_(\d+)},$zstatic dfa dfas\[(\d+)\] = {$z0\s+{(\d+), "(\w+)", (\d+), (\d+), states_(\d+),$����z\s+("(?:\\\d\d\d)*")},$�z!static label labels\[(\d+)\] = {$z\s+{(\d+), (0|"\w+")},$�0z
\s+(\d+),$z\s+{(\d+), labels},$z	\s+(\d+)$)rrr�next�
startswithrr�list�maprr�range�append�states�group�eval�	enumerate�ord�dfas�labels�start�
StopIteration)!r	rrrrrZallarcsr+r�n�m�kZarcs�_�i�j�s�t�stater0Zndfasrr�x�y�z�firstZ	rawbitset�cZbyter1Znlabelsr2r
r
rrTs���
�
�

�"�
"��
�zConverter.parse_graminit_ccCsZ	i|_i|_t|j�D]\}\}}|tjkr!|dur!||j|<q|dur*||j|<qdSr)�keywords�tokensr.r1r�NAME)r	Zilabel�type�valuer
r
rr�s
��zConverter.finish_offN)�__name__�
__module__�__qualname__rrrrr
r
r
rr$s
&r)rZpgen2rrZGrammarrr
r
r
r�<module>s

?>