python (3.12.0)

(root)/
lib/
python3.12/
idlelib/
__pycache__/
parenmatch.cpython-312.pyc

̑e$dZddlmZddlmZddddZdZGd	d
Zeje	dk(rddl
mZed
dyy)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([{)]}dceZdZdZdZdZdZedZdZ	dZ
dZd	Zd
Z
ddZd
ZdZdZdZeeeedZdZdZy)
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|jd|_d|_y)Nr)editwintextbindRESTORE_VIRTUAL_EVENT_NAME
restore_eventcounteris_restore_active)selfrs  F/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/idlelib/parenmatch.py__init__zParenMatch.__init__(sHLL		$99,,	.!"ctjdddd|_tjddddd	|_tjddd
dd	|_tj
tjd
|_y)N
extensionsrstyleopener)defaultzflash-delayinti)typerbellboolhilite)r	GetOptionSTYLEFLASH_DELAYBELLGetHighlightCurrentTheme
HILITE_CONFIG)clss rreloadzParenMatch.reload3s{&&gxA	",,\-eCQ%%\&vqJ$11(2G2G2I2:<rc|js?|jD](}|jj|j|*d|_yy)z5Activate mechanism to restore text from highlighting.TN)rRESTORE_SEQUENCESr	event_addrrseqs  ractivate_restorezParenMatch.activate_restore>sI%%--
J		##D$C$CSI
J%)D"&rc|jr?|jD](}|jj|j|*d|_yy)zRemove restore event bindings.FN)rr0revent_deleterr2s  rdeactivate_restorezParenMatch.deactivate_restoreEsI!!--
M		&&t'F'FL
M%*D""rcnt|jdj}|j|y)zAHandle editor 'show surrounding parens' event (menu or shortcut).insertbreak)rrget_surrounding_bracketsfinish_paren_event)reventindicess   rflash_paren_eventzParenMatch.flash_paren_eventLs/t||X6,,.	(rc|jjd}|tvryt|jd}|jsy|j
t|d}|j|y)zHandle user input of closer.z	insert-1cNT)rget_openersrr
is_in_coder;r<)rr=closerhpr>s     rparen_closed_eventzParenMatch.paren_closed_eventSse{+!
{
3}}--hv.>E(rc@|'|jr|jjy|j|jj|j|j|||jr|jy|jyN)r)rr"r4tagfuncsrAr'create_tag_expressionr(set_timeout_lastset_timeout_nonerr>s  rr<zParenMatch.finish_paren_event`sy?tyyIINNA

$**d&@&@A$P
2$"2"2			5 11	5rNc|jjd|j|xjdz
c_y)zRemove effect of doing match.parenr$N)r
tag_deleter7r)rr=s  rrzParenMatch.restore_eventks.		W%!rcD||jk(r|jyyrH)rr)rtimer_counts  rhandle_restore_timerzParenMatch.handle_restore_timerqs$,,& 'rc|jjd|d|jjd|jy)z'Highlight the single paren that matchesrOrN)rtag_add
tag_configr,rMs  rcreate_tag_openerzParenMatch.create_tag_openerxs4		'71:.		Wd&8&89rc|jj|ddvr	|ddz}n|d}|jjd|d|ddz|dz||jjd|jy)z#Highlight the left and right parensr$r+1crOrz-1cNrrArUrVr,rr>
rightindexs   rcreate_tag_parenszParenMatch.create_tag_parens}sy99==$7 E)J J		'71:wqz%/?EAQS]^		Wd&8&89rc|jj|ddvr	|ddz}n|d}|jjd|d||jjd|jy)zHighlight the entire expressionr$rrYrOrNrZr[s   rrJz ParenMatch.create_tag_expressionsf99==$7 E)J J		'71:z:		Wd&8&89r)rrparens
expressionc|xjdz
c_||j|jjdfd}|jjjt||y)zSHighlight will remain until user input turns it off
        or the insert has movedr$r9c||jjdk7r|j|y|jjjt||y)Nr9)rindexrSr
text_frameafterCHECK_DELAY)callmercrcs    rrgz+ParenMatch.set_timeout_none.<locals>.callmesA		11))!,''--k66JrN)rrrcrrdrerf)rrgs  rrLzParenMatch.set_timeout_nonesO	
 $2	K	
%%k66Brc|xjdz
c_|jjj|j||jfdy)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>sd.G.G.JrN)rrrdrer()rs rrKzParenMatch.set_timeout_lasts@	
%%J	LrrH)__name__
__module____qualname____doc__rr0rclassmethodr.r4r7r?rFr<rrSrWr]rJrIrLrKrrrr
s("@<	#<<*+	5!:
::$$#+	
H
CLrr__main__)mainz!idlelib.idle_test.test_parenmatch)	verbosityN)roidlelib.hyperparserridlelib.configrrBrfrr.rlunittestrsrqrr<module>rys],#$bLbLJz	,:r