Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/idlelib/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/idlelib/__pycache__/hyperparser.cpython-312.opt-1.pyc

�

%ΜgY2��b�dZddlmZddlZddlmZeejejzdz�Z	eejdz�Z
ed�D�cgc]}e|�e	v��c}Z
ed�D�cgc]}e|�e
v��c}ZGd�d�Zed	k(rdd
lmZedd�
�yycc}wcc}w)z�Provide advanced parsing abilities for ParenMatch and other extensions.

HyperParser uses PyParser.  PyParser mostly gives information on the
proper indentation of code.  HyperParser gives additional information on
the structure of code.
�)�	iskeywordN)�pyparse�_�c�Z�eZdZd�Zd�Zd�Zd�Zdd�Zehd��Z	e
d��ZdZd	�Z
y
)�HyperParserc��||_|jx|_}tj|j|j
�}d�}||j
|��}|js�|jD]q}t||z
d�}t|�dz}	d|z}
|j|j|	|
�dz�|j|j|	��}|�|dk(s�qn|jxsd�nV|j!d|�}|r|d}	nd	}	d|z}
|j|j|	|
�dz�|jd�|j"dd
|_
|_|j)�|_t-t/|j*��D�
cgc]1}
|
dkDxr(|j*|
d|j*|
dz
dkD��3c}
|_|j3|�ycc}
w)z;To initialize, analyze the surroundings of the given index.c�*�tt|��S)N)�int�float)�indexs �0/usr/local/lib/python3.12/idlelib/hyperparser.py�
index2linez(HyperParser.__init__.<locals>.index2line"s���u�U�|�$�$��z.0z%d.endz 
Nr�consolez1.0���)�editwin�textr�Parser�indentwidth�tabwidthr
�prompt_last_line�num_context_lines�max�repr�set_code�get�find_good_parse_start�_build_char_in_string_func�set_lo�
tag_prevrange�code�rawtext�stopatindex�get_last_stmt_bracketing�
bracketing�range�len�isopener�	set_index)�selfrr
r�parserr�lno�context�startat�startatindexr%�bod�r�is              r�__init__zHyperParser.__init__s������"�<�<�'��	�D����� 3� 3�W�5E�5E�F��	%�����E�*�+���'�'�"�4�4���c�G�m�Q�/��#�G�}�t�3��&��n��
�������{� C�E� I�J��2�2�!�<�<�\�J�L���?�g��l��5�
�M�M�#�(��#��"�"�9�e�4�A�� ��t��$��"�S�.�K�
�O�O�D�H�H�\�;�?��E�F��M�M�!���{�{�3�B�'���'��� �9�9�;���
#(��D�O�O�(<�"=�?�"=�Q��1��1�����!3�A�!6�����1��-�a�0�"1�1�"=�?��
�	
���u���	?s�'6G7c�J�t|j�t|jj||j��z
}|dkrtd|z��||_d|_|jt|j�dz
kr�|j|jdzd|jkrg|xjdz
c_|jt|j�dz
kr-|j|jdzd|jkr�g|jt|j�dz
kr`|j|jdzd|jk(r3|j|jdzs|xjdz
c_yyyy)zgSet the index to which the functions relate.

        The index must be in the same statement.
        rz(Index %s precedes the analyzed statementrN)
r)r$rrr%�
ValueError�indexinrawtext�indexbracketr'r*)r,r
r8s   rr+zHyperParser.set_indexQsy��
�d�l�l�+��d�i�i�m�m�E�4�3C�3C�D�E�F���A���G�$�%�&�
&�,������� � �3�t���#7��#9�9����t�0�0��2�3�A�6��9L�9L�L�����"��� � �3�t���#7��#9�9����t�0�0��2�3�A�6��9L�9L�L�����D�O�O� 4�Q� 6�6��O�O�D�-�-�a�/�0��3�t�7J�7J�J��}�}�T�.�.�q�0�1�����"��2�
K�
7rc��|j|jxr+|j|j|jddvS)z2Is the index given to the HyperParser in a string?r)�"�'�r*r9r$r'�r,s r�is_in_stringzHyperParser.is_in_stringfsH���
�
�d�/�/�0�����T�_�_�T�->�->�?��B�C���	rc��|j|jxs+|j|j|jddvS)z5Is the index given to the HyperParser in normal code?r)�#r;r<r=r>s r�
is_in_codezHyperParser.is_in_codensI���M�M�$�"3�"3�4�4�'����T�_�_�T�->�->�?��B�C�&�'�	(rc��|j|jd}|j}|j|r6|j|j|d|vs|j|d|kDro|dz}|dkryt	||j|d�}|j|s�7|j|j|d|vr�Y|j|d|kDr�o|jdz}|t|j�krH|j|d|k\r3|dz
}|t|j�kr|j|d|k\r�3|jjd|jt|j�|j|dz
fz�}|t|j�k\s(|j|dt|j�kDr|ry|j}||fS|jjd|jt|j�|j|ddz
z
fz�}||fS)a�Return bracket indexes or None.

        If the index given to the HyperParser is surrounded by a
        bracket defined in openers (or at least has one before it),
        return the indices of the opening bracket and the closing
        bracket (or the end of line, whichever comes first).

        If it is not surrounded by brackets, or the end of line comes
        before the closing bracket and mustclose is True, returns None.
        rrNz%s-%dc)	r'r9r*r$�minr)rr
r%)r,�openers�	mustclose�bracketinglevel�before�after�beforeindex�
afterindexs        r�get_surrounding_bracketsz$HyperParser.get_surrounding_bracketsts6���/�/�$�*;�*;�<�Q�?���"�"���=�=��(��l�l�4�?�?�6�2�1�5�6�g�E��o�o�f�%�a�(�?�:��a�K�F���z��!�/�4�?�?�6�3J�1�3M�N�O�
�=�=��(��l�l�4�?�?�6�2�1�5�6�g�E��o�o�f�%�a�(�?�:�
�!�!�A�%���s�4�?�?�+�+��o�o�e�$�Q�'�?�:��Q�J�E��s�4�?�?�+�+��o�o�e�$�Q�'�?�:��i�i�o�o�h�
�
�
�s�4�<�<�0�����1H��1K�K�L�'M�N���S����)�)��?�?�5�!�!�$�s�4�<�<�'8�8����)�)�J��J�&�&�	������D�,�,��T�\�\�"�D�O�O�E�$:�1�$=�a�$?�@�B�B�C�J��J�&�&r>�None�True�Falsec���t}|}||kDr[t||dz
�dkrG|t||dz
�r3|dz}||kDr)t||dz
�dkr|t||dz
�r�3||kDr�t||dz
�dk\r�|dz
|k\r@d||dz
|zj�r'|dz}|dz
|k\rd||dz
|zj�r�'|dz
|k\rd||dz
|zj�r|dz}|dz
|k\rd||dz
|zj�r|dz}|||j�sy||krtt||�sy||kr t	|||�r||||j
vry||z
S)z�Given a string and pos, return the number of chars in the
        identifier which ends at pos, or 0 if there is no such one.

        This ignores non-identifier eywords are not identifiers.
        rr��a�r)�_IS_ASCII_ID_CHAR�ord�isidentifier�_IS_ASCII_ID_FIRST_CHARr�_ID_KEYWORDS)�cls�str�limit�pos�is_ascii_id_charr4s      r�_eat_identifierzHyperParser._eat_identifier�s���-��
���%�i��C��A��J��#�%� ��S��Q��Z��1�
��F�A�	�%�i��C��A��J��#�%� ��S��Q��Z��1�
�u�9��S��Q��Z��C�/��a�%�5�.�c�C��A��c�N�&:�%H�%H�%J��Q����a�%�5�.�c�C��A��c�N�&:�%H�%H�%J��1�u��~�3��Q��U�3��#7�"E�"E�"G��Q����1�u��~�3��Q��U�3��#7�"E�"E�"G��Q����q��:�*�*�,��
��W�+�3�s�1�v�;�7��
�s�7��#�a��*�%��A�c�
�#�"2�"2�2���Q�w�rz 	
\c��|j�std��|j}|j}|j}||d}|j
}|}d}		||kDr||dz
|jvr|dz}nO|s||kDr||dz
dk(r|dz}d}n5||k(r/|dkDr*|||dz
ddk(r|dz}||d}||dzd}nn�o|sn�|j|||�}|r
||z
}|}d}n�||k(r�||d}	|dkDr'||dz
d|	kDr|dz}|dkDr||dz
d|	kDr�||d|k(rnP||d}|dz}||d}|}||d	vrn/||d
vr&|dkDr||dz
dvr|dz}|dkDr||dz
dvr�|}nn��'|||j
S)z�Return a string with the Python expression which ends at the
        given index, which is empty if there is no real one.
        z?get_expression should only be called if index is inside a code.rTr�.rArSFz([z'"�rRbBuU)rBr7r$r'r9r8�_whitespace_charsr^)
r,r$r'�
brck_index�
brck_limitr\�last_identifier_pos�
postdot_phase�ret�levels
          r�get_expressionzHyperParser.get_expression�so����� ��:�;�
;��,�,���_�_�
��&�&�
��
�+�A�.�
��!�!��!���
����z�>�g�c�!�e�n��8N�8N�&N��1�H�C�'��J�&�7�3�q�5�>�S�+@��1�H�C�$(�M��Z�'�J��N��j��A��6�q�9�:�c�A��!�O�J�!+�J�!7��!:�J�$�Z��\�2�1�5�C��'�*!���&�&�w�
�C�@�C���C�i��&)�#� %�
��
�"�#�:�.�q�1�� �1�n��J�q�L�)A�!�)D�u�)L��!�O�J�!�1�n��J�q�L�)A�!�)D�u�)L��j�)�!�,�
�:�� ��,�Q�/���a��
�'�
�3�A�6�
�&)�#��3�<�4�'���s�|�u�,�!�A�g�'�#��'�*:�h�*F��1�H�C�"�A�g�'�#��'�*:�h�*F�.1�+���C�F�*�4�+>�+>�?�?rN)z([{F)�__name__�
__module__�__qualname__r5r+r?rBrL�	frozensetrX�classmethodr^rbri�rrrrsL��5�n#�*�(�('�X�6�7�L��6��6�r"��U@rr�__main__)�mainz"idlelib.idle_test.test_hyperparserrS)�	verbosity)�__doc__�keywordr�string�idlelibrrm�
ascii_letters�digits�_ASCII_ID_CHARS�_ASCII_ID_FIRST_CHARSr(�chrrTrWrrj�unittestrq)�xs0r�<module>r~s�����
���F�0�0�6�=�=�@�3�F�G��!�&�"6�"6��"<�=��;@��*�E�*�Q�c�!�f��/�*�E��16�c�
�;�
�1�c�!�f�%�%�
�;��Z@�Z@�z�z����	-��;���I	F��<s�B'�2B,

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists