Your IP : 18.119.166.141


Current Path : /opt/alt/python35/lib64/python3.5/lib2to3/pgen2/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/lib2to3/pgen2/__pycache__/parse.cpython-35.opt-2.pyc



���]u�@s@ddlmZGdd�de�ZGdd�de�ZdS)�)�tokenc@seZdZdd�ZdS)�
ParseErrorcCsHtj|d||||f�||_||_||_||_dS)Nz!%s: type=%r, value=%r, context=%r)�	Exception�__init__�msg�type�value�context)�selfrrrr	�r�*/opt/alt/python35/lib64/python3.5/parse.pyrs			zParseError.__init__N)�__name__�
__module__�__qualname__rrrrrrsrc@sjeZdZddd�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r9s	zParser.__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\}}}|\}}	||}
xV|
D]�\}}|jj|\}
}||kr�|j||||�|}xV||d|fgkr�|j�|js�dS|jd	\}}}|\}}	q�WdS|
dkrK|jj|
}|\}}||krK|j|
|jj|
||�PqKWd|f|
kr�|j�|js�td|||��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.addtokencCs~|tjkrD|jj|�|jjj|�}|dk	rD|S|jjj|�}|dkrztd|||��|S)Nz	bad token)	r�NAMEr�addr�keywords�get�tokensr)r
rrr	r$rrrr �szParser.classifyc	Cst|jd\}}}|||df}|j|j|�}|dk	rZ|dj|�|||f|jd<dS)Nrrrr)rrr�append)	r
rrr)r	r%r&rrrrrr!�szParser.shiftc	Cs[|jd\}}}|d|gf}|||f|jd<|jj|d|f�dS)Nrrrr)rr2)	r
rZnewdfar)r	r%r&rrrrrr#�szParser.pushcCs�|jj�\}}}|j|j|�}|dk	r�|jrl|jd\}}}|dj|�n||_|j|j_dS)Nrrr)rr"rrr2rr)r
ZpopdfaZpopstateZpopnoderr%r&rrrrr"�s		z
Parser.pop)
r
rrrrr,r r!r#r"rrrrrs 0	rN)�rrr�objectrrrrr�<module>s

?>