AlkantarClanX12
Current Path : /proc/self/root/opt/alt/python33/lib64/python3.3/lib2to3/__pycache__/ |
Current File : //proc/self/root/opt/alt/python33/lib64/python3.3/lib2to3/__pycache__/patcomp.cpython-33.pyc |
� ��f� c @ 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 Gd d � d e � Z d d � Z Gd d � d e � Z i e j d 6e j d 6e j d 6d d 6Z d d � Z d d � Z d d � Z d S( u� Pattern compiler. The grammer is taken from PatternGrammar.txt. The compiler compiles a pattern to a pytree.*Pattern instance. u# Guido van Rossum <guido@python.org>i Ni ( u driveru literalsu tokenu tokenizeu parseu grammar( u pytree( u pygramu PatternGrammar.txtc B s | Ee Z d Z d S( u PatternSyntaxErrorN( u __name__u __module__u __qualname__( u __locals__( ( u4 /opt/alt/python33/lib64/python3.3/lib2to3/patcomp.pyu PatternSyntaxError s u PatternSyntaxErrorc c sw t t j t j t j f � } t j t j | � j � } x7 | D]/ } | \ } } } } } | | k r@ | Vq@ q@ Wd S( u6 Tokenizes a string suppressing significant whitespace.N( u setu tokenu NEWLINEu INDENTu DEDENTu tokenizeu generate_tokensu iou StringIOu readline( u inputu skipu tokensu quintupleu typeu valueu startu endu line_text( ( u4 /opt/alt/python33/lib64/python3.3/lib2to3/patcomp.pyu tokenize_wrapper! s u tokenize_wrapperc B s\ | Ee Z d Z e d d � Z d d d d � Z d d � Z d d d � Z d d � Z d S( u PatternCompilerc C s^ t j | � | _ t j | j � | _ t j | _ t j | _ t j | j d t �| _ d S( u^ Initializer. Takes an optional alternative filename for the pattern grammar. u convertN( u driveru load_grammaru grammaru pygramu Symbolsu symsu python_grammaru pygrammaru python_symbolsu pysymsu Driveru pattern_convert( u selfu grammar_file( ( u4 /opt/alt/python33/lib64/python3.3/lib2to3/patcomp.pyu __init__- s u PatternCompiler.__init__c 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( u= Compiles a pattern string to a nested pytree.*Pattern object.u debugN( u tokenize_wrapperu driveru parse_tokensu parseu ParseErroru PatternSyntaxErroru stru compile_node( u selfu inputu debugu with_treeu tokensu rootu e( ( u4 /opt/alt/python33/lib64/python3.3/lib2to3/patcomp.pyu compile_pattern8 s %u PatternCompiler.compile_patternc s� | j � j j k r% | j d } n | j � j j k r� � f d d � | j d d d � D� } t | � d k r} | d St j d d � | D� d d d d �} | j � S| j � j j k r"� f d d � | j D� } t | � d k r� | d St j | g d d d d �} | j � S| j � j j k rl� j | j d d � � } t j | � } | j � S| j � j j k s�t � d } | j } t | � d k r�| d j t j k r�| d j } | d d � } n d } t | � d k r,| d j � j j k r,| d } | d d � } n � j | | � } | d k r�| j � j j k set � | j } | d } | j t j k r�d } t j } n� | j t j k r�d } t j } n� | j t j k rH| d j t j k s�t � t | � d k st � � j | d � } } t | � d k rT� j | d � } qTn d sTt � | d k sl| d k r�| j � } t j | g g d | d | �} q�n | d k r�| | _ n | j � S( uX Compiles a node, recursively. This is one big switch on the node type. i c s g | ] } � j | � � q S( ( u compile_node( u .0u ch( u self( u4 /opt/alt/python33/lib64/python3.3/lib2to3/patcomp.pyu <listcomp>P s u0 PatternCompiler.compile_node.<locals>.<listcomp>Ni i c S s g | ] } | g � q S( ( ( u .0u a( ( u4 /opt/alt/python33/lib64/python3.3/lib2to3/patcomp.pyu <listcomp>S s u minu maxc s g | ] } � j | � � q S( ( u compile_node( u .0u ch( u self( u4 /opt/alt/python33/lib64/python3.3/lib2to3/patcomp.pyu <listcomp>W s i i i����i����i����i����( i i F( u typeu symsu Matcheru childrenu Alternativesu lenu pytreeu WildcardPatternu optimizeu Alternativeu NegatedUnitu compile_basicu NegatedPatternu Unitu AssertionErroru Noneu tokenu EQUALu valueu Repeateru STARu HUGEu PLUSu LBRACEu RBRACEu get_intu Falseu name( u selfu nodeu altsu pu unitsu patternu nameu nodesu repeatu childrenu childu minu max( ( u selfu4 /opt/alt/python33/lib64/python3.3/lib2to3/patcomp.pyu compile_nodeD sh )( ( + 'u PatternCompiler.compile_nodec C s t | � d k s t � | d } | j t j k rb t t j | j � � } t j t | � | � S| j t j k r|| j } | j � r� | t k r� t d | � � n | d d � r� t d � � n t j t | � S| d k r� d } nF | j d � s3t | j | d � } | d k r3t d | � � q3n | d d � rc| j | d j d � g } n d } t j | | � Sns | j d k r�| j | d � S| j d k r�| d k s�t � | j | d � } t j | g g d d d d �Sd st | � � d S( Ni i u Invalid token: %ru Can't have details for tokenu anyu _u Invalid symbol: %ru (u [u minu maxF( u lenu AssertionErroru typeu tokenu STRINGu stru literalsu evalStringu valueu pytreeu LeafPatternu _type_of_literalu NAMEu isupperu TOKEN_MAPu PatternSyntaxErroru Noneu startswithu getattru pysymsu compile_nodeu childrenu NodePatternu WildcardPatternu False( u selfu nodesu repeatu nodeu valueu typeu contentu subpattern( ( u4 /opt/alt/python33/lib64/python3.3/lib2to3/patcomp.pyu compile_basic� s<