Your IP : 18.216.150.124
�
�/�gFm���dZdZddlZddlmZdZiad�ZGd�de��Z Gd �d
e ��Z
Gd�de ��Zd
�ZGd�de��Z
Gd�de
��ZGd�de
��ZGd�de
��ZGd�de
��Zd�ZdS)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���tsGddlm}|j���D]'\}}t|��tkr
|t|<�(t�||��S)N�)�python_symbols)�_type_reprs�pygramr�__dict__�items�type�int�
setdefault)�type_numr�name�vals �5/opt/alt/python311/lib64/python3.11/lib2to3/pytree.py� type_reprrsq���9�*�*�*�*�*�*�(�0�6�6�8�8� 9� 9�I�D�#��C�y�y�C���D��S�!1���!�!�(�H�5�5�5�c���eZdZdZdZdZdZdZdZd�Z d�Z
dZd�Zd�Z
d �Zd
�Zd�Zd�Zd
�Zd�Zed���Zed���Zd�Zd�Zd�Zejdkrd�ZdSdS)�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�\�|tus
Jd���t�|��S)z7Constructor that prevents Base from being instantiated.zCannot instantiate Base)r�object�__new__��cls�args�kwdss rrzBase.__new__1s(���$���� 9�����~�~�c�"�"�"rc�V�|j|jurtS|�|��S)zW
Compare two nodes for equality.
This calls the method _eq().
)� __class__�NotImplemented�_eq��self�others r�__eq__zBase.__eq__6s)���>���0�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]N}||ur3|rJ|jj||f���|�|�|��d}�9|�|���O|sJ|j||f���|j���||j_|D]}|j|_�d|_dS)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�replacezBase.replacees���{�&�&��D� � �&�&�&������#�t�$�$� ��%�C��
����+�&� &� &�B��T�z�z� �C�C�4�;�#7��s�"C�C�C�y��?��%�%�c�*�*�*�����!�!�"�%�%�%�%��0�0�t�}�d�C�0�0�0�u��������)����� #� #�A��{�A�H�H�����rc��|}t|t��s+|jsdS|jd}t|t���+|jS)z9Return the line number which generated the invocant node.Nr)r4�Leafr6�lineno�r#�nodes r�
get_linenozBase.get_lineno|sR�����T�4�(�(� $��=�
����=��#�D��T�4�(�(� $��{�rc�T�|jr|j���d|_dS)NT)r2r9�was_changedr*s rr9zBase.changed�s.���;� "��K���!�!�!�����rc��|jrTt|jj��D]<\}}||ur1|j���|jj|=d|_|cS�;dSdS)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�s���
�;� �$�T�[�%9�:�:�
�
���4��4�<�<��K�'�'�)�)�)���,�Q�/�"&�D�K��H�H�H� � � �
�
rc��|j�dSt|jj��D]3\}}||ur* |jj|dzcS#t$rYdSwxYw�4dS)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�s����;���4�"�$�+�"6�7�7� � �H�A�u���}�}� ��;�/��!��4�4�4�4��!� � � ��4�4�4� ����� � s�A�
A�Ac��|j�dSt|jj��D])\}}||ur |dkrdS|jj|dz
cS�*dS)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�su���;���4�"�$�+�"6�7�7� 1� 1�H�A�u���}�}���6�6��4�4��{�+�A�a�C�0�0�0�0�� 1� 1rc#�RK�|jD]}|���Ed{V���dS�N)r6�leaves�r#rOs rrUzBase.leaves�sD�����]� &� &�E��|�|�~�~�%�%�%�%�%�%�%�%� &� &rc�L�|j�dSd|j���zS)Nrr)r2�depthr*s rrXz
Base.depth�s(���;���1��4�;�$�$�&�&�&�&rc�&�|j}|�dS|jS)z�
Return the string immediately following the invocant node. This is
effectively equivalent to node.next_sibling.prefix
N�)rP�prefix)r#�next_sibs r�
get_suffixzBase.get_suffix�s��
�$�����2���r��rc�F�t|���d��S)N�ascii)r3�encoder*s r�__str__zBase.__str__�s���t�9�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� "� "� "�"�"�"�"�"�"�"�"�"����.��� � � �
���� � ��X� � �
1�
1��X�
1�&�&�&�'�'�'�
�����&� � � -� -� -� -� -�!� rrc��eZdZdZ dd�Zd�Zd�ZejdkreZ d�Z
d�Zd �Zd
�Z
ed���Zejd���Zd
�Zd�Zd�ZdS)�Nodez+Concrete implementation for interior nodes.Nc��|dks
J|���||_t|��|_|jD]'}|j�Jt |�����||_�(|�||_|r|dd�|_dSd|_dS)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�$�$�d�2�h�h�$�$�$��B�I�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__�s6��#�~�6�6�6�(���3�3�3�3�#�}�}�}�.� .rc�\�d�tt|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�>�|j|jf|j|jfkS�zCompare two nodes for equality.)rr6r"s rr!zNode._eq�s��� �4�=�)�e�j�%�.�-I�I�Irc�X�t|jd�|jD��|j���S)�$Return a cloned (deep) copy of self.c�6�g|]}|�����Sr)r+)�.0r=s r�
<listcomp>zNode.clone.<locals>.<listcomp>s ��C�C�C�r����
�
�C�C�Cr�rr)rnrr6rrr*s rr+z
Node.clones6���D�I�C�C�T�]�C�C�C�#'�#6�8�8�8� 8rc#�ZK�|jD]}|���Ed{V���|V�dS�z*Return a post-order iterator for the tree.N)r6r.rVs rr.zNode.post_ordersK�����]� *� *�E��'�'�)�)�)�)�)�)�)�)�)�)��
�
�
�
�
rc#�ZK�|V�|jD]}|���Ed{V���dS�z)Return a pre-order iterator for the tree.N)r6r0rVs rr0zNode.pre_ordersO�����
�
�
��]� )� )�E����(�(�(�(�(�(�(�(�(�(� )� )rc�8�|jsdS|jdjS)zO
The whitespace and comments preceding this node in the input.
rZr�r6r[r*s rr[zNode.prefixs#��
�}� ��2��}�Q��&�&rc�<�|jr||jd_dSdS�Nrr��r#r[s rr[zNode.prefixs+���=� -�&,�D�M�!��#�#�#� -� -rc�t�||_d|j|_||j|<|���dS)z�
Equivalent to 'node.children[i] = child'. This method also sets the
child's parent attribute appropriately.
N)r2r6r9rNs r� set_childzNode.set_child s7��
���"&��
�a��� ��
�a���������rc�r�||_|j�||��|���dS)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*s4��
����
���Q��&�&�&��������rc�p�||_|j�|��|���dS)z�
Equivalent to 'node.children.append(child)'. This method also sets the
child's parent attribute appropriately.
N)r2r6r8r9rVs r�append_childzNode.append_child3s2��
����
���U�#�#�#��������r�NNN)rdrerfrgrtrzrrkrlrcr!r+r.r0rjr[�setterr�r�r�rrrrnrn�s������5�5��� $�'�'�'�'�2.�.�.�0�0�0���&� � ���J�J�J�8�8�8�
���)�)�)��'�'��X�'��]�-�-��]�-�����������rrnc��eZdZdZdZdZdZddgfd�Zd�Zd�Z e
jdkre Zd �Z
d
�Zd�Zd�Zd
�Zed���Zejd���ZdS)rAz'Concrete implementation for leaf nodes.rZrNc��d|cxkrdksnJ|���|�|\|_\|_|_||_||_|�||_|dd�|_dS)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__Fsr���D�����3������������7>�4�D�L�4�4�;����� ���
���!�D�L�,�Q�Q�Q�/����rc�@�|jj�d|j�d|j�d�Srv)rrdrr�r*s rrzz
Leaf.__repr__Ys,��#�~�6�6�6�#�y�y�y�#�z�z�z�+� +rc�:�|jt|j��zS)r|)r[r3r�r*s rrzLeaf.__unicode___s���{�S���_�_�,�,rr^c�>�|j|jf|j|jfkSr�)rr�r"s rr!zLeaf._eqjs��� �4�:�&�5�:�u�{�*C�C�Crc�l�t|j|j|j|j|jff|j���S)r�r�)rArr�r[rBr�rrr*s rr+z
Leaf.clonens:���D�I�t�z��[�4�;���"<�=�#'�#6�8�8�8� 8rc#�K�|V�dSrTrr*s rrUzLeaf.leavests�����
�
�
�
�
rc#�K�|V�dSr�rr*s rr.zLeaf.post_orderw������
�
�
�
�
rc#�K�|V�dSr�rr*s rr0zLeaf.pre_order{r�rc��|jS)zP
The whitespace and comments preceding this token in the input.
)r�r*s rr[zLeaf.prefixs��
�|�rc�<�|���||_dSrT)r9r�r�s rr[zLeaf.prefix�s������������r)rdrerfrgr�rBr�rtrzrrkrlrcr!r+rUr.r0rjr[r�rrrrArA=s������1�1��G�
�F�
�F��� "�0�0�0�0�&+�+�+�-�-�-���&� � ���D�D�D�8�8�8��������������X���]����]���rrAc��|\}}}}|s ||jvr-t|��dkr|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��sn��&.�"�D�%��(��2�4�2�+�+�+��x�=�=�A����A�;���D�(�G�4�4�4�4��D�%��1�1�1�1rc�F�eZdZdZdZdZdZd�Zd�Zd�Z d d�Z
d d�Zd�ZdS)
�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�\�|tus
Jd���t�|��S)z>Constructor that prevents BasePattern from being instantiated.zCannot instantiate BasePattern)r�rrrs rrzBasePattern.__new__�s.���+�%�%�%�'G�%�%�%��~�~�c�"�"�"rc���t|j��|j|jg}|r|d�
|d=|r|d�
|jj�dd�tt|�����d�S)N���rwrxry) rr�contentrrrdr}r~rq)r#rs rrzzBasePattern.__repr__�sw���$�)�$�$�d�l�D�I�>��� �t�B�x�'��R��� �t�B�x�'��>�2�2�2�D�I�I�c�$��o�o�4N�4N�4N�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|jkrdS|j�5d}|�i}|�||��sdS|r|�|��|�|jr
|||j<dS)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�s����9� �T�Y�$�)�%;�%;��5��<�#��A��"����>�>�$��*�*�
��u��
"����q�!�!�!���4�9��!%�G�D�I���trc�d�t|��dkrdS|�|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�s0���u�:�:��?�?��5��z�z�%��(�G�,�,�,rc#�^K�i}|r$|�|d|��r
d|fV�dSdSdS)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�sS����
��� �T�Z�Z��a��!�,�,� ��Q�$�J�J�J�J�J� � � � rrT)
rdrerfrgrr�rrrzr�r�r�r�rrrr�r��s����������D��G��D�#�#�#�
P�P�P��������2-�-�-�-�����rr�c�&�eZdZdd�Zdd�Zdd�ZdS)�LeafPatternNc���|�d|cxkrdksnJ|���|�,t|t��sJt|�����||_||_||_dS)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__�sn������?�?�?�?�s�?�?�?�?�?�D�?�?�?����g�s�+�+�:�:�T�'�]�]�:�:�+��� ������ � � rc�h�t|t��sdSt�|||��S)z*Override match() to insist on a leaf node.F)r4rAr�r��r#rDr�s rr�zLeafPattern.match
s1���$��%�%� ��5�� � ��t�W�5�5�5rc�"�|j|jkS)�
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�)�)rr�rT)rdrerfrtr�r�rrrr�r��sP����������(6�6�6�6�
*�
*�
*�
*�
*�
*rr�c�"�eZdZdZdd�Zdd�ZdS)�NodePatternFNc�r�|�|dks
J|���|��t|t��rJt|�����t|��}t |��D]B\}}t|t
��sJ||f���t|t��rd|_�C||_||_ ||_
dS)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�m�G�$�W�-�-�
*�
*���4�!�$��4�4�?�?�q�$�i�?�?�4��d�O�4�4�*�%)�D�N���� ������ � � rc��|jrTt|j|j��D]7\}}|t |j��kr|�|�|��dS�8dSt |j��t |j��krdSt
|j|j��D]\}}|�||��sdS�dS)r�NTF)r�r�r�r6r�r��zipr�)r#rDr��cr��
subpatternrOs rr�zNodePattern._submatchAs����>� �(���t�}�E�E�
�
���1���D�M�*�*�*�*��*����q�)�)�)��4�4�+��5��t�|����D�M� 2� 2�2�2��5�!$�T�\�4�=�!A�!A� � ��J���#�#�E�7�3�3�
��u�u�
��trr�rT)rdrerfr�rtr�rrrr�r� sA�������I�����:�����rr�c�P�eZdZdZddedfd�Zd�Zdd�Zdd�Zd�Z d �Z
d
�Zd�ZdS)
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�v�d|cxkr|cxkrtksnJ||f���|�sttt|����}t|��sJt |�����|D](}t|��sJt |������)||_||_||_||_dS)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�&�&�&�&�$�&�&�&�&�&��c�
�&�&�&����C��w�/�/�0�0�G��w�<�<�.�.��g���.�.�<��
+�
+���3�x�x�*�*��c���*�*�x�*������������ � � rc�<�d}|j�It|j��dkr1t|jd��dkr|jdd}|jdkrM|jdkrB|j�t |j���S|�$|j|jkr|���S|jdkrft|t��rQ|jdkrF|j|jkr6t|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�$�������"�"�s�4�<��?�';�';�q�'@�'@���a���+�J��8�q�=�=�T�X��]�]��|�#�"�� �2�2�2�2��%�4�9�
��+G�+G�!�*�*�,�,�,��H��M�M�j��_�E�E�M��N�a���D�I���$@�$@�"�:�#5�#'�8�J�N�#:�#'�8�J�N�#:�#-�?�4�4�
4��rc�0�|�|g|��S)z'Does this pattern exactly match a node?)r�r�s rr�zWildcardPattern.match�s���~�~�t�f�g�.�.�.rc���|�|��D]P\}}|t|��kr8|�3|�|��|jrt |��||j<dS�QdS)z4Does this pattern exactly match a sequence of nodes?NTF)r�r�r�rr5)r#r�r�r�r�s rr�zWildcardPattern.match_seq�sy���)�)�%�0�0� � �D�A�q��C��J�J����&��N�N�1�%�%�%��y�9�-1�%�[�[��� �*��t�t���urc #�.K�|j�^t|jdtt|��|j��z��D]#}i}|jr|d|�||j<||fV��$dS|jdkr|�|��V�dSttd��r$tj }t��t_ |�|d��D]$\}}|jr|d|�||j<||fV��%nJ#t$r=|�
|��D]$\}}|jr|d|�||j<||fV��%YnwxYwttd��r|t_ dSdS#ttd��r|t_ wxYw)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�s������<���t�x��S��U���T�X�-F�-F�)F�G�G�
�
�����9�1�#(��%��=�A�d�i�L��Q�h�����
�
�
�Y�+�
%�
%��)�)�%�0�0�0�0�0�0�0��s�M�*�*�
(�!�j��%�Z�Z��
�
-� $� 7� 7��q� A� A�#�#�H�E�1��y�5�',�V�e�V�}��$�)����(�N�N�N�N�#�� �
#�
#�
#�!%� 7� 7�� >� >�#�#�H�E�1��y�5�',�V�e�V�}��$�)����(�N�N�N�N�#�#�
#�����3�
�.�.�-�!,�C�J�J�J�-�-��7�3�
�.�.�-�!,�C�J�,�,�,�,s+�;D�E1�AE �E1�E � E1�1#Fc#�K�t|��}d|jkrdifV�g}|jD]5}t||��D]"\}}||fV�|�||f���#�6|r�g}|D]�\}} ||kr�||jkr}|jD]u}t|||d���D]Z\}
}|
dkrOi}|�| ��|�|��||
z|fV�|�||
z|f���[�v��|}|��dSdS)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�K�K����<� '� '�C�(��e�4�4�
'�
'���1���d�
�
�
�����1�v�&�&�&�&�
'�
�
"��K�!�
A�
A���B���<�<�B�$�(�N�N�#�|�A�A��&6�s�E�"�#�#�J�&G�&G�A�A�F�B��!�A�v�v�$&�� !������� !�������&(�2�g�q�j� 0� 0� 0� +� 2� 2�B��G�Q�<� @� @� @��
A��"�G��
"�
"�
"�
"�
"rc���d}i}d}t|��}|sE||kr?d}|jD]-}|d�|||��r |dz
}d}n�.|s||k�?|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�j��� �5�3�;�;��D���
�
����7�=�=��u��q�1�1���Q�J�E� �D��E��� �5�3�;�;��V�e�V�}��$�)���a�x�rc#�PK�|j�J�||jkrdifV�||jkr||jD]v}t||��D]a\}}|�||d�|dz��D]:\}}i}|�|��|�|��||z|fV��;�b�udSdS)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����R�%�K�K�K��4�8����|�
)�
)��.�s�E�:�:�)�)�F�B��"&�"9�"9�%����*�e�A�g�"N�"N�)�)���B����������������� �2�g�q�j�(�(�(�(� )�)���
)�
)rrT)
rdrerfrgr�rtr�r�r�r�r�r�r�rrrr�r�]s�������
�
� $���4�!�!�!�!�F���&/�/�/�/� � � � �+-�+-�+-�Z"�"�"�:��� )�)�)�)�)rr�c�(�eZdZdd�Zd�Zd�Zd�ZdS)�NegatedPatternNc�p�|�,t|t��sJt|�����||_dS)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__s9�����g�{�3�3�B�B�T�'�]�]�B�B�3�����rc��dS)NFrrCs rr�zNegatedPattern.match(s���urc�(�t|��dkSr�)r�)r#r�s rr�zNegatedPattern.match_seq,s���5�z�z�Q��rc#�K�|j�t|��dkrdifV�dSdS|j�|��D]\}}dSdifV�dSr�)r�r�r�)r#r�r�r�s rr�zNegatedPattern.generate_matches0sr�����<���5�z�z�Q�����e����������5�5�e�<�<�
�
���1�����R�%�K�K�K�K�KrrT)rdrerfrtr�r�r�rrrr�r�sU���������������� � � � � rr�c#�0K�|sdifV�dS|d|dd�}}|�|��D]a\}}|s||fV��t|||d���D]:\}}i}|�|��|�|��||z|fV��;�bdS)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�3�Z�@�@�%�%�F�B���A��H�H�R�L�L�L��H�H�R�L�L�L��r�'�1�*�$�$�$�$� %� %� %r)rg�
__author__rk�iorr�rrrrrnrAr�r�r�r�r�r�r�rrr�<module>rs�����3�
�
�
�
�
�����������6�6�6�n-�n-�n-�n-�n-�6�n-�n-�n-�`k�k�k�k�k�4�k�k�k�\L�L�L�L�L�4�L�L�L�\2�2�2�&S�S�S�S�S�&�S�S�S�l)*�)*�)*�)*�)*�+�)*�)*�)*�X:�:�:�:�:�+�:�:�:�zy)�y)�y)�y)�y)�k�y)�y)�y)�x � � � � �[� � � �F%�%�%�%�%r
?>