Current File : //opt/imh-python/lib/python2.7/lib2to3/patcomp.pyo |
�
��Wc @ s d Z 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 d e f d
� � YZ d � Z d e f d
� � YZ i e j d 6e j d 6e j d 6d d 6Z d � Z d � Z d � Z d S( s� Pattern compiler.
The grammar is taken from PatternGrammar.txt.
The compiler compiles a pattern to a pytree.*Pattern instance.
s# Guido van Rossum <guido@python.org>i����Ni ( t drivert literalst tokent tokenizet parset grammar( t pytree( t pygrams PatternGrammar.txtt PatternSyntaxErrorc B s e Z RS( ( t __name__t
__module__( ( ( sh /builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/lib2to3/patcomp.pyR s c c sw t t j t j t j f � } t j t j | � j � } x7 | D]/ } | \ } } } } } | | k r@ | Vq@ q@ Wd S( s6 Tokenizes a string suppressing significant whitespace.N( t setR t NEWLINEt INDENTt DEDENTR t generate_tokenst StringIOt readline( t inputt skipt tokenst quintuplet typet valuet startt endt line_text( ( sh /builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/lib2to3/patcomp.pyt tokenize_wrapper! s
t PatternCompilerc B sA e Z e d � Z e e d � Z d � Z d d � Z d � Z RS( c C s^ t j | � | _ t j | j � | _ t j | _ t j | _ t j
| j d t �| _ d S( s^ Initializer.
Takes an optional alternative filename for the pattern grammar.
t convertN( R t load_grammarR R t Symbolst symst python_grammart pygrammart python_symbolst pysymst Drivert pattern_convert( t selft grammar_file( ( sh /builddir/build/BUILDROOT/imh-python-2.7.12-1.el7.x86_64/opt/imh-python/lib/python2.7/lib2to3/patcomp.pyt __init__- s
c C s} t | � } y | j j | d | �} Wn( t j k
rR } t t | � � � n X| rl | j | � | f S| j | � Sd S( s= Compiles a pattern string to a nested pytree.*Pattern object.t debugN( R R t parse_tokensR t
ParseErrorR t strt compile_node( R'