tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
[\¬Qc@s^dZddlmZddlmZidd6dd6dd    6Zd
Zd dd „ƒYZd S(sòParenMatch -- An IDLE extension 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.
iÿÿÿÿ(t HyperParser(tidleConft(t)t[t]t{t}idt
ParenMatchcBseZdZdd#gfgZejdddddƒZejddd    d
d dd ƒZejej    ƒd ƒZ
ejdddd
dddƒZ dZ d$Z d„Zd„Zd„Zd„Zd„Zd„Zd%d„Zd„Zd„Zd„Zd „Zd!„Zd"„ZRS(&s¤Highlight matching parentheses
 
    There are three supported style of paren matching, based loosely
    on the Emacs options.  The style is select based on the
    HILITE_STYLE attribute; it can be changed used the set_style
    method.
 
    The supported styles are:
 
    default -- When a right paren is typed, highlight the matching
        left paren for 1/2 sec.
 
    expression -- When a right paren is typed, highlight the entire
        expression from the left paren to the right paren.
 
    TODO:
        - extend IDLE with configuration dialog to change options
        - implement rest of Emacs highlight styles (see below)
        - print mismatch warning in IDLE status window
 
    Note: In Emacs, there are several styles of highlight where the
    matching paren is highlighted whenever the cursor is immediately
    to the right of a right paren.  I don't know how to do that in Tk,
    so I haven't bothered.
    teditsShow surrounding parenss<<flash-paren>>t
extensionsRtstyletdefaultt
expressions flash-delayttypetintiôthilitetbelltboolis<<parenmatch-check-restore>>s
<KeyPress>s <ButtonPress>s <Key-Return>s<Key-BackSpace>cCsT||_|j|_|jj|j|jƒd|_d|_|j|jƒdS(Ni(    teditwinttexttbindtRESTORE_VIRTUAL_EVENT_NAMEt restore_eventtcountertis_restore_activet    set_styletSTYLE(tselfR((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/ParenMatch.pyt__init__;s     
        cCsC|js?x'|jD]}|jj|j|ƒqWt|_ndS(N(RtRESTORE_SEQUENCESRt    event_addRtTrue(Rtseq((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/ParenMatch.pytactivate_restoreGs    cCsC|jr?x'|jD]}|jj|j|ƒqWt|_ndS(N(RRRt event_deleteRtFalse(RR!((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/ParenMatch.pytdeactivate_restoreMs    cCs[||_|dkr0|j|_|j|_n'|dkrW|j|_|j|_ndS(NR R (Rtcreate_tag_defaultt
create_tagtset_timeout_lastt set_timeouttcreate_tag_expressiontset_timeout_none(RR ((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/ParenMatch.pyRSs        cCsWt|jdƒjƒ}|dkr2|jƒdS|jƒ|j|ƒ|jƒdS(Ntinsert(RRtget_surrounding_bracketstNonetwarn_mismatchedR"R'R((Rteventtindices((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/ParenMatch.pytflash_paren_event\s 
 
 cCs™|jjdƒ}|tkr"dSt|jdƒ}|jƒsDdS|jt|tƒ}|dkrt|j    ƒdS|j
ƒ|j |ƒ|j ƒdS(Ns    insert-1c( Rtgett_openersRRt
is_in_codeR-R R.R/R"R'R)(RR0tcloserthpR1((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/ParenMatch.pytparen_closed_eventes   
 
 cCs-|jjdƒ|jƒ|jd7_dS(Ntpareni(Rt
tag_deleteR%R(RR0((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/ParenMatch.pyRus
cCs ||jkr|jƒndS(N(RR(Rt timer_count((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/ParenMatch.pythandle_restore_timerzscCs|jr|jjƒndS(N(tBELLRR(R((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/ParenMatch.pyR/~s    cCs1|jjd|dƒ|jjd|jƒdS(s'Highlight the single paren that matchesR9iN(Rttag_addt
tag_configt HILITE_CONFIG(RR1((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/ParenMatch.pyR&…scCsk|jj|dƒd    kr-|dd}n
|d}|jjd|d|ƒ|jjd|jƒdS(
sHighlight the entire expressioniRRRs+1cR9iN(RRR(RR3R>R?R@(RR1t
rightindex((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/ParenMatch.pyR*Šs
 
cCsM|jd7_||j|jjdƒd„}|jjjt||ƒdS(sSHighlight will remain until user input turns it off
        or the insert has movediR,cSsE||jjdƒkr(|j|ƒn|jjjt||ƒdS(NR,(RtindexR<Rt
text_frametaftert CHECK_DELAY(tcallmeRtcRB((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/ParenMatch.pyRFsN(RRRBRRCRDRE(RRF((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/ParenMatch.pyR+–s    cCs8|jd7_|jjj|j||jd„ƒdS(s7The last highlight created will be removed after .5 secicSs |j|ƒS(N(R<(RRG((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/ParenMatch.pyt<lambda>«sN(RRRCRDt FLASH_DELAY(R((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/ParenMatch.pyR(¥s(sShow surrounding parenss<<flash-paren>>(s
<KeyPress>s <ButtonPress>s <Key-Return>s<Key-BackSpace>N(t__name__t
__module__t__doc__tmenudefsRt    GetOptionRRIt GetHighlightt CurrentThemeR@R=RRRR"R%RR2R8R.RR<R/R&R*R+R((((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/ParenMatch.pyRs4                                                         N((RLtidlelib.HyperParserRtidlelib.configHandlerRR4RER(((sZ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/idlelib/ParenMatch.pyt<module>s