�`^c@s�ddlZddlZddlZddlZddlTddlmZddlmZe Z
d�Zd�Zej
e�ej�Zej
dej�Zej
d�Zd efd
��YZd�Zedkr�d
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((s,/sys/lib/python2.7/idlelib/ColorDelegator.pytanyscCs�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(tkwRtbuiltinlisttbuiltintcommenttstringprefixtsqstringtdqstringt sq3stringt dq3stringtstring((s,/sys/lib/python2.7/idlelib/ColorDelegator.pytmake_pats!
s\s+(\w+)s.*?\b(as)\btColorDelegatorcBs�eZd�Zd�Zd�Zd�Zdd�Zdd�ZdZ e
ZeZ
dd�ZdZdd�Zd�Zd �Zd
�Zd�ZRS(
cCs6tj|�t|_t|_t|_|j�dS(N(Rt__init__tprogtidprogtasprogtLoadTagDefs(tself((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyR#)s
cCs�|jdk r|jd�ntj||�|dk rk|j�|jd|j�|jdd�nt |_
t|_dS(Ns<<toggle-auto-coloring>>s1.0tend(
tdelegatetNonetunbindRtsetdelegatet
config_colorstbindttoggle_colorize_eventtnotify_rangetTruetstop_colorizingtFalsetallow_colorizing(R(R*((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyR-0s
cCsJx6|jj�D]%\}}|r|j||�qqW|jd�dS(Ntsel(ttagdefstitemst
tag_configuret tag_raise(R(ttagtcnf((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyR.=scCs�tjddd�}i
tj|d�d6tj|d�d6tj|d�d 6tj|d
�d6tj|d�d
6idd6dd6d6idd6dd6d6tj|d�d6tj|d�d6tj|d�d6|_tr�G|jGHndS(NtmaintThemeRRR
RR RRR Rt
definitiont
DEFINITIONt
backgroundt
foregroundRtTODOtbreaktBREAKterrortERRORthitR7(Rt GetOptiontGetHighlightR+R7tDEBUG(R(ttheme((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyR'CscCsG|j|�}|jj|||�|j||dt|��dS(Ns+%dc(tindexR*tinsertR1tlen(R(RMtcharsttags((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyRNUscCs3|j|�}|jj||�|j|�dS(N(RMR*tdeleteR1(R(tindex1tindex2((s,/sys/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((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyR1cs cCsw|jr9|j}d|_tr)dGHn|j|�nt|_t|_|rs|jsg|j �qs||_
ndS(Nscancel scheduled recolorizer(RVR+RKtafter_cancelR4R5R2R3RWtdestroytclose_when_done(R(R\RV((s,/sys/lib/python2.7/idlelib/ColorDelegator.pytcloseqs
cCs�|jr9|j}d|_tr)dGHn|j|�n|jre|jretrYdGHnt|_n|j|_|jr�|jr�|jd|j �|_ntr�dG|jr�dp�dGHndS(Nscancel scheduled recolorizersstop colorizingisauto colorizing turnedtontoffRD(
RVR+RKRZR5RWR2R3RXRY(R(teventRV((s,/sys/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|jdd�rtr�GHn|j
d |j�|_n|jr/|j}d|_|j�ndS(
Nsno delegatesauto colorizing is offsalready colorizings
colorizing...s%.3f secondsRCs1.0sreschedule colorizingi(R+RVR*RKR5RWR4R3R2ttimetclocktrecolorize_maint
tag_nextrangeRXRYR\R[(R(tt0tt1ttop((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyRY�s@
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�Sx*|j j
�D]}
|j|
||�qW|| }|jj|�}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�}nt|�}xgtr�|jj|||�}|spPn|jd�\}}|jd|d
||d
|�qHWq�q`q`W|jj||j��}qGWd|j|d �kr�}d}nt}|s|jd|�n|j�|jr�tr=dGHndSq�Wq 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(tnexttitemtheadttailRPtlines_to_gettoktmarktlineR;tmtkeytvaluetatbtm1tendpos((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyRc�s�
cCs1x*|jj�D]}|j|dd�qWdS(Ns1.0R)(R7RrRm(R(R;((s,/sys/lib/python2.7/idlelib/ColorDelegator.pytremovecolors�sN(t__name__t
__module__R#R-R.R'R+RNRRRVR2R5R4RWR1R\R]R0RYRcR�(((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyR"'s
QcCs�ddlm}t�}|jd�ttttjd|j ����\}}}}|j d||df�d}t
|dd �}|jd
|�|jddd
d�||�} t
�}
| j|
�|j�dS(Ni�(t
PercolatorsTest ColorDelegators[x+]s+%d+%di�s&if somename: x = 'abc' # comment
printRAtwhiteRNtexpanditfilltboth(tidlelib.PercolatorR�tTkttitletlisttmaptinttretsplittgeometrytTextRNtpackR"tinsertfiltertmainloop(tparentR�troottwidththeighttxtytsourcettexttptd((s,/sys/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�(((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyt<module>s"
�
|