Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/idlelib/SearchEngine.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��Qc@s]ddlZddlTddlZd�Zdd	d��YZd�Zd�Zd�ZdS(
i�N(t*cCs(t|d�s!t|�|_n|jS(Nt
_searchengine(thasattrtSearchEngineR(troot((s*/sys/lib/python2.7/idlelib/SearchEngine.pytgetsRcBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
d�Zd�Z
dd
d�Zd
d�Zd
d�ZRS(cCsw||_t|�|_t|�|_t|�|_t|�|_t|�|_|jjd�t|�|_	dS(Ni(
Rt	StringVartpatvart
BooleanVartrevartcasevartwordvartwrapvartsettbackvar(tselfR((s*/sys/lib/python2.7/idlelib/SearchEngine.pyt__init__
s	cCs
|jj�S(N(RR(R((s*/sys/lib/python2.7/idlelib/SearchEngine.pytgetpatscCs|jj|�dS(N(RR
(Rtpat((s*/sys/lib/python2.7/idlelib/SearchEngine.pytsetpatscCs
|jj�S(N(R	R(R((s*/sys/lib/python2.7/idlelib/SearchEngine.pytisre!scCs
|jj�S(N(R
R(R((s*/sys/lib/python2.7/idlelib/SearchEngine.pytiscase$scCs
|jj�S(N(RR(R((s*/sys/lib/python2.7/idlelib/SearchEngine.pytisword'scCs
|jj�S(N(RR(R((s*/sys/lib/python2.7/idlelib/SearchEngine.pytiswrap*scCs
|jj�S(N(RR(R((s*/sys/lib/python2.7/idlelib/SearchEngine.pytisback-scCsG|j�}|j�s*tj|�}n|j�rCd|}n|S(Ns\b%s\b(RRtretescapeR(RR((s*/sys/lib/python2.7/idlelib/SearchEngine.pytgetcookedpat2s
cCs�|j�}|s&|j|d�dS|j�}d}|j�sT|tjB}nytj||�}WnVtjk
r�}y|\}}Wnt	|�}d}nX|j|||�dSX|S(NsEmpty regular expressionii�(
Rtreport_errortNoneRRRt
IGNORECASEtcompileterrortstr(RRtflagstprogtwhattmsgtcol((s*/sys/lib/python2.7/idlelib/SearchEngine.pytgetprog:s&
i�cCsmdt|�}|r-|dt|�}n|dkrP|dt|�}ntjd|d|j�dS(NsError: s
p\Pattern: is	
Offset: sRegular expression errortmaster(R!ttkMessageBoxt	showerrorR(RRR%R&((s*/sys/lib/python2.7/idlelib/SearchEngine.pyROs	cCs/|j�rtj|�}n|j|�dS(N(RRRR(RR((s*/sys/lib/python2.7/idlelib/SearchEngine.pytsetcookedpatYsicCs�|s|j�}|sdSn|jj�}t|�\}}|j�r�|r[|}n|}t|�\}}	|j||||	||�}
nE|r�|}n|}t|�\}}	|j||||	||�}
|
S(s.Search a text widget for the pattern.

        If prog is given, it should be the precompiled pattern.
        Return a tuple (lineno, matchobj); None if not found.

        This obeys the wrap and direction (back) settings.

        The search starts at the selection (if there is one) or
        at the insert mark (otherwise).  If the search is forward,
        it starts at the right of the selection; for a backward
        search, it starts at the left end.  An empty match exactly
        at either end of the selection (or at the insert mark if
        there is no selection) is ignored  unless the ok flag is true
        -- this is done to guarantee progress.

        If the search is allowed to wrap around, it will return the
        original selection if (and only if) it is the only match.

        N(	R'RRRt
get_selectionRtget_line_coltsearch_backwardtsearch_forward(RttextR#toktwraptfirsttlasttstarttlineR&tres((s*/sys/lib/python2.7/idlelib/SearchEngine.pytsearch_text^s$	!	cCs�d}|}|jd|d|d�}	x�|	r�j|	d |�}
|
rt|sg|
j�|krt||
fSn|d}|r�||kr�Pnd}d}|jd|d|d�}	|	r-|r-d}d}d}|jdd�}	q-q-WdS(Nis%d.0ii�s1.0s2.0(RtsearchtendR(RR0R#R6R&R2R1twrappedt	startlinetcharstm((s*/sys/lib/python2.7/idlelib/SearchEngine.pyR/�s(	


cCsd}|}|jd|d|d�}	x�||	d |�}
|
rn|sa|
j�|krn||
fSn|d}|r�||kr�Pnd}|dkr�s�Pnd}d}|jd�}tt|jd��\}}n|jd|d|d�}	t|	�d}q-dS(Nis%d.0ii�send-1ct.(	Rtsearch_reverseR5tindextmaptinttsplittlenR(RR0R#R6R&R2R1R;R<R=R>tpos((s*/sys/lib/python2.7/idlelib/SearchEngine.pyR.�s,

!N(t__name__t
__module__RRRRRRRRRR'RR+RR8R/R.(((s*/sys/lib/python2.7/idlelib/SearchEngine.pyRs										
	*cCs�|j|�}|sdSd}|j�\}}xi||kr�||kr�|}||krk|d}n|j||�}|s�Pn|j�\}}q4W|S(Ni(R9Rtspan(R#R=R&R>tfoundtitj((s*/sys/lib/python2.7/idlelib/SearchEngine.pyR@�s
cCsqy"|jd�}|jd�}Wntk
r?d}}nX|sX|jd�}n|sg|}n||fS(Ns	sel.firstssel.lasttinsert(RAtTclErrorR(R0R3R4((s*/sys/lib/python2.7/idlelib/SearchEngine.pyR,�s
	cCs(tt|jd��\}}||fS(NR?(RBRCRD(RAR6R&((s*/sys/lib/python2.7/idlelib/SearchEngine.pyR-�s((RtTkinterR)RRR@R,R-(((s*/sys/lib/python2.7/idlelib/SearchEngine.pyt<module>s
	�	

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.