ok

Mini Shell

Direktori : /opt/alt/python311/lib64/python3.11/lib2to3/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/lib2to3/__pycache__/patcomp.cpython-311.opt-2.pyc

�

�f�����	dZddlZddlmZmZmZmZmZmZddl	m
Z
ddl	mZGd�de��Z
d	�ZGd
�de��Zejejejdd�Zd
�Zd�Zd�ZdS)z#Guido van Rossum <guido@python.org>�N�)�driver�literals�token�tokenize�parse�grammar)�pytree)�pygramc��eZdZdS)�PatternSyntaxErrorN)�__name__�
__module__�__qualname__���6/opt/alt/python311/lib64/python3.11/lib2to3/patcomp.pyr
r
s�������Drr
c#��K�	tjtjtjh}t	jt
j|��j��}|D]}|\}}}}}||vr|V��dS�N)	r�NEWLINE�INDENT�DEDENTr�generate_tokens�io�StringIO�readline)	�input�skip�tokens�	quintuple�type�value�start�end�	line_texts	         r�tokenize_wrapperr&sv����@��M�5�<���6�D�
�
%�b�k�%�&8�&8�&A�
B�
B�F����	�-6�*��e�U�C���t����O�O�O���rc�2�eZdZdd�Zd	d�Zd�Zdd�Zd�ZdS)
�PatternCompilerNc�N�	|�#tj|_tj|_n7tj|��|_tj|j��|_tj|_	tj
|_tj|jt���|_dS)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__(sz��	���!�1�D�L��.�D�I�I�!�.�|�<�<�D�L���t�|�4�4�D�I��.����+����m�D�L�/�J�J�J����rFc�"�	t|��}	|j�||���}n4#tj$r"}tt
|����d�d}~wwxYw|r|�|��|fS|�|��S)N)�debug)r&r�parse_tokensr�
ParseErrorr
�str�compile_node)r6rr:�	with_treer�root�es       r�compile_patternzPatternCompiler.compile_pattern7s���K�!�%�(�(��	7��;�+�+�F�%�+�@�@�D�D����	7�	7�	7�$�S��V�V�,�,�$�6�����	7�����	+��$�$�T�*�*�D�0�0��$�$�T�*�*�*s�/�A �A�A c�R��	|j�jjkr
|jd}|j�jjkrl�fd�|jddd�D��}t|��dkr|dSt
jd�|D��dd���}|���S|j�jj	krZ�fd�|jD��}t|��dkr|dSt
j|gdd���}|���S|j�jj
krJ��|jdd���}t
j|��}|���Sd}|j}t|��dkr2|djtjkr|dj}|dd�}d}t|��dkr-|d	j�jjkr|d	}|dd	�}��||��}|��|j}	|	d}
|
jtjkrd}tj}n�|
jtjkrd}tj}n`|
jtjkrK��|	d��x}}t|	��d
kr��|	d��}|dks|dkr-|���}t
j|gg||���}|�||_|���S)Nrc�:��g|]}��|����Sr�r>��.0�chr6s  �r�
<listcomp>z0PatternCompiler.compile_node.<locals>.<listcomp>Os'���G�G�G�b�D�%�%�b�)�)�G�G�Gr�rc��g|]}|g��Srr)rG�as  rrIz0PatternCompiler.compile_node.<locals>.<listcomp>Rs��':�':�':����':�':�':r��min�maxc�:��g|]}��|����SrrErFs  �rrIz0PatternCompiler.compile_node.<locals>.<listcomp>Vs'���C�C�C�r�T�&�&�r�*�*�C�C�Cr�����)r!r-�Matcher�children�Alternatives�lenr
�WildcardPattern�optimize�Alternative�NegatedUnit�
compile_basic�NegatedPatternr�EQUALr"�Repeater�STAR�HUGE�PLUS�LBRACE�get_int�name)
r6�node�alts�p�units�patternre�nodes�repeatrU�childrNrOs
`            rr>zPatternCompiler.compile_nodeCs���	��9��	�)�)�)��=��#�D��9��	�.�.�.�G�G�G�G�D�M�#�#�A�#�4F�G�G�G�D��4�y�y�A�~�~��A�w���&�':�':�T�':�':�':��q�I�I�I�A��:�:�<�<���9��	�-�-�-�C�C�C�C�T�]�C�C�C�E��5�z�z�Q����Q�x���&��w�A�1�=�=�=�A��:�:�<�<���9��	�-�-�-��(�(���q�r�r�):�;�;�G��%�g�.�.�A��:�:�<�<�����
���u�:�:��?�?�u�Q�x�}���;�;���8�>�D��!�"�"�I�E����u�:�:��?�?�u�R�y�~���1C�C�C��2�Y�F��#�2�#�J�E��$�$�U�F�3�3������H��Q�K�E��z�U�Z�'�'����k�����u�z�)�)����k�����u�|�+�+�!�L�L��!��5�5�5��c��x�=�=�A�%�%��,�,�x��{�3�3�C��a�x�x�3�!�8�8�!�*�*�,�,�� �0�7�)��#�3�O�O�O�����G�L����!�!�!rc���|d}|jtjkrHtt	j|j����}tjt|��|��S|jtj
kr�|j}|���rS|tvrtd|z���|dd�rtd���tjt|��S|dkrd}n?|�d��s*t|j|d��}|�td|z���|dd�r(|�|djd��g}nd}tj||��S|jdkr|�|d��S|jd	kr4|�|d��}tj|ggdd�
��SdS)NrzInvalid token: %rrzCan't have details for token�any�_zInvalid symbol: %r�(�[rM)r!r�STRINGr=r�
evalStringr"r
�LeafPattern�_type_of_literal�NAME�isupper�	TOKEN_MAPr
�
startswith�getattrr3r>rU�NodePatternrX)r6rkrlrfr"r!�content�
subpatterns        rr\zPatternCompiler.compile_basic�s����Q�x���9���$�$���+�D�J�7�7�8�8�E��%�&6�u�&=�&=�u�E�E�E�
�Y�%�*�
$�
$��J�E��}�}���
9��	�)�)�,�-@�5�-H�I�I�I�����9�M�,�-K�L�L�L��)�)�E�*:�;�;�;��E�>�>��D�D��)�)�#�.�.�O�"�4�;��t�<�<�D��|�0�1E��1M�N�N�N�����9�#�#�0�0��q��1B�1�1E�F�F�G�G�G�"�G��)�$��8�8�8�
�Z�3�
�
��$�$�U�1�X�.�.�.�
�Z�3�
�
��*�*�5��8�4�4�J��)�J�<�.�a�Q�G�G�G�G��
rc�*�t|j��Sr)�intr")r6rfs  rrdzPatternCompiler.get_int�s���4�:���rr)FF)rrrr8rBr>r\rdrrrr(r(&sw������
K�
K�
K�
K�
+�
+�
+�
+�E"�E"�E"�N!�!�!�!�F����rr()rwrs�NUMBER�TOKENc��|d���rtjS|tjvrtj|SdS)Nr)�isalpharrwr	�opmap)r"s rrvrv�sA���Q�x�������z��	�'�-�	�	��}�U�#�#��trc��	|\}}}}|s	||jvrtj|||���Stj|||���S)N)�context)�
number2symbolr
�Node�Leaf)r	�
raw_node_infor!r"r�rUs      rr5r5�sV��C�%2�"�D�%��(��9�4�7�0�0�0��{�4��7�;�;�;�;��{�4���8�8�8�8rc�D�t���|��Sr)r(rB)rjs rrBrB�s�����,�,�W�5�5�5r)�
__author__r�pgen2rrrrrr	�r
r�	Exceptionr
r&�objectr(rwrsr�ryrvr5rBrrr�<module>r�s8���3�
�
�	�	�	�E�D�D�D�D�D�D�D�D�D�D�D�D�D�D�D�������������	�	�	�	�	��	�	�	����I�I�I�I�I�f�I�I�I�Z�Z��|��|��
�
�	����9�9�9�6�6�6�6�6r

Zerion Mini Shell 1.0