AlkantarClanX12
Current Path : /proc/self/root/usr/lib64/python3.6/lib2to3/__pycache__/ |
Current File : //proc/self/root/usr/lib64/python3.6/lib2to3/__pycache__/patcomp.cpython-36.opt-2.pyc |
3 \� � @ s� d Z ddlZddlmZmZmZmZmZmZ ddl m Z ddl mZ G dd� de�Z d d � ZG dd� de�Zejejejdd �Zdd� Zdd� Zdd� ZdS )z#Guido van Rossum <guido@python.org>� N� )�driver�literals�token�tokenize�parse�grammar)�pytree)�pygramc @ s e Zd ZdS )�PatternSyntaxErrorN)�__name__� __module__�__qualname__� r r �'/usr/lib64/python3.6/lib2to3/patcomp.pyr s r c c sP t jt jt jh}tjtj| �j�}x(|D ] }|\}}}}}||kr(|V q(W d S )N) r �NEWLINE�INDENT�DEDENTr �generate_tokens�io�StringIO�readline) �input�skip�tokensZ quintuple�type�value�start�endZ line_textr r r �tokenize_wrapper s r c @ s: e Zd Zd dd�Zddd�Zdd� Zdd d �Zdd� ZdS )�PatternCompilerNc C sZ |d krt j| _t j| _ntj|�| _t j| j�| _t j| _ t j | _tj| jt d�| _d S )N)Zconvert)r Zpattern_grammarr Zpattern_symbols�symsr Zload_grammarZSymbolsZpython_grammarZ pygrammarZpython_symbols�pysymsZDriver�pattern_convert)�selfZgrammar_filer r r �__init__( s zPatternCompiler.__init__Fc C sn t |�}y| jj||d�}W n0 tjk rL } ztt|���W Y d d }~X nX |r`| j|�|fS | j|�S d S )N)�debug)r r Zparse_tokensr Z ParseErrorr �str�compile_node)r$ r r&