Sh3ll
OdayForums


Server : Apache
System : Linux server1.cgrithy.com 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64
User : nobody ( 99)
PHP Version : 8.1.23
Disable Function : NONE
Directory :  /opt/alt/python311/lib64/python3.11/lib2to3/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/alt/python311/lib64/python3.11/lib2to3/__pycache__/patcomp.cpython-311.opt-1.pyc
�

�,d�����dZdZddlZddlmZmZmZmZmZm	Z	ddl
mZddl
mZGd�d	e
��Zd
�ZGd�de��Zejejejdd
�Zd�Zd�Zd�ZdS)z�Pattern compiler.

The grammar is taken from PatternGrammar.txt.

The compiler compiles a pattern to a pytree.*Pattern instance.
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)z6Tokenizes a string suppressing significant whitespace.N)	r�NEWLINE�INDENT�DEDENTr�generate_tokens�io�StringIO�readline)	�input�skip�tokens�	quintuple�type�value�start�end�	line_texts	         r�tokenize_wrapperr%ss�����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�L�|�#tj|_tj|_n7tj|��|_tj|j��|_tj|_	tj
|_tj|jt���|_dS)z^Initializer.

        Takes an optional alternative filename for the pattern grammar.
        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__(su��
��!�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)z=Compiles a pattern string to a nested pytree.*Pattern object.)�debugN)r%r�parse_tokensr�
ParseErrorr
�str�compile_node)r5rr9�	with_treer�root�es       r�compile_patternzPatternCompiler.compile_pattern7s���!�%�(�(��	7��;�+�+�F�%�+�@�@�D�D����	7�	7�	7�$�S��V�V�,�,�$�6�����	7�����	+��$�$�T�*�*�D�0�0��$�$�T�*�*�*s�.�A�A�Ac�P��|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|��d	kr2|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|	��dkr��|	d	��}|dks|dkr-|���}t
j|gg||���}|�||_|���S)zXCompiles a node, recursively.

        This is one big switch on the node type.
        rc�:��g|]}��|����Sr�r=��.0�chr5s  �r�
<listcomp>z0PatternCompiler.compile_node.<locals>.<listcomp>Os'���G�G�G�b�D�%�%�b�)�)�G�G�GrN�rc��g|]}|g��Srr)rF�as  rrHz0PatternCompiler.compile_node.<locals>.<listcomp>Rs��':�':�':����':�':�':r��min�maxc�:��g|]}��|����SrrDrEs  �rrHz0PatternCompiler.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)
r5�node�alts�p�units�patternrd�nodes�repeatrT�childrMrNs
`            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�(�[rL)r r�STRINGr<r�
evalStringr!r
�LeafPattern�_type_of_literal�NAME�isupper�	TOKEN_MAPr
�
startswith�getattrr2r=rT�NodePatternrW)r5rjrkrer!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��S�N)�intr!)r5res  rrczPatternCompiler.get_int�s���4�:���rr)FF)rrrr7rAr=r[rcrrrr'r'&sw������
K�
K�
K�
K�
+�
+�
+�
+�E"�E"�E"�N!�!�!�!�F����rr')rvrr�NUMBER�TOKENc��|d���rtjS|tjvrtj|SdS)Nr)�isalpharrvr	�opmap)r!s rruru�sA���Q�x�������z��	�'�-�	�	��}�U�#�#��trc��|\}}}}|s	||jvrtj|||���Stj|||���S)z9Converts raw node information to a Node or Leaf instance.)�context)�
number2symbolr
�Node�Leaf)r	�
raw_node_infor r!r�rTs      rr4r4�sS��%2�"�D�%��(��9�4�7�0�0�0��{�4��7�;�;�;�;��{�4���8�8�8�8rc�D�t���|��Sr)r'rA)ris rrArA�s�����,�,�W�5�5�5r)�__doc__�
__author__r�pgen2rrrrrr	�r
r�	Exceptionr
r%�objectr'rvrrr�rxrur4rArrr�<module>r�s=����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

ZeroDay Forums Mini