mò &U²Ic@sbdZdkZdklZlZdklZdfd„ƒYZd„Zdfd„ƒYZdS( 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. WARNING: This extension will fight with the CallTips extension, because they both are interested in the KeyRelease-parenright event. We'll have to fix IDLE to do something reasonable when two or more extensions what to capture the same event. N(s EditorWindows index2line(sidleConft ParenMatchcBsætZdZgZeidddddƒZeiddddddd ƒZeiei ƒd ƒZ eiddd dd dd ƒZ d„Z d„Z d„Zed„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: - fix interaction with CallTips - 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. t extensionsRtstyletdefaultt expressions flash-delayttypetintiôthilitetbelltboolicCsJ||_|i|_t|ƒ|_d|_d|_|i|i ƒdS(Ni( teditwintselfttexttLastOpenBracketFindertfindertcountertNonet_restoret set_styletSTYLE(R R ((t//data/zmath/lib/python2.4/idlelib/ParenMatch.pyt__init__5s     cCs_||_|djo|i|_|i|_n*|djo|i|_|i|_ndS(NRR( RR Rtcreate_tag_defaultt create_tagtset_timeout_lastt set_timeouttcreate_tag_expressiontset_timeout_none(R R((RR=s     cCs^|iit|iƒƒ}|djo|iƒdSnd|_ |i |ƒ|i ƒdS(Ni( R Rtfindt keysym_typeteventtkeysymtindexRtwarn_mismatchedRRR(R RR ((Rtflash_open_paren_eventFs    cCs+|io|iidƒd|_ndS(Ntparen(R RR t tag_deleteR(R R((Rtcheck_restore_eventOs cCs&|d|ijo|iƒndS(Ni(t timer_countR RR%(R R&((Rthandle_restore_timerTscCs|io|iiƒndS(N(R tBELLR R(R ((RR!Xs cCs-|iid|ƒ|iid|iƒdS(s'Highlight the single paren that matchesR#N(R R ttag_addR t tag_configt HILITE_CONFIG(R R ((RR_scCs0|iid|dƒ|iid|iƒdS(sHighlight the entire expressionR#tinsertN(R R R)R R*R+(R R ((RRdscCsdS(s3Highlight will remain until user input turns it offN((R ((RRlscCs9|iii|i||id„ƒ|id|_dS(s7The last highlight created will be removed after .5 seccCs |i|ƒS(N(R R'tc(R R-((RtusiN(R R t text_frametaftert FLASH_DELAYR(R ((RRps(t__name__t __module__t__doc__tmenudefstidleConft GetOptionRR1t GetHighlightt CurrentThemeR+R(RRR"RR%R'R!RRRR(((RRs&         cCsj|djp |djodSn|djp |djodSn|djp |djod SndS( Nt parenrightt(R#t bracketrightt[tbrackett bracerightt{tbrace(tks(RB((RRys R cBsPtZeiZeiZeiZeiZd„Zd„Zd„Z d„Z RS(NcCs||_|i|_dS(N(R R R (R R ((RR‰s c Csãti|i|iƒ}x›|iD]}t||dƒ}t |ƒd}|i i|dƒd d}|i|ƒ|i|i|i|ƒƒ}|dj p |djoPq"q"W|i|pdƒ|iƒ}||ifS(Nis.0R,iÿÿÿÿs i(tPyParsetParserR t indentwidthttabwidthtytnum_context_linestcontexttmaxtlnotstartattreprt startatindexR tgettrawtexttset_strtfind_good_parse_starttcontext_use_ps1t_build_char_in_string_functbodRtset_lotget_last_open_bracket_postitstr( R RKRPRLRXRIRGRNRU((Rt_find_offset_in_bufs     c Cs©t|iidƒƒ}|i|ƒ\}}|djpt ||ƒ|jodSn||i dƒd}|| }|idƒd}||}d|||fS(s*Return the location of the last open parenR,s is%d.%dN(t index2lineR R R RKRZRXtbufRRtright_keysym_typetcountt lines_backt upto_opentrfindtjtoffset( R R]R_RXRbRKRcR\R`((RR s$  cCs||iid„}|S(NcCs||d|ƒS(Ns%dc(ticist startindexRc(RcReRd((Rtinner¯s(ReR R tis_char_in_stringRf(R ReRf((RRT®s( R2R3t EditorWindowRHRERFRSRRZRRT(((RR ƒs       ( R4RCRhR[t configHandlerR6RRR (R R[RCRhR6RR((Rt? s   h