ó |G_Tc@súddlZddlZddlZddlZddlTddlmZddlmZe Z d„Z d„Z ej e ƒejƒZej dejƒZej dƒZd efd „ƒYZd „Zed krödd lmZeeƒndS(iÿÿÿÿN(t*(t Delegator(tidleConfcCsd|dj|ƒdS(s9Return a named group pattern matching list of alternates.s(?P<%s>t|t)(tjoin(tnamet alternates((s2/usr/local/lib/python2.7/idlelib/ColorDelegator.pytany sc Csýdtdtjƒd}gttƒD]!}|jdƒs't|ƒ^q'}|jdƒdtd|ƒd}tddgƒ}d }|d }|d }|d }|d } td|| ||gƒ} |d|d|d| dtddgƒS(Ns\btKEYWORDt_tprints([^.'\"\\#]\b|^)tBUILTINtCOMMENTs#[^\n]*s((\br|u|ur|R|U|UR|Ur|uR|b|B|br|Br|bR|BR)?s'[^'\\\n]*(\\.[^'\\\n]*)*'?s"[^"\\\n]*(\\.[^"\\\n]*)*"?s''''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?s'"""[^"\\]*((\\.|"(?!""))[^"\\]*)*(""")?tSTRINGRtSYNCs\n(Rtkeywordtkwlisttdirt __builtin__t startswithtstrtremove( tkwRt builtinlisttbuiltintcommentt stringprefixtsqstringtdqstringt sq3stringt dq3stringtstring((s2/usr/local/lib/python2.7/idlelib/ColorDelegator.pytmake_pats!     s\s+(\w+)s .*?\b(as)\btColorDelegatorcBs˜eZd„Zd„Zd„Zd„Zd d„Zd d„Zd Z e Z e Z d d„Zd Zd d„Zd„Zd „Zd „Zd „ZRS( cCs6tj|ƒt|_t|_t|_|jƒdS(N(Rt__init__tprogtidprogtasprogt LoadTagDefs(tself((s2/usr/local/lib/python2.7/idlelib/ColorDelegator.pyR#)s     cCs|jdk r|jdƒntj||ƒ|dk rk|jƒ|jd|jƒ|jddƒnt |_ t |_ dS(Ns<>s1.0tend( tdelegatetNonetunbindRt setdelegatet config_colorstbindttoggle_colorize_eventt notify_rangetTruetstop_colorizingtFalsetallow_colorizing(R(R*((s2/usr/local/lib/python2.7/idlelib/ColorDelegator.pyR-0s   cCsJx6|jjƒD]%\}}|r|j||qqW|jdƒdS(Ntsel(ttagdefstitemst tag_configuret tag_raise(R(ttagtcnf((s2/usr/local/lib/python2.7/idlelib/ColorDelegator.pyR.=scCsùtjdddƒ}i tj|dƒd6tj|dƒd6tj|dƒd 6tj|d ƒd 6tj|d ƒd 6idd6dd6d6idd6dd6d6tj|dƒd6tj|dƒd6tj|dƒd6|_trõdG|jGHndS(NtmaintThemeRRR RR RR R Rt definitiont DEFINITIONt backgroundt foregroundRtTODOtbreaktBREAKterrortERRORthitR7(Rt GetOptiont GetHighlightR+R7tDEBUG(R(ttheme((s2/usr/local/lib/python2.7/idlelib/ColorDelegator.pyR'CscCsG|j|ƒ}|jj|||ƒ|j||dt|ƒƒdS(Ns+%dc(tindexR*tinsertR1tlen(R(RMtcharsttags((s2/usr/local/lib/python2.7/idlelib/ColorDelegator.pyRNUscCs3|j|ƒ}|jj||ƒ|j|ƒdS(N(RMR*tdeleteR1(R(tindex1tindex2((s2/usr/local/lib/python2.7/idlelib/ColorDelegator.pyRRZscCs‡|jd||ƒ|jr.tr*dGHndS|jrQt|_trQdGHqQn|jrƒtrhdGHn|jd|jƒ|_ndS(NRCscolorizing already scheduledsstop colorizingsschedule colorizingi( ttag_addtafter_idRKt colorizingR2R3R5taftert recolorize(R(RSRT((s2/usr/local/lib/python2.7/idlelib/ColorDelegator.pyR1cs     cCsw|jr9|j}d|_tr)dGHn|j|ƒnt|_t|_|rs|jsg|j ƒqs||_ ndS(Nscancel scheduled recolorizer( RVR+RKt after_cancelR4R5R2R3RWtdestroytclose_when_done(R(R\RV((s2/usr/local/lib/python2.7/idlelib/ColorDelegator.pytcloseqs       cCsÅ|jr9|j}d|_tr)dGHn|j|ƒn|jre|jretrYdGHnt|_n|j |_|jr |j r |jd|j ƒ|_ntrÁdG|jr¹dp¼dGHndS(Nscancel scheduled recolorizersstop colorizingisauto colorizing turnedtontoffRD( RVR+RKRZR5RWR2R3RXRY(R(teventRV((s2/usr/local/lib/python2.7/idlelib/ColorDelegator.pyR0s"     cCs3d|_|js$tr dGHndS|js?tr;dGHndS|jrZtrVdGHndSz\t|_t|_tr}dGHnt j ƒ}|j ƒt j ƒ}trµd||GHnWdt|_X|jr|j ddƒrtrìdGHn|j d |jƒ|_n|jr/|j}d|_|jƒndS( Ns no delegatesauto colorizing is offsalready colorizings colorizing...s %.3f secondsRCs1.0sreschedule colorizingi(R+RVR*RKR5RWR4R3R2ttimetclocktrecolorize_maint tag_nextrangeRXRYR\R[(R(tt0tt1ttop((s2/usr/local/lib/python2.7/idlelib/ColorDelegator.pyRYs@             cCsMd}x@trH|jd|ƒ}|s+Pn|\}}|jd||ƒ|jd|ƒ}|ro|d}nd}d}|}d}t}xµ|sD|}|j|d|ƒ}t|ddƒ}d|j|d ƒk}|j||ƒ} | sûdSx*|j j ƒD]} |j| ||ƒq W|| }|j j |ƒ} xŽ| rÔxf| j ƒjƒD]R\} } | r`| j| ƒ\}}|j| |d ||d |ƒ| dkr|jj||ƒ}|r¯|jdƒ\}}|jd |d ||d |ƒq¯q²| dkr²d|kr9|jdƒ}n t|ƒ}xgtr«|jj|||ƒ}|spPn|jdƒ\}}|jd|d ||d |ƒqHWq²q`q`W|j j || jƒƒ} qGWd|j|d ƒkrý|}d}nt}|s|jd|ƒn|jƒ|jrtr=dGHndSqWq WdS(Ns1.0RCRits+%d lines linestartiids-1cs+%dctdeftclassR@timportt#R scolorizing stopped(RiRj(R2Rdt tag_removet tag_prevrangeR4RMtmint tag_namestgetR7tkeysR$tsearcht groupdictR8tspanRUR%tmatchROR&R)tupdateR3RK(R(tnexttitemtheadttailRPt lines_to_gettoktmarktlineR;tmtkeytvaluetatbtm1tendpos((s2/usr/local/lib/python2.7/idlelib/ColorDelegator.pyRc­s„                      cCs1x*|jjƒD]}|j|ddƒqWdS(Ns1.0R)(R7RrRm(R(R;((s2/usr/local/lib/python2.7/idlelib/ColorDelegator.pyt removecolorsþsN(t__name__t __module__R#R-R.R'R+RNRRRVR2R5R4RWR1R\R]R0RYRcR‡(((s2/usr/local/lib/python2.7/idlelib/ColorDelegator.pyR"'s           Qc Csâddlm}tƒ}|jdƒttttjd|j ƒƒƒƒ\}}}}|j d||dfƒd}t |dd ƒ}|j d |ƒ|j d d d dƒ||ƒ} t ƒ} | j| ƒ|jƒdS(Niÿÿÿÿ(t PercolatorsTest ColorDelegators[x+]s+%d+%di–s&if somename: x = 'abc' # comment printRAtwhiteRNtexpanditfilltboth(tidlelib.PercolatorRŠtTkttitletlisttmaptinttretsplittgeometrytTextRNtpackR"t insertfiltertmainloop( tparentRŠtroottwidththeighttxtytsourcettexttptd((s2/usr/local/lib/python2.7/idlelib/ColorDelegator.pyt_color_delegators  3   t__main__(trun(RaR•RRtTkintertidlelib.DelegatorRtidlelib.configHandlerRR4RKRR!tcompiletSR$R%R&R"R¦Rˆtidlelib.idle_test.htestR¨(((s2/usr/local/lib/python2.7/idlelib/ColorDelegator.pyts"       Û