ok
Direktori : /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.pyo |
� zyMa� 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 sK | 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 � Sd } | 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 } | d } | j t j k rfd } t j } nx | j t j k r�d } t j } nT | j t j k r�� j | d � } } t | � d k r�� j | d � } q�n | d k s�| d k r)| j � } t j | g g d | d | �} q)n | d k rA| | _ 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����( u typeu symsu Matcheru childrenu Alternativesu lenu pytreeu WildcardPatternu optimizeu Alternativeu NegatedUnitu compile_basicu NegatedPatternu Noneu tokenu EQUALu valueu Repeateru STARu HUGEu PLUSu LBRACEu get_intu 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 s^ )( ( + 'u PatternCompiler.compile_nodec C s� | d } | j t j k rJ t t j | j � � } t j t | � | � S| j t j k rd| 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 � st | j | d � } | d k rt d | � � qn | d d � rK| j | d j d � g } n d } t j | | � Sna | j d k r�| j | d � S| j d k r�| j | d � } t j | g g d d d d �Sd S( Ni u Invalid token: %ri u Can't have details for tokenu anyu _u Invalid symbol: %ru (u [u minu max( u 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 WildcardPattern( u selfu nodesu repeatu nodeu valueu typeu contentu subpattern( ( u4 /opt/alt/python33/lib64/python3.3/lib2to3/patcomp.pyu compile_basic� s8 u PatternCompiler.compile_basicc C s t | j � S( N( u intu value( u selfu node( ( u4 /opt/alt/python33/lib64/python3.3/lib2to3/patcomp.pyu get_int� s u PatternCompiler.get_intNF( u __name__u __module__u __qualname__u _PATTERN_GRAMMAR_FILEu __init__u Falseu compile_patternu compile_nodeu Noneu compile_basicu get_int( u __locals__( ( u4 /opt/alt/python33/lib64/python3.3/lib2to3/patcomp.pyu PatternCompiler+ s G#u PatternCompileru NAMEu STRINGu NUMBERu TOKENc C s9 | d j � r t j S| t j k r1 t j | Sd Sd S( Ni ( u isalphau tokenu NAMEu grammaru opmapu None( u value( ( u4 /opt/alt/python33/lib64/python3.3/lib2to3/patcomp.pyu _type_of_literal� s u _type_of_literalc C sW | \ } } } } | s'