관리-도구
편집 파일: parse.cpython-37.opt-2.pyc
B YI~du � @ s0 d dl mZ G dd� de�ZG dd� de�ZdS )� )�tokenc @ s e Zd Zdd� ZdS )� ParseErrorc C s4 t �| d||||f � || _|| _|| _|| _d S )Nz!%s: type=%r, value=%r, context=%r)� Exception�__init__�msg�type�value�context)�selfr r r r � r �8/opt/alt/python37/lib64/python3.7/lib2to3/pgen2/parse.pyr s zParseError.__init__N)�__name__� __module__�__qualname__r r r r r r s r c @ sH e Zd Zddd�Zddd�Zdd� Zdd � Zd d� Zdd � Zdd� Z dS )�ParserNc C s || _ |pdd� | _d S )Nc S s |S )Nr )�grammar�noder r r �<lambda>W � z!Parser.__init__.<locals>.<lambda>)r �convert)r r r r r r r 9 s zParser.__init__c C sH |d kr| j j}|d d g f}| j j| d|f}|g| _d | _t� | _d S )N� )r �start�dfas�stack�rootnode�set� used_names)r r �newnodeZ stackentryr r r �setupY s zParser.setupc C s8 | � |||�}�x"| jd \}}}|\}} || } x�| D ]�\}}| jj| \} }||kr�| �||||� |}x@|| d|fgkr�| �� | js�dS | jd \}}}|\}} qnW dS | dkr8| jj| }|\}}||kr8| �| | jj| ||� P q8W d|f| k�r"| �� | j�s0td|||��qtd|||��qW d S )N���r TF� ztoo much inputz bad input) �classifyr r �labels�shift�popr �pushr )r r r r �ilabel�dfa�stater Zstates�firstZarcs�i�newstate�t�vZitsdfaZ itsstatesZitsfirstr r r �addtokenq s: zParser.addtokenc C sX |t jkr0| j�|� | jj�|�}|d k r0|S | jj�|�}|d krTtd|||��|S )Nz bad token) r �NAMEr �addr �keywords�get�tokensr )r r r r r&