Your IP : 18.191.72.220


Current Path : /opt/alt/python36/lib64/python3.6/lib2to3/pgen2/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/lib2to3/pgen2/__pycache__/parse.cpython-36.opt-2.pyc

3

��2au�@s0ddlmZGdd�de�ZGdd�de�ZdS)�)�tokenc@seZdZdd�ZdS)�
ParseErrorcCs4tj|d||||f�||_||_||_||_dS)Nz!%s: type=%r, value=%r, context=%r)�	Exception�__init__�msg�type�value�context)�selfrrrr	�r�*/opt/alt/python36/lib64/python3.6/parse.pyrszParseError.__init__N)�__name__�
__module__�__qualname__rrrrrrsrc@sHeZdZddd�Zddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)�ParserNcCs||_|pdd�|_dS)NcSs|S)Nr)�grammar�noderrr�<lambda>Wsz!Parser.__init__.<locals>.<lambda>)r�convert)r
rrrrrr9szParser.__init__cCsH|dkr|jj}|ddgf}|jj|d|f}|g|_d|_t�|_dS)N�)r�start�dfas�stack�rootnode�set�
used_names)r
r�newnodeZ
stackentryrrr�setupYs
zParser.setupcCs:|j|||�}�x$|jd\}}}|\}}	||}
�x�|
D]�\}}|jj|\}
}||kr�|j||||�|}x@||d|fgkr�|j�|js�dS|jd	\}}}|\}}	qpWdS|
dkr:|jj|
}|\}}||kr:|j|
|jj|
||�Pq:Wd|f|
k�r$|j�|j�s2td|||��qtd|||��qWdS)
NrrTF�ztoo much inputz	bad input���r)	�classifyrrZlabels�shift�popr�pushr)r
rrr	�ilabel�dfa�staterZstates�firstZarcs�i�newstate�t�vZitsdfaZ	itsstatesZitsfirstrrr�addtokenqs:zParser.addtokencCsX|tjkr0|jj|�|jjj|�}|dk	r0|S|jjj|�}|dkrTtd|||��|S)Nz	bad token)	r�NAMEr�addr�keywords�get�tokensr)r
rrr	r$rrrr �s
zParser.classifyc	CsT|jd\}}}|||df}|j|j|�}|dk	r@|dj|�|||f|jd<dS)Nrrrr)rrr�append)	r
rrr)r	r%r&rrrrrr!�szParser.shiftc	CsB|jd\}}}|d|gf}|||f|jd<|jj|d|f�dS)Nrrrr)rr2)	r
rZnewdfar)r	r%r&rrrrrr#�szParser.pushcCs`|jj�\}}}|j|j|�}|dk	r\|jrL|jd\}}}|dj|�n||_|j|j_dS)Nrrr)rr"rrr2rr)r
ZpopdfaZpopstateZpopnoderr%r&rrrrr"�sz
Parser.pop)N)N)
r
rrrrr,r r!r#r"rrrrrs
 
0	rN)�rrr�objectrrrrr�<module>s

?>