Your IP : 3.133.126.241


Current Path : /lib64/python3.8/lib2to3/pgen2/__pycache__/
Upload File :
Current File : //lib64/python3.8/lib2to3/pgen2/__pycache__/conv.cpython-38.opt-2.pyc

U

e5d�%�@s.ddlZddlmZmZGdd�dej�ZdS)�N)�grammar�tokenc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�	ConvertercCs |�|�|�|�|��dS�N)�parse_graminit_h�parse_graminit_c�
finish_off)�selfZ
graminit_hZ
graminit_c�r
�*/usr/lib64/python3.8/lib2to3/pgen2/conv.py�run/s

z
Converter.runc	
Cs�zt|�}Wn8tk
rD}ztd||f�WY�dSd}~XYnXi|_i|_d}|D]d}|d7}t�d|�}|s�|��r�td|||��f�qZ|��\}}t	|�}||j|<||j|<qZdS)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�zt|�}Wn8tk
rD}ztd||f�WY�dSd}~XYnXd}|dt|�}}|dt|�}}|dt|�}}i}g}|�d��r�|�d��rJt�d|�}ttt	|�
���\}	}
}g}t|�D]F}
|dt|�}}t�d|�}ttt	|�
���\}}|�||f�q�|dt|�}}|||	|
f<|dt|�}}q�t�d|�}ttt	|�
���\}}g}t|�D]R}
|dt|�}}t�d	|�}ttt	|�
���\}}	}
||	|
f}|�|��qx|�|�|dt|�}}|dt|�}}q�||_
i}t�d
|�}t	|�d��}t|�D]�}|dt|�}}t�d|�}|�d�}ttt	|�dd
dd���\}}}}||}|dt|�}}t�d|�}i}t|�d��}t|�D]@\}}t|�}td�D]$}|d|>@�r�d||d|<�qΐq�||f||<�q(|dt|�}}||_g}|dt|�}}t�d|�}t	|�d��}t|�D]^}|dt|�}}t�d|�}|�
�\}}t	|�}|dk�r�d}nt|�}|�||f��qX|dt|�}}||_|dt|�}}|dt|�}}t�d|�}t	|�d��}|dt|�}}|dt|�}}t�d|�}t	|�d��}|dt|�}}t�d|�}t	|�d��} | |_|dt|�}}z|dt|�}}Wntk
�r�YnXdS)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_ccCsXi|_i|_t|j�D]<\}\}}|tjkr@|dk	r@||j|<q|dkr||j|<qdSr)�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

?>