AlkantarClanX12

Your IP : 3.129.42.198


Current Path : /opt/alt/python312/lib64/python3.12/lib2to3/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/lib2to3/__pycache__/pytree.cpython-312.pyc

�

�Q�fFm����dZdZddlZddlmZdZiad�ZGd�de�Z	Gd	�d
e	�Z
Gd�de	�Zd
�ZGd�de�Z
Gd�de
�ZGd�de
�ZGd�de
�ZGd�de
�Zd�Zy)z�
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.
z#Guido van Rossum <guido@python.org>�N)�StringIOi���c���tsDddlm}|jj	�D]!\}}t|�tk(s�|t|<�#tj||�S)N�)�python_symbols)�_type_reprs�pygramr�__dict__�items�type�int�
setdefault)�type_numr�name�vals    �5/opt/alt/python312/lib64/python3.12/lib2to3/pytree.py�	type_reprrsO���*�(�0�0�6�6�8�I�D�#��C�y�C��D��S�!1�9��!�!�(�H�5�5�c��eZdZdZdZdZdZdZdZd�Z	d�Z
dZd�Zd�Z
d	�Zd
�Zd�Zd�Zd
�Zd�Zed��Zed��Zd�Zd�Zd�Zej6dkrd�Zyy)�Basez�
    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.
    N�Fc�J�|tusJd��tj|�S)z7Constructor that prevents Base from being instantiated.zCannot instantiate Base)r�object�__new__��cls�args�kwdss   rrzBase.__new__1s#���$��9� 9�9���~�~�c�"�"rc�`�|j|jurtS|j|�S)zW
        Compare two nodes for equality.

        This calls the method _eq().
        )�	__class__�NotImplemented�_eq��self�others  r�__eq__zBase.__eq__6s(���>�>����0�!�!��x�x���rc��t�)a_
        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.
        ��NotImplementedErrorr"s  rr!zBase._eqBs
��"�!rc��t�)zr
        Return a cloned (deep) copy of self.

        This must be implemented by the concrete subclass.
        r'�r#s r�clonez
Base.cloneM�
��"�!rc��t�)zx
        Return a post-order iterator for the tree.

        This must be implemented by the concrete subclass.
        r'r*s r�
post_orderzBase.post_orderUr,rc��t�)zw
        Return a pre-order iterator for the tree.

        This must be implemented by the concrete subclass.
        r'r*s r�	pre_orderzBase.pre_order]r,rc��|j�Jt|���|�J�t|t�s|g}g}d}|jjD]M}||ur6|rJ|jj||f��|�|j|�d}�=|j
|��O|sJ|j||f��|jj�||j_|D]}|j|_�d|_y)z/Replace this node with a new one in the parent.NFT)�parent�str�
isinstance�list�children�extend�append�changed)r#�new�
l_children�found�ch�xs      r�replacezBase.replacees����{�{�&�1��D�	�1�&������#�t�$��%�C��
����+�+�&�&�B��T�z� �C�4�;�;�#7�#7��s�"C�C�y��?��%�%�c�*����!�!�"�%�'��0�t�}�}�d�C�0�0�u�������)������A��{�{�A�H����rc��|}t|t�s-|jsy|jd}t|t�s�-|jS)z9Return the line number which generated the invocant node.Nr)r4�Leafr6�lineno�r#�nodes  r�
get_linenozBase.get_lineno|sA�����T�4�(��=�=���=�=��#�D��T�4�(��{�{�rc�^�|jr|jj�d|_y)NT)r2r9�was_changedr*s rr9zBase.changed�s!���;�;��K�K���!���rc���|jrht|jj�D]E\}}||us�|jj�|jj|=d|_|cSyy)z�
        Remove the node from the tree. Returns the position of the node in its
        parent's children before it was removed.
        N)r2�	enumerater6r9)r#�irDs   r�removezBase.remove�sb��
�;�;�$�T�[�[�%9�%9�:���4��4�<��K�K�'�'�)����,�,�Q�/�"&�D�K��H�;�rc���|j�yt|jj�D](\}}||us�	|jj|dzcSy#t$rYywxYw)z�
        The node immediately following the invocant in their parent's children
        list. If the invocant does not have a next sibling, it is None
        Nr)r2rIr6�
IndexError�r#rJ�childs   r�next_siblingzBase.next_sibling�si���;�;���"�$�+�+�"6�"6�7�H�A�u���}� ��;�;�/�/��!��4�4�8��"� �� �s�A�	A&�%A&c��|j�yt|jj�D].\}}||us�|dk(ry|jj|dz
cSy)z�
        The node immediately preceding the invocant in their parent's children
        list. If the invocant does not have a previous sibling, it is None.
        Nrr)r2rIr6rNs   r�prev_siblingzBase.prev_sibling�sZ���;�;���"�$�+�+�"6�"6�7�H�A�u���}���6���{�{�+�+�A�a�C�0�0�	8rc#�bK�|jD]}|j�Ed{����y7��w�N)r6�leaves�r#rOs  rrUzBase.leaves�s&�����]�]�E��|�|�~�%�%�#�%�s�#/�-�/c�V�|j�yd|jj�zS)Nrr)r2�depthr*s rrXz
Base.depth�s'���;�;����4�;�;�$�$�&�&�&rc�8�|j}|�y|jS)z�
        Return the string immediately following the invocant node. This is
        effectively equivalent to node.next_sibling.prefix
        �)rP�prefix)r#�next_sibs  r�
get_suffixzBase.get_suffix�s"��
�$�$��������r��rc�6�t|�jd�S)N�ascii)r3�encoder*s r�__str__zBase.__str__�s���t�9�#�#�G�,�,r)�__name__�
__module__�__qualname__�__doc__rr2r6rG�was_checkedrr%�__hash__r!r+r.r0r?rEr9rK�propertyrPrRrUrXr]�sys�version_inforcrrrrrs�����D�
�F��H��K��K�#�
��H�	"�"�"�"��.� �
�� �� � �
1��
1�&�'�
����&� �	-�!rrc��eZdZdZ			dd�Zd�Zd�ZejdkDreZ	d�Z
d�Zd	�Zd
�Z
ed��Zej d��Zd
�Zd�Zd�Zy)�Nodez+Concrete implementation for interior nodes.Nc���|dk\sJ|��||_t|�|_|jD]%}|j�Jt	|���||_�'|�||_|r|dd|_yd|_y)z�
        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.
        �N)rr5r6r2�reprr[�fixers_applied)r#rr6�contextr[rrr=s       r�__init__z
Node.__init__�s|���s�{� �D� �{���	��X���
��-�-�B��9�9�$�.�d�2�h�.�$��B�I� ��� �D�K��"0��"3�D��"&�D�rc�z�|jj�dt|j��d|j�d�S�z)Return a canonical string representation.�(�, �))rrdrrr6r*s r�__repr__z
Node.__repr__�s,��#�~�~�6�6�(����3�#�}�}�.�	.rc�T�djtt|j��S)�k
        Return a pretty string representation.

        This reproduces the input source exactly.
        rZ)�join�mapr3r6r*s r�__unicode__zNode.__unicode__�s���w�w�s�3��
�
�.�/�/rr^c�d�|j|jf|j|jfk(S�zCompare two nodes for equality.)rr6r"s  rr!zNode._eq�s'���	�	�4�=�=�)�e�j�j�%�.�.�-I�I�Irc��t|j|jD�cgc]}|j���c}|j��Scc}w�z$Return a cloned (deep) copy of self.)rr)rnrr6r+rr)r#r=s  rr+z
Node.clones<���D�I�I�T�]�]�C�]�r����
�]�C�#'�#6�#6�8�	8��Cs�A	
c#�jK�|jD]}|j�Ed{����|��y7��w�z*Return a post-order iterator for the tree.N)r6r.rVs  rr.zNode.post_orders0�����]�]�E��'�'�)�)�)�#��
�
*�s�#3�1�3c#�jK�|��|jD]}|j�Ed{����y7��w�z)Return a pre-order iterator for the tree.N)r6r0rVs  rr0zNode.pre_orders,�����
��]�]�E����(�(�(�#�(�s�'3�1�3c�N�|jsy|jdjS)zO
        The whitespace and comments preceding this node in the input.
        rZr�r6r[r*s rr[zNode.prefixs#��
�}�}���}�}�Q��&�&�&rc�F�|jr||jd_yy�Nrr��r#r[s  rr[zNode.prefixs���=�=�&,�D�M�M�!��#�rc�x�||_d|j|_||j|<|j�y)z�
        Equivalent to 'node.children[i] = child'. This method also sets the
        child's parent attribute appropriately.
        N)r2r6r9rNs   r�	set_childzNode.set_child s3��
���"&��
�
�a��� ��
�
�a�����rc�j�||_|jj||�|j�y)z�
        Equivalent to 'node.children.insert(i, child)'. This method also sets
        the child's parent attribute appropriately.
        N)r2r6�insertr9rNs   r�insert_childzNode.insert_child*s(��
����
�
���Q��&����rc�h�||_|jj|�|j�y)z�
        Equivalent to 'node.children.append(child)'. This method also sets the
        child's parent attribute appropriately.
        N)r2r6r8r9rVs  r�append_childzNode.append_child3s&��
����
�
���U�#����r�NNN)rdrerfrgrtrzrrkrlrcr!r+r.r0rjr[�setterr�r�r�rrrrnrn�s���5��� $�'�2.�0����&� ���J�8�
�)��'��'��]�]�-��-���rrnc��eZdZdZdZdZdZddgfd�Zd�Zd�Z	e
jdkDre	Zd	�Z
d
�Zd�Zd�Zd
�Zed��Zej(d��Zy)rAz'Concrete implementation for leaf nodes.rZrNc��d|cxkrdksJ|��J|��|�|\|_\|_|_||_||_|�||_|dd|_y)z�
        Initializer.

        Takes a type constant (a token number < 256), a string value, and an
        optional context keyword argument.
        rrpN)�_prefixrB�columnr�valuerr)r#rr�rsr[rrs      rrtz
Leaf.__init__Fsf���D��3��$��$��$��$����7>�4�D�L�4�4�;�����	���
���!�D�L�,�Q�/��rc�h�|jj�d|j�d|j�d�Srv)rrdrr�r*s rrzz
Leaf.__repr__Ys'��#�~�~�6�6�#�y�y�#�z�z�+�	+rc�F�|jt|j�zS)r|)r[r3r�r*s rrzLeaf.__unicode___s���{�{�S����_�,�,rr^c�d�|j|jf|j|jfk(Sr�)rr�r"s  rr!zLeaf._eqjs'���	�	�4�:�:�&�5�:�:�u�{�{�*C�C�Crc��t|j|j|j|j|j
ff|j��Sr�)rArr�r[rBr�rrr*s rr+z
Leaf.clonens=���D�I�I�t�z�z��[�[�4�;�;����"<�=�#'�#6�#6�8�	8rc#�K�|��y�wrTrr*s rrUzLeaf.leavests�����
���c#�K�|��y�wr�rr*s rr.zLeaf.post_orderw������
�r�c#�K�|��y�wr�rr*s rr0zLeaf.pre_order{r�r�c��|jS)zP
        The whitespace and comments preceding this token in the input.
        )r�r*s rr[zLeaf.prefixs��
�|�|�rc�2�|j�||_yrT)r9r�r�s  rr[zLeaf.prefix�s��������r)rdrerfrgr�rBr�rtrzrrkrlrcr!r+rUr.r0rjr[r�rrrrArA=s���1��G�
�F�
�F��� "�0�&+�-����&� ���D�8���������]�]���rrAc��|\}}}}|s||jvr!t|�dk(r|dSt|||��St|||��S)z�
    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.
    rr)rs)�
number2symbol�lenrnrA)�gr�raw_noderr�rsr6s      r�convertr��sX��&.�"�D�%��(��4�2�+�+�+��x�=�A���A�;���D�(�G�4�4��D�%��1�1rc�D�eZdZdZdZdZdZd�Zd�Zd�Z	d	d�Z
d	d�Zd�Zy)
�BasePatterna�
    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.
    Nc�J�|tusJd��tj|�S)z>Constructor that prevents BasePattern from being instantiated.zCannot instantiate BasePattern)r�rrrs   rrzBasePattern.__new__�s%���+�%�G�'G�G�%��~�~�c�"�"rc���t|j�|j|jg}|r|d�|d=|r|d��|jj
�ddj
tt|���d�S)N���rwrxry)	rr�contentrrrdr}r~rq)r#rs  rrzzBasePattern.__repr__�sd���$�)�)�$�d�l�l�D�I�I�>���t�B�x�'��R���t�B�x�'��>�>�2�2�D�I�I�c�$��o�4N�O�Orc��|S)z�
        A subclass can define this as a hook for optimizations.

        Returns either self or another node with the same effect.
        rr*s r�optimizezBasePattern.optimize�s	���rc��|j�|j|jk7ry|j�,d}|�i}|j||�sy|r|j|�|�|jr|||j<y)a#
        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)rr��	_submatch�updater)r#rD�results�rs    r�matchzBasePattern.match�sw���9�9� �T�Y�Y�$�)�)�%;���<�<�#��A��"����>�>�$��*������q�!���4�9�9�!%�G�D�I�I��rc�J�t|�dk7ry|j|d|�S)z�
        Does this pattern exactly match a sequence of nodes?

        Default implementation for non-wildcard patterns.
        rFr)r�r�)r#�nodesr�s   r�	match_seqzBasePattern.match_seq�s'���u�:��?���z�z�%��(�G�,�,rc#�NK�i}|r|j|d|�rd|f��yyy�w)z}
        Generator yielding all matches for this pattern.

        Default implementation for non-wildcard patterns.
        rrN)r�)r#r�r�s   r�generate_matcheszBasePattern.generate_matches�s1����
���T�Z�Z��a��!�,��Q�$�J�-�5�s�#%rT)
rdrerfrgrr�rrrzr�r�r�r�rrrr�r��s7����D��G��D�#�
P���2-�rr�c�$�eZdZdd�Zdd�Zdd�Zy)�LeafPatternNc��|�d|cxkrdksJ|��J|��|� t|t�sJt|���||_||_||_y)ap
        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.
        Nrrp)r4r3rqrr�r)r#rr�rs    rrtzLeafPattern.__init__�s]������?�s�?�(�D�(�?�(�D�(�?����g�s�+�:�T�'�]�:�+���	������	rc�R�t|t�sytj|||�S)z*Override match() to insist on a leaf node.F)r4rAr�r��r#rDr�s   rr�zLeafPattern.match
s$���$��%��� � ��t�W�5�5rc�4�|j|jk(S)�
        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.
        )r�r�r�s   rr�zLeafPattern._submatchs���|�|�t�z�z�)�)rr�rT)rdrerfrtr�r�rrrr�r��s���(6�
*rr�c� �eZdZdZdd�Zdd�Zy)�NodePatternFNc�,�|�|dk\sJ|��|�ot|t�rJt|���t|�}t	|�D]6\}}t|t
�s	J||f��t|t�s�0d|_�8||_||_	||_
y)ad
        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.
        NrpT)r4r3rqr5rIr��WildcardPattern�	wildcardsrr�r)r#rr�rrJ�items      rrtzNodePattern.__init__$s��� ���3�;�$��$�;���!�'�3�/�>��g��>�/��7�m�G�$�W�-���4�!�$��4�?�q�$�i�?�4��d�O�4�%)�D�N�.���	������	rc��|jrVt|j|j�D]2\}}|t	|j�k(s�|�|j|�yyt	|j�t	|j�k7ryt
|j|j�D]\}}|j||�r�yy)r�TF)r�r�r�r6r�r��zipr�)r#rDr��cr��
subpatternrOs       rr�zNodePattern._submatchAs����>�>�(����t�}�}�E���1���D�M�M�*�*��*����q�)��	F�
��t�|�|���D�M�M� 2�2��!$�T�\�\�4�=�=�!A��J���#�#�E�7�3��"B�rr�rT)rdrerfr�rtr�rrrr�r� s���I��:rr�c�N�eZdZdZddedfd�Zd�Zdd�Zdd�Zd�Z	d	�Z
d
�Zd�Zy)
r�a
    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.
    Nrc�,�d|cxkr|cxkr	tksnJ||f��|�Vttt|��}t|�sJt	|���|D]}t|�r�Jt	|���||_||_||_||_y)a�
        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)*
        rN)	�HUGE�tupler~r�rqr��min�maxr)r#r�r�r�r�alts      rrtzWildcardPattern.__init__ks���.�C�&�3�&�$�&�2��c�
�2�&����C��w�/�0�G��w�<�.��g��.�<����3�x�*��c��*�x�������������	rc��d}|j�Et|j�dk(r-t|jd�dk(r|jdd}|jdk(r\|jdk(rM|j�t	|j
��S|�)|j
|j
k(r|j
�S|jdkr�t|t�rx|jdkri|j
|j
k(rPt|j|j|jz|j|jz|j
�S|S)z+Optimize certain stacked wildcard patterns.Nrr)r)	r�r�r�r�r�rr�r4r�)r#r�s  rr�zWildcardPattern.optimize�s���
��L�L�$�������"�s�4�<�<��?�';�q�'@����a���+�J��8�8�q�=�T�X�X��]��|�|�#�"��	�	�2�2��%�4�9�9�
���+G�!�*�*�,�,��H�H��M�j��_�E��N�N�a��D�I�I����$@�"�:�#5�#5�#'�8�8�J�N�N�#:�#'�8�8�J�N�N�#:�#-�?�?�4�
4��rc�(�|j|g|�S)z'Does this pattern exactly match a node?)r�r�s   rr�zWildcardPattern.match�s���~�~�t�f�g�.�.rc���|j|�D]L\}}|t|�k(s�|�5|j|�|jrt	|�||j<yy)z4Does this pattern exactly match a sequence of nodes?TF)r�r�r�rr5)r#r�r�r�r�s     rr�zWildcardPattern.match_seq�sY���)�)�%�0�D�A�q��C��J���&��N�N�1�%��y�y�-1�%�[���	�	�*��
1�rc	#�&K�|j�bt|jdtt|�|j�z�D](}i}|j
r|d|||j
<||f���*y|j
dk(r|j
|���yttd�r#tj}t�t_		|j|d�D])\}}|j
r|d|||j
<||f���+	ttd�rt_	yy#t$r@|j|�D])\}}|j
r|d|||j
<||f���+Y�ewxYw#ttd�rt_	wwxYw�w)a"
        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.
        Nr�	bare_name�getrefcountr)r��ranger�r�r�r�_bare_name_matches�hasattrrk�stderrr�_recursive_matches�RuntimeError�_iterative_matches)r#r��countr��save_stderrs     rr�z WildcardPattern.generate_matches�sd�����<�<���t�x�x��S��U��T�X�X�-F�)F�G�����9�9�#(��%�=�A�d�i�i�L��Q�h��	H�
�Y�Y�+�
%��)�)�%�0�0��s�M�*�!�j�j��%�Z��
�
-� $� 7� 7��q� A�H�E�1��y�y�',�V�e�}��$�)�)����(�N�!B��3�
�.�!,�C�J�/�� �
#�!%� 7� 7�� >�H�E�1��y�y�',�V�e�}��$�)�)����(�N�!?�
#���3�
�.�!,�C�J�/�s=�CF�>D$�E0�F�$AE-�*E0�,E-�-E0�0F�Fc#�K�t|�}d|jk\rdif��g}|jD]/}t||�D]\}}||f��|j	||f�� �1|r�g}|D]�\}}	||ks�||j
ks�|jD]b}t|||d�D]N\}
}|
dkDs�i}|j
|	�|j
|�||
z|f��|j	||
z|f��P�d��|}|r��yy�w)z(Helper to iteratively yield the matches.rN)r�r�r�r�r8r�r�)r#r��nodelenr�r�r�r��new_results�c0�r0�c1�r1s            rr�z"WildcardPattern._iterative_matches�s	�����e�*������=��R�%�K����<�<�C�(��e�4���1���d�
�����1�v�&�5� ���K�!���B���<�B�$�(�(�N�#�|�|��&6�s�E�"�#�J�&G�F�B��!�A�v�$&�� !����� !�����&(�2�g�q�j� 0� +� 2� 2�B��G�Q�<� @�
'H� ,�"�"�G��s�A2C?�5C?�)C?�/A
C?�=C?c���d}i}d}t|�}|sA||kr<d}|jD]#}|dj|||�s�|dz
}d}n|s||kr�<|d|||j<||fS)z(Special optimized matcher for bare_name.rFTrN)r�r�r�r)r#r�r�r��doner��leafs       rr�z"WildcardPattern._bare_name_matches�s����������%�j���5�3�;��D�������7�=�=��u��q�1��Q�J�E� �D��	%��5�3�;��V�e�}��$�)�)���a�x�rc#�VK�|j�J�||jk\rdif��||jkrs|jD]c}t||�D]R\}}|j	||d|dz�D]2\}}i}|j|�|j|�||z|f���4�T�eyy�w)z(Helper to recursively yield the matches.Nrr)r�r�r�r�r�r�)	r#r�r�r�r�r�r�r�r�s	         rr�z"WildcardPattern._recursive_matches
s������|�|�'�'�'��D�H�H���R�%�K��4�8�8���|�|��.�s�E�:�F�B��"&�"9�"9�%���*�e�A�g�"N���B������������� �2�g�q�j�(�	#O�;�$��s�B'B)rT)
rdrerfrgr�rtr�r�r�r�r�r�r�rrrr�r�]s<��
� $���4�!�F�&/�	�+-�Z"�:� )rr�c�&�eZdZdd�Zd�Zd�Zd�Zy)�NegatedPatternNc�V�|� t|t�sJt|���||_y)a
        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)r4r�rqr�)r#r�s  rrtzNegatedPattern.__init__s*�����g�{�3�B�T�'�]�B�3���rc��y)NFrrCs  rr�zNegatedPattern.match(s��rc��t|�dk(Sr�)r�)r#r�s  rr�zNegatedPattern.match_seq,s���5�z�Q��rc#�K�|j�t|�dk(rdif��yy|jj|�D]\}}ydif��y�wr�)r�r�r�)r#r�r�r�s    rr�zNegatedPattern.generate_matches0sT�����<�<���5�z�Q����e������5�5�e�<���1��=��R�%�K�s�AArT)rdrerfrtr�r�r�rrrr�r�s�����	rr�c#�K�|sdif��y|d|dd}}|j|�D]R\}}|s||f���t|||d�D]2\}}i}|j|�|j|�||z|f���4�Ty�w)aR
    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.
        rrN)r�r�)	�patternsr��p�restr�r�r�r�r�s	         rr�r�<s��������e���1�+�x���|�4���(�(��/�F�B����"�f��.�t�U�2�3�Z�@�F�B���A��H�H�R�L��H�H�R�L��r�'�1�*�$�	A�	0�s�A;A=)rg�
__author__rk�iorr�rrrrrnrAr�r�r�r�r�r�r�rrr�<module>r�s����3�
�
������6�n-�6�n-�`k�4�k�\L�4�L�\2�&S�&�S�l)*�+�)*�X:�+�:�zy)�k�y)�x �[� �F%r