Sindbad~EG File Manager

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

�

%Μg$���dZddlmZddlmZdddd�ZdZGd	�d
�Zej�e	dk(rddl
mZed
d��yy)z�ParenMatch -- for parenthesis matching.

When you hit a right paren, the cursor should move briefly to the left
paren.  Paren here is used generically; the matching applies to
parentheses, square brackets, and curly braces.
�)�HyperParser)�idleConf�(�[�{��)�]�}�dc��eZdZdZdZdZd�Zed��Zd�Z	d�Z
d�Zd	�Zd
�Z
dd�Zd
�Zd�Zd�Zd�Zeeeed�Zd�Zd�Zy)�
ParenMatcha'Highlight matching openers and closers, (), [], and {}.

    There are three supported styles of paren matching.  When a right
    paren (opener) is typed:

    opener -- highlight the matching left paren (closer);
    parens -- highlight the left and right parens (opener and closer);
    expression -- highlight the entire expression from opener to closer.
    (For back compatibility, 'default' is a synonym for 'opener').

    Flash-delay is the maximum milliseconds the highlighting remains.
    Any cursor movement (key press or click) before that removes the
    highlight.  If flash-delay is 0, there is no maximum.

    TODO:
    - Augment bell() with mismatch warning in status window.
    - Highlight when cursor is moved to the right of a closer.
      This might be too expensive to check.
    z<<parenmatch-check-restore>>)z
<KeyPress>z
<ButtonPress>z<Key-Return>z<Key-BackSpace>c��||_|j|_|jj|j|j�d|_d|_y)Nr)�editwin�text�bind�RESTORE_VIRTUAL_EVENT_NAME�
restore_event�counter�is_restore_active)�selfrs  �//usr/local/lib/python3.12/idlelib/parenmatch.py�__init__zParenMatch.__init__(sH������L�L��	�	�����$�9�9��,�,�	.����!"���c��tjdddd��|_tjddddd�	�|_tjddd
dd�	�|_tj
tj�d
�|_y)N�
extensionsr�style�opener)�defaultzflash-delay�inti�)�typer�bell�bool��hilite)r�	GetOption�STYLE�FLASH_DELAY�BELL�GetHighlight�CurrentTheme�
HILITE_CONFIG)�clss r�reloadzParenMatch.reload3s{���&�&���g�x�A��	�"�,�,��\�-�e�C�Q����%�%��\�&�v�q�J���$�1�1�(�2G�2G�2I�2:�<��rc��|js?|jD](}|jj|j|��*d|_yy)z5Activate mechanism to restore text from highlighting.TN)r�RESTORE_SEQUENCESr�	event_addr�r�seqs  r�activate_restorezParenMatch.activate_restore>sB���%�%��-�-���	�	�#�#�D�$C�$C�S�I�.�%)�D�"�&rc��|jr?|jD](}|jj|j|��*d|_yy)zRemove restore event bindings.FN)rr0r�event_deleterr2s  r�deactivate_restorezParenMatch.deactivate_restoreEsB���!�!��-�-���	�	�&�&�t�'F�'F��L�.�%*�D�"�"rc�n�t|jd�j�}|j|�y)zAHandle editor 'show surrounding parens' event (menu or shortcut).�insert�break)rr�get_surrounding_brackets�finish_paren_event)r�event�indicess   r�flash_paren_eventzParenMatch.flash_paren_eventLs/���t�|�|�X�6�,�,�.�	�����(�rc���|jjd�}|tvryt|jd�}|j�sy|j
t|d�}|j|�y)zHandle user input of closer.z	insert-1cNT)r�get�_openersrr�
is_in_coder;r<)rr=�closer�hpr>s     r�paren_closed_eventzParenMatch.paren_closed_eventSse�������{�+����!��
����{�
3���}�}����-�-�h�v�.>��E������(�rc�@�|�'|jr|jj�y|j�|jj|j|j�||�|jr|j�y|j�y�N)r)rr"r4�tagfuncsrAr'�create_tag_expressionr(�set_timeout_last�set_timeout_none�rr>s  rr<zParenMatch.finish_paren_event`sy���?�t�y�y��I�I�N�N�������A��
�
���$�*�*�d�&@�&@�A�$��P�
2�$�"2�"2��	�	�	5� �1�1�	5rNc��|jjd�|j�|xjdz
c_y)zRemove effect of doing match.�parenr$N)r�
tag_deleter7r)rr=s  rrzParenMatch.restore_eventks.���	�	���W�%����!������rc�D�||jk(r|j�yyrH)rr)r�timer_counts  r�handle_restore_timerzParenMatch.handle_restore_timerqs���$�,�,�&���� �'rc��|jjd|d�|jjd|j�y)z'Highlight the single paren that matchesrOrN)r�tag_add�
tag_configr,rMs  r�create_tag_openerzParenMatch.create_tag_openerxs4���	�	���'�7�1�:�.��	�	���W�d�&8�&8�9rc��|jj|d�dvr	|ddz}n|d}|jjd|d|ddz|dz|�|jjd|j�y)z#Highlight the left and right parensr$r�+1crOrz-1cN�rrArUrVr,�rr>�
rightindexs   r�create_tag_parenszParenMatch.create_tag_parens}sy���9�9�=�=����$��7� ���E�)�J� ���J��	�	���'�7�1�:�w�q�z�%�/?��E�AQ�S]�^��	�	���W�d�&8�&8�9rc���|jj|d�dvr	|ddz}n|d}|jjd|d|�|jjd|j�y)zHighlight the entire expressionr$rrYrOrNrZr[s   rrJz ParenMatch.create_tag_expression�sf���9�9�=�=����$��7� ���E�)�J� ���J��	�	���'�7�1�:�z�:��	�	���W�d�&8�&8�9r)rr�parens�
expressionc���|xjdz
c_||j|jjd�fd�}|jjjt||�y)zSHighlight will remain until user input turns it off
        or the insert has movedr$r9c��||jjd�k7r|j|�y|jjjt||�y)Nr9)r�indexrSr�
text_frame�after�CHECK_DELAY)�callmer�crcs    rrgz+ParenMatch.set_timeout_none.<locals>.callme�sA����	�	����1�1��)�)�!�,����'�'�-�-�k�6�6�JrN)rrrcrrdrerf)rrgs  rrLzParenMatch.set_timeout_none�sO��	
������ $����������2�	K�	
�����%�%�k�6�6�Brc��|xjdz
c_|jjj|j||jfd��y)zFThe last highlight created will be removed after FLASH_DELAY millisecsr$c�$�|j|�SrH)rS)rrhs  r�<lambda>z-ParenMatch.set_timeout_last.<locals>.<lambda>�s��d�.G�.G��.JrN)rrrdrer()rs rrKzParenMatch.set_timeout_last�s@��	
�����������%�%��������J�	LrrH)�__name__�
__module__�__qualname__�__doc__rr0r�classmethodr.r4r7r?rFr<rrSrWr]rJrIrLrK�rrrr
s����("@��<��	#��<��<�*�+���	5��!�:�
:�:�$�$�#�+�	
�H�
C�Lrr�__main__)�mainz!idlelib.idle_test.test_parenmatch�)�	verbosityN)ro�idlelib.hyperparserr�idlelib.configrrBrfrr.rl�unittestrsrqrr�<module>rys]���,�#����$����bL�bL�J�����z����	,��:�r

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