mò *á¸Ec@sódZdkZdkZdkTdklZlZlZlZlZy dkZWndfd„ƒYZ nYXdfd„ƒYZ e eƒZe eƒZe eƒZe eƒZe eƒZei Z dfd „ƒYZ d e fd „ƒYZ dS( s)Provide a thread-safe interface to regex N(t*(ssplitssubsgsubssplitxscapwordst allocate_lockcBstZd„Zd„ZRS(NcGsdS(N((targs((t6/data/zmath/zope/lib/python/StructuredText/ts_regex.pytacquirescGsdS(N((R((Rtreleases(t__name__t __module__RR(((RRs t SafeFunctioncBs8tZeiƒZeiZeiZd„Z d„Z RS(NcCs ||_dS(N(tftselft_f(R R ((Rt__init__ scOs0|iƒz|i||ŽSWd|iƒXdS(N(R t_aR Rtkwt_r(R RR((Rt__call__#s ( RRtthreadRt_lRR RRR R(((RRs     tcompilecBsntZdZdZd„Zd„Zdd„Zdd„Zdd„Z dd„Z dd„Z dd „Z RS( NcGs'tt|Ž|_}|i|ƒdS(N(tregexRRR Rtrt_init(R RR((RR 5scCsItƒ}|i|_|i|_|i|_|i |_ |i |_ dS(N( RtlockRR t _compile__aRt _compile__rRt translatetgivenpattrealpat(R RR((RR9s      icCs3|iƒz|ii||ƒSWd|iƒXdS(N(R RRtmatchtstringtposR(R RR((RRAs cCs3|iƒz|ii||ƒSWd|iƒXdS(N(R RRtsearchRRR(R RR((RR Fs cCsc|iƒzG|i}|i||ƒ}|djodSn||i |ŒfSWd|i ƒXdS(s×Search a string for a pattern. If the pattern was not found, then None is returned, otherwise, the location where the pattern was found, as well as any specified group are returned. iN( R RRRR tstrRtltNonetgroupR(R R!R$RR"R((Rt search_groupKs   cCsc|iƒzG|i}|i||ƒ}|djodSn||i |ŒfSWd|i ƒXdS(sÔMatch a pattern against a string If the string does not match the pattern, then None is returned, otherwise, the length of the match, as well as any specified group are returned. iN( R RRRRR!RR"R#R$R(R R!R$RR"R((Rt match_groupZs   cCs@|iƒz$|i}|i||ƒ|iSWd|iƒXdS(s´Search a string for a pattern. If the pattern was not found, then None is returned, otherwise, the 'regs' attribute of the expression is returned. N( R RRRR R!RtregsR(R R!RR((Rt search_regsis   cCs@|iƒz$|i}|i||ƒ|iSWd|iƒXdS(sÂMatch a pattern against a string If the string does not match the pattern, then None is returned, otherwise, the 'regs' attribute of the expression is returned. N( R RRRRR!RR'R(R R!RR((Rt match_regsws   ( RRR#Rt groupindexR RRR R%R&R(R)(((RR0s       tsymcompcBstZd„ZRS(NcGs3ti|Œ|_}|i|ƒ|i|_dS(N(RR+RR RRRR*(R RR((RR ‡s (RRR (((RR+…s( t__doc__RtregsubtsplittsubtgsubtsplitxtcapwordsRRRRR+( RRR-R/RRRR1R2R0R.R+((Rt?s %       U