AlkantarClanX12

Your IP : 3.145.167.58


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

�

�Q�f�����	dZddlZddlmZmZmZmZmZmZddl	m
Z
ddl	mZGd�de�Z
d	�ZGd
�de�Zej"ej$ej&dd�Zd
�Zd�Zd�Zy)z#Guido van Rossum <guido@python.org>�N�)�driver�literals�token�tokenize�parse�grammar)�pytree)�pygramc��eZdZy)�PatternSyntaxErrorN)�__name__�
__module__�__qualname__���6/opt/alt/python312/lib64/python3.12/lib2to3/patcomp.pyr
r
s��rr
c#�K�	tjtjtjh}t	j
t
j|�j�}|D]}|\}}}}}||vs�|���y�w�N)	r�NEWLINE�INDENT�DEDENTr�generate_tokens�io�StringIO�readline)	�input�skip�tokens�	quintuple�type�value�start�end�	line_texts	         r�tokenize_wrapperr&sg����@��M�M�5�<�<����6�D�
�
%�
%�b�k�k�%�&8�&A�&A�
B�F��	�-6�*��e�U�C���t���O��s�A4A>�7A>c�0�eZdZdd�Zdd�Zd�Zdd�Zd�Zy)	�PatternCompilerNc��	|�+tj|_tj|_n>tj|�|_tj|j�|_tj|_	tj|_tj|jt��|_y)N)�convert)r�pattern_grammarr	�pattern_symbols�symsr�load_grammar�Symbols�python_grammar�	pygrammar�python_symbols�pysyms�Driver�pattern_convert)�self�grammar_files  r�__init__zPatternCompiler.__init__(s��	���!�1�1�D�L��.�.�D�I�!�.�.�|�<�D�L����t�|�|�4�D�I��.�.����+�+����m�m�D�L�L�/�J��rc��	t|�}	|jj||��}|r|j|�|fS|j|�S#tj$r}tt
|��d�d}~wwxYw)N)�debug)r&r�parse_tokensr�
ParseErrorr
�str�compile_node)r6rr:�	with_treer�root�es       r�compile_patternzPatternCompiler.compile_pattern7s���K�!�%�(��	7��;�;�+�+�F�%�+�@�D���$�$�T�*�D�0�0��$�$�T�*�*�����	7�$�S��V�,�$�6��	7�s�A�A>�$A9�9A>c��	|j|jjk(r|jd}|j|jjk(rx|jddd�D�cgc]}|j|���}}t
|�dk(r|dStj|D�cgc]}|g��c}dd��}|j�S|j|jjk(rd|jD�cgc]}|j|���}}t
|�dk(r|dStj|gdd��}|j�S|j|jjk(rC|j|jdd�}tj|�}|j�Sd}|j}	t
|	�dk\r4|	djtjk(r|	dj }|	dd}	d}
t
|	�dk\r0|	dj|jj"k(r
|	d}
|	dd}	|j|	|
�}|
��|
j}|d}|jtj$k(rd}
tj&}n�|jtj(k(rd}
tj&}nV|jtj*k(r9|j-|d�x}
}t
|�dk(r|j-|d�}	
dk7sdk7r*|j�}tj|gg|
��}|�||_|j�Scc}wcc}wcc}w)Nr�r��min�max�����)r!r-�Matcher�children�Alternativesr>�lenr
�WildcardPattern�optimize�Alternative�NegatedUnit�
compile_basic�NegatedPatternr�EQUALr"�Repeater�STAR�HUGE�PLUS�LBRACE�get_int�name)r6�node�ch�alts�a�p�units�patternr\�nodes�repeatrL�childrFrGs               rr>zPatternCompiler.compile_nodeCs��	��9�9��	�	�)�)�)��=�=��#�D��9�9��	�	�.�.�.�48�M�M�#�A�#�4F�G�4F�b�D�%�%�b�)�4F�D�G��4�y�A�~��A�w���&�&�T�':�T����T�':��q�I�A��:�:�<���9�9��	�	�-�-�-�59�]�]�C�]�r�T�&�&�r�*�]�E�C��5�z�Q���Q�x���&�&��w�A�1�=�A��:�:�<���9�9��	�	�-�-�-��(�(����q�r�):�;�G��%�%�g�.�A��:�:�<�����
�
���u�:��?�u�Q�x�}�}����;���8�>�>�D��!�"�I�E����u�:��?�u�R�y�~�~����1C�1C�C��2�Y�F��#�2�J�E��$�$�U�F�3�������H��Q�K�E��z�z�U�Z�Z�'����k�k�����u�z�z�)����k�k�����u�|�|�+�!�L�L��!��5�5��c��x�=�A�%��,�,�x��{�3�C��a�x�3�!�8�!�*�*�,�� �0�0�7�)��#�3�O�����G�L����!�!��sH��(;��Ds�+M4�+
M9�M>c��|d}|jtjk(rGtt	j
|j��}tjt|�|�S|jtjk(r�|j}|j�rB|tvrtd|z��|ddrtd��tjt|�S|dk(rd}n8|jd�s't|j |d�}|�td|z��|ddr#|j#|dj$d�g}nd}tj&|�S|jdk(r|j#|d�S|jd	k(r.|j#|d�}tj(|ggdd�
�Sy)NrzInvalid token: %rrzCan't have details for token�any�_zInvalid symbol: %r�(�[rE)r!r�STRINGr=r�
evalStringr"r
�LeafPattern�_type_of_literal�NAME�isupper�	TOKEN_MAPr
�
startswith�getattrr3r>rL�NodePatternrO)r6rdrer]r"r!�content�
subpatterns        rrSzPatternCompiler.compile_basic�s����Q�x���9�9����$���+�+�D�J�J�7�8�E��%�%�&6�u�&=�u�E�E�
�Y�Y�%�*�*�
$��J�J�E��}�}���	�)�,�-@�5�-H�I�I����9�,�-K�L�L��)�)�)�E�*:�;�;��E�>��D��)�)�#�.�"�4�;�;��t�<�D��|�0�1E��1M�N�N����9�#�0�0��q��1B�1B�1�1E�F�G�G�"�G��)�)�$��8�8�
�Z�Z�3�
��$�$�U�1�X�.�.�
�Z�Z�3�
��*�*�5��8�4�J��)�)�J�<�.�a�Q�G�G�rc�,�t|j�Sr)�intr")r6r]s  rr[zPatternCompiler.get_int�s���4�:�:��rr)FF)rrrr8rBr>rSr[rrrr(r(&s��
K�
+�E"�N!�Frr()rprl�NUMBER�TOKENc��|dj�rtjS|tjvrtj|Sy)Nr)�isalpharrpr	�opmap)r"s rroro�s:���Q�x�����z�z��	�'�-�-�	��}�}�U�#�#�rc��	|\}}}}|s||jvrtj|||��Stj|||��S)N)�context)�
number2symbolr
�Node�Leaf)r	�
raw_node_infor!r"r�rLs      rr5r5�sI��C�%2�"�D�%��(��4�7�0�0�0��{�{�4��7�;�;��{�{�4���8�8rc�4�t�j|�Sr)r(rB)rcs rrBrB�s����,�,�W�5�5r)�
__author__r�pgen2rrrrrr	�r
r�	Exceptionr
r&�objectr(rprlrzrrror5rBrrr�<module>r�sw���3�
�
�E�D���	��	��I�f�I�Z�Z�Z��|�|��|�|��
�	��9�6r