AlkantarClanX12

Your IP : 3.145.95.233


Current Path : /proc/thread-self/root/opt/alt/python33/lib64/python3.3/lib2to3/__pycache__/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python33/lib64/python3.3/lib2to3/__pycache__/pytree.cpython-33.pyc

�
��f�nc@sdZdZddlZddlZddlmZdZiadd�ZGdd	�d	e	�Z
Gd
d�de
�ZGdd
�d
e
�Zdd�Z
Gdd�de	�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Zdd�ZdS(u�
Python parse tree definitions.

This is a very concrete parse tree; we need to keep every token and
even the comments and whitespace between tokens.

There's also a pattern matching implementation here.
u#Guido van Rossum <guido@python.org>iN(uStringIOi���cCshtsXddlm}x?|jj�D]+\}}t|�tkr&|t|<q&q&Wntj||�S(Ni(upython_symbols(u_type_reprsupygramupython_symbolsu__dict__uitemsutypeuintu
setdefault(utype_numupython_symbolsunameuval((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu	type_reprsu	type_reprcBs(|EeZdZdZd&Zd&ZfZd'Z	d'Z
dd�Zdd�Zd&Z
dd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zedd��Zedd��Zdd�Zdd�Zd d!�Zejd(kr$d$d%�Znd&S()uBaseu�
    Abstract base class for Node and Leaf.

    This provides some default functionality and boilerplate using the
    template pattern.

    A node may be a subnode of at most one parent.
    cOs%|tk	std��tj|�S(u7Constructor that prevents Base from being instantiated.uCannot instantiate Base(uBaseuAssertionErroruobjectu__new__(uclsuargsukwds((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu__new__2suBase.__new__cCs#|j|jk	rtS|j|�S(uW
        Compare two nodes for equality.

        This calls the method _eq().
        (u	__class__uNotImplementedu_eq(uselfuother((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu__eq__7suBase.__eq__cCs$|j|jk	rtS|j|�S(uY
        Compare two nodes for inequality.

        This calls the method _eq().
        (u	__class__uNotImplementedu_eq(uselfuother((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu__ne__CsuBase.__ne__cCs
t�dS(u_
        Compare two nodes for equality.

        This is called by __eq__ and __ne__.  It is only called if the two nodes
        have the same type.  This must be implemented by the concrete subclass.
        Nodes should be considered equal if they have the same structure,
        ignoring the prefix string and other context information.
        N(uNotImplementedError(uselfuother((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu_eqMs	uBase._eqcCs
t�dS(ur
        Return a cloned (deep) copy of self.

        This must be implemented by the concrete subclass.
        N(uNotImplementedError(uself((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyucloneXsu
Base.clonecCs
t�dS(ux
        Return a post-order iterator for the tree.

        This must be implemented by the concrete subclass.
        N(uNotImplementedError(uself((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu
post_order`suBase.post_ordercCs
t�dS(uw
        Return a pre-order iterator for the tree.

        This must be implemented by the concrete subclass.
        N(uNotImplementedError(uself((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu	pre_orderhsuBase.pre_ordercCs2|jdk	s!tt|���|dk	s3t�t|t�sN|g}ng}d}xt|jjD]f}||kr�|s�t|jj||f��|dk	r�|j|�nd}qg|j
|�qgW|s�t|j||f��|jj�||j_x|D]}|j|_qWd|_dS(u/Replace this node with a new one in the parent.NFT(uparentuNoneuAssertionErrorustru
isinstanceulistuFalseuchildrenuextenduTrueuappenduchanged(uselfunewu
l_childrenufounduchux((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyureplaceps&!"	

uBase.replacecCs=|}x-t|t�s5|js%dS|jd}q	W|jS(u9Return the line number which generated the invocant node.Ni(u
isinstanceuLeafuchildrenulineno(uselfunode((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu
get_lineno�s	uBase.get_linenocCs&|jr|jj�nd|_dS(NT(uparentuchangeduTrueuwas_changed(uself((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyuchanged�s	uBase.changedcCsf|jrbxVt|jj�D]?\}}||kr|jj�|jj|=d|_|SqWndS(u�
        Remove the node from the tree. Returns the position of the node in its
        parent's children before it was removed.
        N(uparentu	enumerateuchildrenuchangeduNone(uselfuiunode((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyuremove�s	

	uBase.removecCsx|jdkrdSx^t|jj�D]J\}}||kr&y|jj|dSWqptk
rldSYqpXq&q&WdS(u�
        The node immediately following the invocant in their parent's children
        list. If the invocant does not have a next sibling, it is None
        iN(uparentuNoneu	enumerateuchildrenu
IndexError(uselfuiuchild((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyunext_sibling�s
uBase.next_siblingcCsh|jdkrdSxNt|jj�D]:\}}||kr&|dkrNdS|jj|dSq&WdS(u�
        The node immediately preceding the invocant in their parent's children
        list. If the invocant does not have a previous sibling, it is None.
        iiN(uparentuNoneu	enumerateuchildren(uselfuiuchild((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyuprev_sibling�suBase.prev_siblingccs4x-|jD]"}x|j�D]}|VqWq
WdS(N(uchildrenuleaves(uselfuchildux((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyuleaves�suBase.leavescCs$|jdkrdSd|jj�S(Nii(uparentuNoneudepth(uself((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyudepth�su
Base.depthcCs |j}|dkrdS|jS(u�
        Return the string immediately following the invocant node. This is
        effectively equivalent to node.next_sibling.prefix
        uN(unext_siblinguNoneuprefix(uselfunext_sib((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu
get_suffix�s	uBase.get_suffixiicCst|�jd�S(Nuascii(ustruencode(uself((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu__str__�suBase.__str__NF(ii( u__name__u
__module__u__qualname__u__doc__uNoneutypeuparentuchildrenuFalseuwas_changeduwas_checkedu__new__u__eq__u__hash__u__ne__u_equcloneu
post_orderu	pre_orderureplaceu
get_linenouchangeduremoveupropertyunext_siblinguprev_siblinguleavesudepthu
get_suffixusysuversion_infou__str__(u
__locals__((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyuBase s2	

	

uBasecBs�|EeZdZdZddddd�Zdd�Zdd�Zej	dkr[eZ
nd
d�Zdd
�Zdd�Z
dd�Zdd�Zdd�Zeee�Zdd�Zdd�Zdd�ZdS(uNodeu+Concrete implementation for interior nodes.cCs�|dkst|��||_t|�|_x;|jD]0}|jdksatt|���||_q:W|dk	r�||_n|r�|dd�|_n	d|_dS(u�
        Initializer.

        Takes a type constant (a symbol number >= 256), a sequence of
        child nodes, and an optional context keyword argument.

        As a side effect, the parent pointers of the children are updated.
        iN(	uAssertionErrorutypeulistuchildrenuparentuNoneurepruprefixufixers_applied(uselfutypeuchildrenucontextuprefixufixers_applieduch((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu__init__�s	!
u
Node.__init__cCs#d|jjt|j�|jfS(u)Return a canonical string representation.u
%s(%s, %r)(u	__class__u__name__u	type_reprutypeuchildren(uself((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu__repr__�su
Node.__repr__cCsdjtt|j��S(uk
        Return a pretty string representation.

        This reproduces the input source exactly.
        u(ujoinumapustruchildren(uself((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu__unicode__�suNode.__unicode__iicCs"|j|jf|j|jfkS(uCompare two nodes for equality.(utypeuchildren(uselfuother((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu_eq	suNode._eqcCs)t|jdd�|jD�d|j�S(u$Return a cloned (deep) copy of self.cSsg|]}|j��qS((uclone(u.0uch((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu
<listcomp>s	uNode.clone.<locals>.<listcomp>ufixers_applied(uNodeutypeuchildrenufixers_applied(uself((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyuclone
su
Node.cloneccs9x-|jD]"}x|j�D]}|VqWq
W|VdS(u*Return a post-order iterator for the tree.N(uchildrenu
post_order(uselfuchildunode((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu
post_orders
uNode.post_orderccs9|Vx-|jD]"}x|j�D]}|Vq"WqWdS(u)Return a pre-order iterator for the tree.N(uchildrenu	pre_order(uselfuchildunode((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu	pre_ordersuNode.pre_ordercCs|js
dS|jdjS(uO
        The whitespace and comments preceding this node in the input.
        ui(uchildrenuprefix(uself((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu_prefix_getter s	uNode._prefix_gettercCs |jr||jd_ndS(Ni(uchildrenuprefix(uselfuprefix((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu_prefix_setter(s	uNode._prefix_settercCs4||_d|j|_||j|<|j�dS(u�
        Equivalent to 'node.children[i] = child'. This method also sets the
        child's parent attribute appropriately.
        N(uparentuNoneuchildrenuchanged(uselfuiuchild((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu	set_child.s	
uNode.set_childcCs*||_|jj||�|j�dS(u�
        Equivalent to 'node.children.insert(i, child)'. This method also sets
        the child's parent attribute appropriately.
        N(uparentuchildrenuinsertuchanged(uselfuiuchild((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyuinsert_child8s	uNode.insert_childcCs'||_|jj|�|j�dS(u�
        Equivalent to 'node.children.append(child)'. This method also sets the
        child's parent attribute appropriately.
        N(uparentuchildrenuappenduchanged(uselfuchild((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyuappend_childAs	uNode.append_childN(ii(u__name__u
__module__u__qualname__u__doc__uNoneu__init__u__repr__u__unicode__usysuversion_infou__str__u_equcloneu
post_orderu	pre_orderu_prefix_getteru_prefix_setterupropertyuprefixu	set_childuinsert_childuappend_child(u
__locals__((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyuNode�s$	
	uNodecBs�|EeZdZdZdZdZdZddgdd�Zdd�Z	dd	�Z
ejdkrme
Z
ndd�Zd
d�Zdd�Zdd�Zdd�Zdd�Zdd�Zeee�ZdS(uLeafu'Concrete implementation for leaf nodes.uicCs�d|kodkns(t|��|dk	rR|\|_\|_|_n||_||_|dk	r|||_n|dd�|_dS(u�
        Initializer.

        Takes a type constant (a token number < 256), a string value, and an
        optional context keyword argument.
        iiN(uAssertionErroruNoneu_prefixulinenoucolumnutypeuvalueufixers_applied(uselfutypeuvalueucontextuprefixufixers_applied((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu__init__Ts
(		u
Leaf.__init__cCsd|jj|j|jfS(u)Return a canonical string representation.u
%s(%r, %r)(u	__class__u__name__utypeuvalue(uself((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu__repr__gsu
Leaf.__repr__cCs|jt|j�S(uk
        Return a pretty string representation.

        This reproduces the input source exactly.
        (uprefixustruvalue(uself((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu__unicode__msuLeaf.__unicode__icCs"|j|jf|j|jfkS(uCompare two nodes for equality.(utypeuvalue(uselfuother((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu_eqxsuLeaf._eqcCs4t|j|j|j|j|jffd|j�S(u$Return a cloned (deep) copy of self.ufixers_applied(uLeafutypeuvalueuprefixulinenoucolumnufixers_applied(uself((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyuclone|su
Leaf.cloneccs	|VdS(N((uself((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyuleaves�suLeaf.leavesccs	|VdS(u*Return a post-order iterator for the tree.N((uself((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu
post_order�suLeaf.post_orderccs	|VdS(u)Return a pre-order iterator for the tree.N((uself((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu	pre_order�suLeaf.pre_ordercCs|jS(uP
        The whitespace and comments preceding this token in the input.
        (u_prefix(uself((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu_prefix_getter�suLeaf._prefix_gettercCs|j�||_dS(N(uchangedu_prefix(uselfuprefix((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu_prefix_setter�s
uLeaf._prefix_setterN(ii(u__name__u
__module__u__qualname__u__doc__u_prefixulinenoucolumnuNoneu__init__u__repr__u__unicode__usysuversion_infou__str__u_equcloneuleavesu
post_orderu	pre_orderu_prefix_getteru_prefix_setterupropertyuprefix(u
__locals__((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyuLeafKs&	uLeafcCsk|\}}}}|s'||jkrTt|�dkrA|dSt||d|�St||d|�SdS(u�
    Convert raw node information to a Node or Leaf instance.

    This is passed to the parser driver which calls it whenever a reduction of a
    grammar rule produces a new complete node, so that the tree is build
    strictly bottom-up.
    iiucontextN(u
number2symbolulenuNodeuLeaf(ugruraw_nodeutypeuvalueucontextuchildren((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyuconvert�suconvertcBsz|EeZdZdZdZdZdZdd�Zdd�Z	dd�Z
ddd	�Zdd
d�Zdd
�Z
dS(uBasePatternu�
    A pattern is a tree matching pattern.

    It looks for a specific node type (token or symbol), and
    optionally for a specific content.

    This is an abstract base class.  There are three concrete
    subclasses:

    - LeafPattern matches a single leaf node;
    - NodePattern matches a single node (usually non-leaf);
    - WildcardPattern matches a sequence of nodes of variable length.
    cOs%|tk	std��tj|�S(u>Constructor that prevents BasePattern from being instantiated.uCannot instantiate BasePattern(uBasePatternuAssertionErroruobjectu__new__(uclsuargsukwds((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu__new__�suBasePattern.__new__cCsht|j�|j|jg}x!|rA|ddkrA|d=q!Wd|jjdjtt	|��fS(Niu%s(%s)u, i����i����(
u	type_reprutypeucontentunameuNoneu	__class__u__name__ujoinumapurepr(uselfuargs((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu__repr__�suBasePattern.__repr__cCs|S(u�
        A subclass can define this as a hook for optimizations.

        Returns either self or another node with the same effect.
        ((uself((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyuoptimize�suBasePattern.optimizecCs�|jdk	r%|j|jkr%dS|jdk	r~d}|dk	rOi}n|j||�sedS|r~|j|�q~n|dk	r�|jr�|||j<ndS(u#
        Does this pattern exactly match a node?

        Returns True if it matches, False if not.

        If results is not None, it must be a dict which will be
        updated with the nodes matching named subpatterns.

        Default implementation for non-wildcard patterns.
        NFT(utypeuNoneuFalseucontentu	_submatchuupdateunameuTrue(uselfunodeuresultsur((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyumatch�s!	uBasePattern.matchcCs*t|�dkrdS|j|d|�S(u�
        Does this pattern exactly match a sequence of nodes?

        Default implementation for non-wildcard patterns.
        iiF(ulenuFalseumatch(uselfunodesuresults((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu	match_seq�suBasePattern.match_seqccs4i}|r0|j|d|�r0d|fVndS(u}
        Generator yielding all matches for this pattern.

        Default implementation for non-wildcard patterns.
        iiN(umatch(uselfunodesur((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyugenerate_matches�suBasePattern.generate_matchesN(u__name__u
__module__u__qualname__u__doc__uNoneutypeucontentunameu__new__u__repr__uoptimizeumatchu	match_sequgenerate_matches(u
__locals__((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyuBasePattern�s
uBasePatterncBsG|EeZdZddddd�Zddd�Zddd�ZdS(uLeafPatterncCs�|dk	r7d|ko#dkns7t|��n|dk	rgt|t�sgtt|���n||_||_||_dS(up
        Initializer.  Takes optional type, content, and name.

        The type, if given must be a token type (< 256).  If not given,
        this matches any *leaf* node; the content may still be required.

        The content, if given, must be a string.

        If a name is given, the matching node is stored in the results
        dict under that key.
        iiN(uNoneuAssertionErroru
isinstanceustrureprutypeucontentuname(uselfutypeucontentuname((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu__init__s+$		uLeafPattern.__init__cCs&t|t�sdStj|||�S(u*Override match() to insist on a leaf node.F(u
isinstanceuLeafuFalseuBasePatternumatch(uselfunodeuresults((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyumatchsuLeafPattern.matchcCs|j|jkS(u�
        Match the pattern's content to the node's children.

        This assumes the node type matches and self.content is not None.

        Returns True if it matches, False if not.

        If results is not None, it must be a dict which will be
        updated with the nodes matching named subpatterns.

        When returning False, the results dict may still be updated.
        (ucontentuvalue(uselfunodeuresults((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu	_submatchs
uLeafPattern._submatchN(u__name__u
__module__u__qualname__uNoneu__init__umatchu	_submatch(u
__locals__((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyuLeafPatternsuLeafPatterncBs>|EeZdZdZddddd�Zddd�ZdS(uNodePatterncCs�|dk	r'|dks't|��n|dk	r�t|t�sUtt|���t|�}xYt|�D]H\}}t|t�s�t||f��t|t�rnd|_
qnqnWn||_||_||_
dS(ud
        Initializer.  Takes optional type, content, and name.

        The type, if given, must be a symbol type (>= 256).  If the
        type is None this matches *any* single node (leaf or not),
        except if content is not None, in which it only matches
        non-leaf nodes that also match the content pattern.

        The content, if not None, must be a sequence of Patterns that
        must match the node's children exactly.  If the content is
        given, the type must not be None.

        If a name is given, the matching node is stored in the results
        dict under that key.
        iNT(uNoneuAssertionErroru
isinstanceustrureprulistu	enumerateuBasePatternuWildcardPatternuTrueu	wildcardsutypeucontentuname(uselfutypeucontentunameuiuitem((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu__init__2s"!		uNodePattern.__init__cCs�|jrhxXt|j|j�D]A\}}|t|j�kr|dk	r\|j|�ndSqWdSt|j�t|j�kr�dSx9t	|j|j�D]"\}}|j
||�s�dSq�WdS(u�
        Match the pattern's content to the node's children.

        This assumes the node type matches and self.content is not None.

        Returns True if it matches, False if not.

        If results is not None, it must be a dict which will be
        updated with the nodes matching named subpatterns.

        When returning False, the results dict may still be updated.
        NTF(u	wildcardsugenerate_matchesucontentuchildrenulenuNoneuupdateuTrueuFalseuzipumatch(uselfunodeuresultsucuru
subpatternuchild((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu	_submatchOs
	""uNodePattern._submatchNF(u__name__u
__module__u__qualname__uFalseu	wildcardsuNoneu__init__u	_submatch(u
__locals__((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyuNodePattern.suNodePatterncBs�|EeZdZdZddeddd�Zdd�Zddd�Zdd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dS(uWildcardPatternu
    A wildcard pattern can match zero or more nodes.

    This has all the flexibility needed to implement patterns like:

    .*      .+      .?      .{m,n}
    (a b c | d e | f)
    (...)*  (...)+  (...)?  (...){m,n}

    except it always uses non-greedy matching.
    icCs�d|ko"|ko"tkns9t||f��|dk	r�ttt|��}t|�sxtt|���x/|D]$}t|�stt|���qWn||_||_||_	||_
dS(u�
        Initializer.

        Args:
            content: optional sequence of subsequences of patterns;
                     if absent, matches one node;
                     if present, each subsequence is an alternative [*]
            min: optional minimum number of times to match, default 0
            max: optional maximum number of times to match, default HUGE
            name: optional name assigned to this match

        [*] Thus, if content is [[a, b, c], [d, e], [f, g, h]] this is
            equivalent to (a b c | d e | f g h); if content is None,
            this is equivalent to '.' in regular expression terms.
            The min and max parameters work as follows:
                min=0, max=maxint: .*
                min=1, max=maxint: .+
                min=0, max=1: .?
                min=1, max=1: .
            If content is not None, replace the dot with the parenthesized
            list of alternatives, e.g. (a b c | d e | f g h)*
        iN(uHUGEuAssertionErroruNoneutupleumapulenureprucontentuminumaxuname(uselfucontentuminumaxunameualt((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu__init__ys9
%			uWildcardPattern.__init__cCs/d}|jdk	rWt|j�dkrWt|jd�dkrW|jdd}n|jdkr�|jdkr�|jdkr�td|j�S|dk	r�|j|jkr�|j�Sn|jdkr+t|t	�r+|jdkr+|j|jkr+t	|j|j|j|j|j|j�S|S(u+Optimize certain stacked wildcard patterns.iiunameN(
uNoneucontentulenuminumaxuNodePatternunameuoptimizeu
isinstanceuWildcardPattern(uselfu
subpattern((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyuoptimize�s .
!	


uWildcardPattern.optimizecCs|j|g|�S(u'Does this pattern exactly match a node?(u	match_seq(uselfunodeuresults((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyumatch�suWildcardPattern.matchcCsuxn|j|�D]]\}}|t|�kr|dk	ri|j|�|jrit|�||j<qindSqWdS(u4Does this pattern exactly match a sequence of nodes?NTF(ugenerate_matchesulenuNoneuupdateunameulistuTrueuFalse(uselfunodesuresultsucur((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu	match_seq�s
	uWildcardPattern.match_seqccs�|jdkryx�t|jdtt|�|j��D]:}i}|jrg|d|�||j<n||fVq8Wn"|jdkr�|j|�Vntt	d�r�t	j
}t�t	_
nz�yUxN|j|d�D]:\}}|jr|d|�||j<n||fVq�WWn`t
k
rzxK|j|�D]:\}}|jrg|d|�||j<n||fVq8WYnXWdtt	d�r�|t	_
nXdS(u"
        Generator yielding matches for a sequence of nodes.

        Args:
            nodes: sequence of nodes

        Yields:
            (count, results) tuples where:
            count: the match comprises nodes[:count];
            results: dict containing named submatches.
        iNu	bare_nameugetrefcounti(ucontentuNoneurangeuminulenumaxunameu_bare_name_matchesuhasattrusysustderruStringIOu_recursive_matchesuRuntimeErroru_iterative_matches(uselfunodesucounturusave_stderr((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyugenerate_matches�s./			
	u WildcardPattern.generate_matchesccsft|�}d|jkr)difVng}xO|jD]D}x;t||�D]*\}}||fV|j||f�qOWq9Wx�|rag}x�|D]�\}}	||kr�||jkr�x�|jD]�}x|t|||d��D]a\}
}|
dkr�i}|j|	�|j|�||
|fV|j||
|f�q�q�Wq�Wq�q�W|}q�WdS(u(Helper to iteratively yield the matches.iN(ulenuminucontentugenerate_matchesuappendumaxuupdate(uselfunodesunodelenuresultsualtucurunew_resultsuc0ur0uc1ur1((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu_iterative_matches�s*	&

)u"WildcardPattern._iterative_matchescCs�d}i}d}t|�}x_|r||krd}x?|jD]4}|dj|||�rD|d7}d}PqDqDWq!W|d|�||j<||fS(u(Special optimized matcher for bare_name.iiNFT(uFalseulenuTrueucontentumatchuname(uselfunodesucounturudoneumaxuleaf((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu_bare_name_matchess
u"WildcardPattern._bare_name_matchesc	cs�|jdk	st�||jkr2difVn||jkr�x�|jD]�}x}t||�D]l\}}x]|j||d�|d�D];\}}i}|j|�|j|�|||fVq�WqaWqKWndS(u(Helper to recursively yield the matches.iNi(ucontentuNoneuAssertionErroruminumaxugenerate_matchesu_recursive_matchesuupdate(	uselfunodesucountualtuc0ur0uc1ur1ur((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu_recursive_matchess-

u"WildcardPattern._recursive_matchesN(u__name__u
__module__u__qualname__u__doc__uNoneuHUGEu__init__uoptimizeumatchu	match_sequgenerate_matchesu_iterative_matchesu_bare_name_matchesu_recursive_matches(u
__locals__((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyuWildcardPatternks#-uWildcardPatterncBsG|EeZdZd	dd�Zdd�Zdd�Zdd�Zd	S(
uNegatedPatterncCs=|dk	r0t|t�s0tt|���n||_dS(u
        Initializer.

        The argument is either a pattern or None.  If it is None, this
        only matches an empty sequence (effectively '$' in regex
        lingo).  If it is not None, this matches whenever the argument
        pattern doesn't have any matches.
        N(uNoneu
isinstanceuBasePatternuAssertionErrorureprucontent(uselfucontent((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu__init__)s	$uNegatedPattern.__init__cCsdS(NF(uFalse(uselfunode((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyumatch6suNegatedPattern.matchcCst|�dkS(Ni(ulen(uselfunodes((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu	match_seq:suNegatedPattern.match_seqccse|jdkr2t|�dkradifVqan/x!|jj|�D]
\}}dSWdifVdS(Ni(ucontentuNoneulenugenerate_matches(uselfunodesucur((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyugenerate_matches>suNegatedPattern.generate_matchesN(u__name__u
__module__u__qualname__uNoneu__init__umatchu	match_sequgenerate_matches(u
__locals__((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyuNegatedPattern's
uNegatedPatternc	cs�|sdifVn�|d|dd�}}x�|j|�D]y\}}|s_||fVq?xVt|||d��D];\}}i}|j|�|j|�|||fVqyWq?WdS(uR
    Generator yielding matches for a sequence of patterns and nodes.

    Args:
        patterns: a sequence of patterns
        nodes: a sequence of nodes

    Yields:
        (count, results) tuples where:
        count: the entire sequence of patterns matches nodes[:count];
        results: dict containing named submatches.
        iiN(ugenerate_matchesuupdate(	upatternsunodesupurestuc0ur0uc1ur1ur((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyugenerate_matchesJs
&

ugenerate_matches(u__doc__u
__author__usysuwarningsuiouStringIOuHUGEu_type_reprsu	type_repruobjectuBaseuNodeuLeafuconvertuBasePatternuLeafPatternuNodePatternuWildcardPatternuNegatedPatternugenerate_matches(((u3/opt/alt/python33/lib64/python3.3/lib2to3/pytree.pyu<module>s"
�pNV,=�#