관리-도구
편집 파일: parse.cpython-36.opt-2.pyc
3 ��2au � @ s0 d dl mZ G dd� de�ZG dd� de�ZdS )� )�tokenc @ s e Zd Zdd� ZdS )� ParseErrorc C s4 t j| d||||f � || _|| _|| _|| _d S )Nz!%s: type=%r, value=%r, context=%r)� Exception�__init__�msg�type�value�context)�selfr r r r � r �*/opt/alt/python36/lib64/python3.6/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 s 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 s: | j |||�}�x$| jd \}}}|\}} || } � x�| D ]�\}}| jj| \} }||kr�| j||||� |}x@|| d|fgkr�| j� | js�dS | jd \}}}|\}} qpW dS | dkr:| jj| }|\}}||kr:| j| | jj| ||� P q:W d|f| k�r$| j� | j�s2td|||��qtd|||��qW d S ) Nr r TF� ztoo much inputz bad input���r ) �classifyr r Zlabels�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| jj|� | jjj|�}|d k r0|S | jjj|�}|d krTtd|||��|S )Nz bad token) r �NAMEr �addr �keywords�get�tokensr )r r r r r$ r r r r � s zParser.classifyc C sT | j d \}}}|||d f}| j| j|�}|d k r@|d j|� |||f| j d<