%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python3.8/idlelib/__pycache__/
Upload File :
Create Path :
Current File : //usr/local/lib/python3.8/idlelib/__pycache__/parenmatch.cpython-38.pyc

U

qa$@sfdZddlmZddlmZddddZdZGd	d
d
Zee	dkrbddl
mZed
dddS)zParenMatch -- 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@seZdZdZdZdZddZeddZdd	Z	d
dZ
dd
ZddZddZ
d"ddZddZddZddZddZeeeedZddZd d!ZdS)#
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>cCs0||_|j|_|j|j|jd|_d|_dS)Nr)editwintextbindRESTORE_VIRTUAL_EVENT_NAME
restore_eventcounteris_restore_active)selfr
r./usr/local/lib/python3.8/idlelib/parenmatch.py__init__(s
zParenMatch.__init__cCsVtjddddd|_tjdddddd	|_tjddd
ddd	|_ttd
|_dS)N
extensionsrstyleopener)defaultzflash-delayinti)typerbellboolZhilite)rZ	GetOptionSTYLEFLASH_DELAYBELLZGetHighlightZCurrentTheme
HILITE_CONFIG)clsrrrreload3s.
zParenMatch.reloadcCs,|js(|jD]}|j|j|qd|_dS)z5Activate mechanism to restore text from highlighting.TN)rRESTORE_SEQUENCESrZ	event_addrrseqrrractivate_restore>s
zParenMatch.activate_restorecCs,|jr(|jD]}|j|j|qd|_dS)zRemove restore event bindings.FN)rr'rZevent_deleterr(rrrdeactivate_restoreEs
zParenMatch.deactivate_restorecCst|jd}||dS)zAHandle editor 'show surrounding parens' event (menu or shortcut).insertbreak)rr
get_surrounding_bracketsfinish_paren_event)reventindicesrrrflash_paren_eventLs
zParenMatch.flash_paren_eventcCsN|jd}|tkrdSt|jd}|s0dS|t|d}||dS)zHandle user input of closer.z	insert-1cNT)rget_openersrr
Z
is_in_coder.r/)rr0ZcloserZhpr1rrrparen_closed_eventSs
zParenMatch.paren_closed_eventcCsT|dkr|jr|jdS||j|j|j|||jrH|j	n|j
dSN)r#rrr*tagfuncsr3r!create_tag_expressionr"set_timeout_lastset_timeout_nonerr1rrrr/`s
zParenMatch.finish_paren_eventNcCs&|jd||jd7_dS)zRemove effect of doing match.parenr N)rZ
tag_deleter+r)rr0rrrrkszParenMatch.restore_eventcCs||jkr|dSr6)rr)rZtimer_countrrrhandle_restore_timerqs
zParenMatch.handle_restore_timercCs&|jd|d|jd|jdS)z'Highlight the single paren that matchesr<rN)rtag_add
tag_configr$r;rrrcreate_tag_openerxszParenMatch.create_tag_openercCsb|j|ddkr"|dd}n|d}|jd|d|dd|d||jd|jdS)z#Highlight the left and right parensr r+1cr<rz-1cNrr3r>r?r$rr1Z
rightindexrrrcreate_tag_parens}s
$zParenMatch.create_tag_parenscCsR|j|ddkr"|dd}n|d}|jd|d||jd|jdS)zHighlight the entire expressionr rrAr<rNrBrCrrrr8s
z ParenMatch.create_tag_expression)rrZparensZ
expressioncCs>|jd7_||j|jdfdd}|jjt||dS)zSHighlight will remain until user input turns it off
        or the insert has movedr r,cSs2||jdkr||n|jjt||dS)Nr,)rindexr=r

text_frameafterCHECK_DELAY)callmercrErrrrIsz+ParenMatch.set_timeout_none.<locals>.callmeN)rrrEr
rFrGrH)rrIrrrr:s


zParenMatch.set_timeout_nonecCs0|jd7_|jj|j||jfdddS)zFThe last highlight created will be removed after FLASH_DELAY millisecsr cSs
||Sr6)r=)rrJrrr<lambda>z-ParenMatch.set_timeout_last.<locals>.<lambda>N)rr
rFrGr")rrrrr9s
zParenMatch.set_timeout_last)N)__name__
__module____qualname____doc__rr'rclassmethodr&r*r+r2r5r/rr=r@rDr8r7r:r9rrrrr
s.



	

r__main__)mainz!idlelib.idle_test.test_parenmatch)	verbosityN)rPZidlelib.hyperparserrZidlelib.configrr4rHrr&rMZunittestrSrrrr<module>s&

Zerion Mini Shell 1.0