ok
Direktori : /opt/alt/python35/lib64/python3.5/lib2to3/__pycache__/ |
Current File : //opt/alt/python35/lib64/python3.5/lib2to3/__pycache__/patcomp.cpython-35.opt-2.pyc |
���]� � @ s d Z d d l Z d d l Z d d l m Z m Z m Z m Z m Z m Z d d l m Z d d l m Z e j j e j j e � d � Z Gd d � d e � Z d d � Z Gd d � d e � Z d e j d e j d e j d d i Z d d � Z d d � Z d d � Z d S)z#Guido van Rossum <guido@python.org>� N� )�driver�literals�token�tokenize�parse�grammar)�pytree)�pygramzPatternGrammar.txtc @ s e Z d Z d S)�PatternSyntaxErrorN)�__name__� __module__�__qualname__� r r �,/opt/alt/python35/lib64/python3.5/patcomp.pyr s r c c sn t j t j t j h } t j t j | � j � } x4 | D], } | \ } } } } } | | k r: | Vq: Wd 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 @ sX e Z d Z e d d � Z d d d d � Z d d � Z d d d � Z d d � Z d S) �PatternCompilerc C s^ t j | � | _ t j | j � | _ t j | _ t j | _ t j | j d t �| _ d S)N�convert)r Zload_grammarr r ZSymbols�symsZpython_grammarZ pygrammarZpython_symbols�pysymsZDriver�pattern_convert)�selfZgrammar_filer r r �__init__- s zPatternCompiler.__init__Fc C s� t | � } y | j j | d | �} Wn: t j k rd } z t t | � � � WYd d } ~ Xn X| r~ | j | � | f S| j | � Sd S)N�debug)r r Zparse_tokensr Z ParseErrorr �str�compile_node)r% r r'