Plan 9 from Bell Labs’s /usr/web/sources/contrib/stallion/root/sys/lib/python2.7/sre_parse.pyo

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


�`^c@s�dZddlZddlTdZdZed�Zed�Zed�Zed	�Z	ie
ed
�fd6e
ed�fd
6e
ed�fd6e
ed�fd6e
ed�fd6e
ed�fd6e
ed�fd6e
ed�fd6Zi
e
efd6e
efd
6e
efd6eeefgfd6eeefgfd6eeefgfd6eeefgfd6eeefgfd 6eeefgfd!6e
efd"6Zied#6ed$6ed%6ed&6ed'6e d(6e!d)6Z"d*fd+��YZ#d,fd-��YZ$d.fd/��YZ%d0�Z&d1�Z'd2�Z(d3�Z)d4�Z*d5d6�Z+d7�Z,ed8�Z-ed9�Z.ed:�Z/ee0e1g�Z2d;�Z3d<e4d=�Z5d>�Z6d?�Z7dS(@sInternal support module for srei�N(t*s.\[{()*+?^$|s*+?{t
0123456789t01234567t0123456789abcdefABCDEFs 	

ss\ass\bss\fs
s\ns
s\rs	s\tss\vs\s\\s\As\Bs\ds\Ds\ss\Ss\ws\Ws\ZtitLtmtstxtttutPatterncBs/eZd�Zdd�Zd�Zd�ZRS(cCs(d|_g|_d|_i|_dS(Nii(tflagstopentgroupst	groupdict(tself((s/sys/lib/python2.7/sre_parse.pyt__init__Cs			cCs�|j}|d|_|dk	rr|jj|d�}|dk	rbtdt|�||f�n||j|<n|jj|�|S(Nis7redefinition of group name %s as group %d; was group %d(RtNoneRtgetterrortreprR
tappend(Rtnametgidtogid((s/sys/lib/python2.7/sre_parse.pyt	opengroupHs	
cCs|jj|�dS(N(R
tremove(RR((s/sys/lib/python2.7/sre_parse.pyt
closegroupSscCs||jko||jkS(N(RR
(RR((s/sys/lib/python2.7/sre_parse.pyt
checkgroupUsN(t__name__t
__module__RRRRR(((s/sys/lib/python2.7/sre_parse.pyRAs		t
SubPatterncBsheZdd�Zdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�ZRS(cCs4||_|dkrg}n||_d|_dS(N(tpatternRtdatatwidth(RR!R"((s/sys/lib/python2.7/sre_parse.pyRZs
			icCsud}td�tg�f}xP|jD]E\}}|d|Gd}|dkr�Hd}x|D]!\}}|dd|G|GHq`Wn�|dkr�}d}x�|dD]C}|dkr�|ddGHn|j|d�d}|d}q�Wnmt|�|krYxX|D]C}t|t�rH|s.Hn|j|d�d}q|Gd}qWn
|Gd}|s(Hq(q(WdS(Nis  itintbranchtor((ttypeR"tdumpt
isinstanceR (RtleveltnltseqtypestoptavtaR((s/sys/lib/python2.7/sre_parse.pyR(`sB
	
cCs
t|j�S(N(RR"(R((s/sys/lib/python2.7/sre_parse.pyt__repr__|scCs
t|j�S(N(tlenR"(R((s/sys/lib/python2.7/sre_parse.pyt__len__~scCs|j|=dS(N(R"(Rtindex((s/sys/lib/python2.7/sre_parse.pyt__delitem__�scCs1t|t�r&t|j|j|�S|j|S(N(R)tsliceR R!R"(RR3((s/sys/lib/python2.7/sre_parse.pyt__getitem__�scCs||j|<dS(N(R"(RR3tcode((s/sys/lib/python2.7/sre_parse.pyt__setitem__�scCs|jj||�dS(N(R"tinsert(RR3R7((s/sys/lib/python2.7/sre_parse.pyR9�scCs|jj|�dS(N(R"R(RR7((s/sys/lib/python2.7/sre_parse.pyR�scCs�|jr|jSd}}ttttttf}ttf}xy|j	D]n\}}|t
kr�td}d}xB|dD]6}|j�\}	}
t
||	�}t||
�}q{W||}||}qH|tkr|j�\}}||}||}qH|tkr:|dj�\}}||}||}qH||kr�|dj�\}}|||d}|||d}qH||kr�|d}|d}qH|tkrHPqHqHWt
|td�t
|t�f|_|jS(Niii(R#tANYtRANGEtINtLITERALtNOT_LITERALtCATEGORYt
MIN_REPEATt
MAX_REPEATR"tBRANCHt	MAXREPEATtgetwidthtmintmaxtCALLt
SUBPATTERNtSUCCESS(Rtlothit	UNITCODEStREPEATCODESR-R.Rtjtlth((s/sys/lib/python2.7/sre_parse.pyRD�sD	









%N(
RRRRR(R0R2R4R6R8R9RRD(((s/sys/lib/python2.7/sre_parse.pyR Xs							t	TokenizercBsAeZd�Zd�Zdd�Zd�Zd�Zd�ZRS(cCs ||_d|_|j�dS(Ni(tstringR3t_Tokenizer__next(RRR((s/sys/lib/python2.7/sre_parse.pyR�s		cCs�|jt|j�kr%d|_dS|j|j}|ddkr�y|j|jd}Wntk
rytd�nX||}n|jt|�|_||_dS(Nis\isbogus escape (end of line)(R3R1RRRtnextt
IndexErrorR(Rtchartc((s/sys/lib/python2.7/sre_parse.pyt__next�s	


icCs*||jkr&|r"|j�ndSdS(Nii(RTRS(RRVtskip((s/sys/lib/python2.7/sre_parse.pytmatch�s

cCs|j}|j�|S(N(RTRS(Rtthis((s/sys/lib/python2.7/sre_parse.pyR�s	
cCs|j|jfS(N(R3RT(R((s/sys/lib/python2.7/sre_parse.pyttell�scCs|\|_|_dS(N(R3RT(RR3((s/sys/lib/python2.7/sre_parse.pytseek�s(RRRRSRZRR\R](((s/sys/lib/python2.7/sre_parse.pyRQ�s		
		cCsBd|kodknpAd|ko3dknpA|dkS(NR/tztAtZt_((RV((s/sys/lib/python2.7/sre_parse.pytisident�scCsd|kodkSS(Nt0t9((RV((s/sys/lib/python2.7/sre_parse.pytisdigit�scCsKt|d�stSx0|dD]$}t|�rt|�rtSqWtS(Nii(RbtFalseRetTrue(RRV((s/sys/lib/python2.7/sre_parse.pytisname�scCs�tj|�}|r|Stj|�}|rB|dtkrB|SyO|dd!}|dkr�5|jtkr�t|�dkr�||j�}qaW|d}t|�dkr�tdtd|��nt	t
|d�d	@fS|tkrHx5|jtkr&t|�dkr&||j�}q�d}t	t
|d
�d	@fS|tkrjtdt|��nt|�dkr�t	t
|d�fSWntk
r�nXtdt|��dS(NiiiRisbogus escape: %ss\ii�i(tESCAPESRt
CATEGORIESR<RTt	HEXDIGITSR1RRR=tintt	OCTDIGITStDIGITStordt
ValueError(tsourcetescapeR7RW((s/sys/lib/python2.7/sre_parse.pyt
_class_escape�s6
$
$

cCsBtj|�}|r|Stj|�}|r2|Sy�dd!}|dkr�x5|jtkr�t|�dkr�||j�}qQWt|�dkr�t�ntt|dd�d@fS|dkrx5|jt	kr�|�dkr�|j�}q�Wtt|dd�d@fS|t
kr�jt
kr�||j�}|dt	kr�|dt	kr�|jt	kr�||j�}tt|dd�d@fSnt|d�}||jkr�j|�s�t
d	�nt|fSt�nt|�dkrtt|d�fSWntk
r*nXt
d
t|��dS(NiiRiii�Rciscannot refer to open groupsbogus escape: %s(RjRRiRTRkR1RpR=RlRmRnRRRtGROUPREFRoR(RqRrtstateR7RWtgroup((s/sys/lib/python2.7/sre_parse.pyt_escapesH
$	$ 
	
icCs�g}|j}|j}xX|t||��|d�r@qn|sJPn|jsc|dd�rgPqtd�qt|�dkr�|dSt|�}|j}xwd}xj|D]=}	|	s�Pn|dkr�|	d}q�|	d|kr�Pq�q�Wx|D]
}	|	d=q�|�q�Pq�xz|D]0}	t|	�dksO|	ddtkr#Pq#q#Wg}
|
j}x|D]}	||	d�qmW|t	|
f�|S|jt
d|ff�|S(Nt|t)ispattern not properly closedi(RRZt_parseRTRR1R RR=R<RB(RqRutnestedtitemstitemsappendtsourcematcht
subpatterntsubpatternappendtprefixtitemtsett	setappend((s/sys/lib/python2.7/sre_parse.pyt
_parse_sub-sR			




&	
cCs�t||�}|jd�rKt||�}|jd�rQtd�qQnd}|jry|jdd�rytd�nt|�}|jt|||ff�|S(NRxs/conditional backref with more than two branchesRyispattern not properly closed(RzRZRRRTR RtGROUPREF_EXISTS(RqRut	condgrouptitem_yestitem_noR((s/sys/lib/python2.7/sre_parse.pyt_parse_sub_condhss|)s=!<s=!c!Cs�t|�}|j}|j}|j}t}t}t}t}	t}
x�|j	|kr[Pn|�}|dkrtPn|jt@r�|t
kr�qHn|dkr�x|�}|d/kr�Pq�q�qHq�n|r�dtkr�tt|�f�qH|dkr�g}|j}
|d�r0|
tdf�n|}x�|�}|dkr_||kr_PnL|r�|ddkr�t||�}n$|r�tt|�f}n	td�|d	�r�|�}|dkr|dtkr�d
d}n|
|�|
ttd	�f�Pq�r�|ddkr9t||�}ntt|�f}|dtksk|dtkrwtd�n|d
}|d
}||kr�td�n|
t||ff�q�d�q:|dtkr�d
d}n|
|�q:||�d
kr-|ddtkr-||d�q�|�dkr�|ddtkr�|d
dtkr�|t|d
d
f�q�t|f�qH|r(|dtkr(|d
kr�d0\}}n�|dkr�t}}n�|dkr�t}}nt|dkri|j	dkr5|tt|�f�qHn|j�}dt}}d}}x#|j	tkr}||j�}q[W|d�r�x)|j	tkr�||�}q�Wn|}|d�s�tt|�f�|j|�qHn|rt|�}|tkrtd��qn|rrt|�}|tkrHtd��n||krftd��qfqrn	td�|r�|d}nd}|s�||�d
kr�|ddtkr�td�n|dd|
kr�d�n|d
�rt|||ff|d<q� |||ff|d<qH|dkrG|t!df�qH|dkrbd
}d}d}|d
�r~
d}|d�r|d�rd}x>|�}|dkr�td�n|dkr�Pn||}q�d
}|s�d ��nt"|�std!|��qq{
|d"�r�}x>|�}|dkrItd�n|d#krYPn||}q(|s{td ��nt"|�s�td$|��n|j#j|�}|dkr�d%j$|�}t|��n|t%|f�qHq{
|�}|dkr
td&�ntd'|�q~
|d(�r2d}q~
|d�r�x,|j	dks_|j	d#krcPn|�qA|d#�sHtd)�qHqHq~
|j	|krJ	|�}d
}|dkr�j	|	kr�td*�nd}|�}nt&||�}|d#�s		td)�n|d"kr.	|t'||ff�qH|t(||ff�qHq~
|d�r3
d}x>|�}|dkr�td�n|d#kr�Pn||}q_	d}|s�td ��nt"|�r
|j#j|�}|dkr0
d%j$|�}t|��q0
q{
yt|�}Wq{
t)k
r/
td+�q{
Xq~
|j	t*krN
td&�nx-|j	t*krz
|jt*|�B|_qQ
Wn|r|dkr�d}n|j+|�}|r�t,|||�}nt&||�}|d#�s�d)�n|dk	r|j-|�n|t.||ff�q��|�}|dkrCtd&�n|d#krSPntd,�q"qH|dkr�|tt/f�qH|d-kr�|jtt0f�qH|r�|ddkr�t1|||�} || �qHtd.�qH|S(1Nt#s
it[t^t]s\s$unexpected end of regular expressiont-isbad character rangeit?Rt+t{t}tt,s"the repetition number is too largesbad repeat intervals
not supportedi�snothing to repeatsmultiple repeatt.t(tPt<sunterminated namet>smissing group namesbad character in group name %rt=Rys&bad character in backref group name %rsunknown group name: {0!r}sunexpected end of patternsunknown specifier: ?P%st:sunbalanced parenthesisssyntax errorsbad character in group namesunknown extensiont$sparser error(Ns
(ii(2R RRRZR1t_PATTERNENDERSt_ASSERTCHARSt_LOOKBEHINDASSERTCHARSt_REPEATCODESRTRRtSRE_FLAG_VERBOSEt
WHITESPACEt
SPECIAL_CHARSR=RotNEGATERsRR<R;R>tREPEAT_CHARSRCR\RnR]Rlt
OverflowErrortATR@RAR:RhRtformatRtR�tASSERTt
ASSERT_NOTRptFLAGSRR�RRHtAT_BEGINNINGtAT_ENDRw(!RqRuRR�t	sourcegetR~t_lent
PATTERNENDERStASSERTCHARStLOOKBEHINDASSERTCHARSRMR[R�R�tstarttcode1tcode2RJRKRERFthereR�RvRR�RVRtmsgtdirtptcondnameR7((s/sys/lib/python2.7/sre_parse.pyRz{s�				
						
 


&:


	
-	
	

		
		

		
icCs�t|�}|dkr$t�}n||_||_t||d�}|j�}|dkrltd�n|r~td�n|t@r�|j	�n|t
@r�|jjt
@r�t||jj�S|S(NiRysunbalanced parenthesiss-bogus characters at end of regular expression(
RQRRRtstrR�RRtSRE_FLAG_DEBUGR(R�R!tparse(R�RR!RqR�ttail((s/sys/lib/python2.7/sre_parse.pyR��s 		

cCs�t|�}|j}g}|j}||d�}|d }t|�td�kr^t}nt}x�|�}	|	dkr�Pn|	r!|	ddkr!|	dd!}
|
dkr�d}|jd�rxA|�}|dkr�d	�n|d
kr�||}q�n|std�ny(t	|�}
|
dkrAtd�nWnit
k
r�t|�sjtd
�ny|j|}
Wq�t
k
r�dj|�}t|��q�XnX|t|
f�q+|
dkr/|jtkr|	|�}	|jtkr|	|�}	qn||t	|	dd�d@��q+|
tkr�}|jtkr�|	|�}	|
tkr�|	dtkr�|jtkr�|	|�}	t}||t	|	dd�d@��q�n|s|tt	|	d�f�qq+y|t|	d�}	Wnt
k
rnX||	�qg||	�qgd}g}|j}dgt|�}xG|D]?\}
}|
tkr�|||f�n
|||<|d}q]W||fS(NcSsM|r9|ddtkr9t|dd|f|d<n|t|f�dS(Ni�ii(R=(tliteralR�tpappend((s/sys/lib/python2.7/sre_parse.pyR��siR�s\iitgR�sunterminated group nameR�smissing group namesnegative group numbersbad character in group namesunknown group name: {0!r}Rcii�(RQRRR'tchrtunichrRRZRRlRpRht
groupindextKeyErrorR�RUtMARKRTRmRnRfRgRiR1(RqR!RtsgetR�R/R�tseptmakecharR[RWRRVR3R�tisoctalRRtgroupsappendtliterals((s/sys/lib/python2.7/sre_parse.pytparse_template�s�		
		
	


$

' 


	
c	Cs�|j}|jd }|\}}|}yGx@|D]8\}}||�||<}|dkr3td�q3q3WWntk
r�td�nX|j|�S(Nisunmatched groupsinvalid group reference(RvRRRRRUtjoin(	ttemplateRZR�R�RR�R3RvR((s/sys/lib/python2.7/sre_parse.pytexpand_templates	


(8t__doc__tsyst
sre_constantsR�R�R�RnRmRkR�R=RoRiR�tAT_BEGINNING_STRINGtAT_BOUNDARYtAT_NON_BOUNDARYR<R?tCATEGORY_DIGITtCATEGORY_NOT_DIGITtCATEGORY_SPACEtCATEGORY_NOT_SPACEt
CATEGORY_WORDtCATEGORY_NOT_WORDt
AT_END_STRINGRjtSRE_FLAG_IGNORECASEtSRE_FLAG_LOCALEtSRE_FLAG_MULTILINEtSRE_FLAG_DOTALLR�tSRE_FLAG_TEMPLATEtSRE_FLAG_UNICODER�RR RQRbReRhRsRwR�R�R�R�R�R@RAR�RzRR�R�R�(((s/sys/lib/python2.7/sre_parse.pyt<module>sn




Y!					 	,;		�	X

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.