Plan 9 from Bell Labs’s /usr/web/sources/contrib/bichued/root/sys/lib/python/sre_parse.pyc

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


�
��c@sdZddkZddkTd�ZdZdZed�Zed�Zed	�Zed
�Z	he
ed�fd<e
ed
�fd<e
ed�fd<e
ed�fd<e
ed�fd<e
ed�fd<e
ed�fd<e
ed�fd<Zhe
efd<e
efd<e
efd<eeefgfd<eeefgfd<eeefgfd<eeefgfd <eeefgfd!<eeefgfd"<e
efd#<Zhed$<ed%<ed&<ed'<ed(<e d)<e!d*<Z"d+fd,��YZ#d-fd.��YZ$d/fd0��YZ%d1�Z&d2�Z'd3�Z(d4�Z)d5�Z*d6d7�Z+d8�Z,ed9�Z-ed:�Z.ed;�Z/ee0e1g�Z2d<�Z3d=e4d>�Z5d?�Z6d@�Z7dS(AsInternal support module for srei�N(t*cCs%h}x|D]}d||<q
W|S(Ni((tseqtstelem((s/sys/lib/python/sre_parse.pytsets
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\ZtitLtmRtxtttutPatterncBs/eZd�Zdd�Zd�Zd�ZRS(cCs(d|_g|_d|_h|_dS(Nii(tflagstopentgroupst	groupdict(tself((s/sys/lib/python/sre_parse.pyt__init__Is			cCs�|i}|d|_|dj	oS|ii|d�}|dj	o tdt|�||f�n||i|<n|ii|�|S(Nis7redefinition of group name %s as group %d; was group %d(RtNoneRtgetterrortreprRtappend(Rtnametgidtogid((s/sys/lib/python/sre_parse.pyt	opengroupNs	


cCs|ii|�dS(N(Rtremove(RR((s/sys/lib/python/sre_parse.pyt
closegroupYscCs||ijo
||ijS(N(RR(RR((s/sys/lib/python/sre_parse.pyt
checkgroup[sN(t__name__t
__module__RRRRR (((s/sys/lib/python/sre_parse.pyRGs		t
SubPatterncBsqeZdd�Zdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
RS(
cCs6||_|djo
g}n||_d|_dS(N(tpatternRtdatatwidth(RR$R%((s/sys/lib/python/sre_parse.pyR`s
	

	icCs�d}td�tg�f}x^|iD]S\}}|d|Gd}|djo7Hd}x|D]!\}}|dd|G|GHqaWn�|djoeHd}d}x�|dD]E}|djo|ddGHn|i|d�d}|d}q�Wntt|�|joVx]|D]G}t|t�o'|pHn|i|d�d}q|Gd}qWn|Gd}|pHq(q(WdS(Nis  itintbranchtor((ttypeR%tdumpt
isinstanceR#(RtleveltnltseqtypestoptavtaR((s/sys/lib/python/sre_parse.pyR+fs8




cCs
t|i�S(N(RR%(R((s/sys/lib/python/sre_parse.pyt__repr__�scCs
t|i�S(N(tlenR%(R((s/sys/lib/python/sre_parse.pyt__len__�scCs|i|=dS(N(R%(Rtindex((s/sys/lib/python/sre_parse.pyt__delitem__�scCs|i|S(N(R%(RR6((s/sys/lib/python/sre_parse.pyt__getitem__�scCs||i|<dS(N(R%(RR6tcode((s/sys/lib/python/sre_parse.pyt__setitem__�scCst|i|i||!�S(N(R#R$R%(Rtstarttstop((s/sys/lib/python/sre_parse.pyt__getslice__�scCs|ii||�dS(N(R%tinsert(RR6R9((s/sys/lib/python/sre_parse.pyR>�scCs|ii|�dS(N(R%R(RR9((s/sys/lib/python/sre_parse.pyR�scCs|io|iSnd}}ttttttf}ttf}x�|i	D]�\}}|t
jolti}d}xB|dD]6}|i
�\}	}
t||	�}t||
�}q�W||}||}qM|tjo*|i
�\}}||}||}qM|tjo.|di
�\}}||}||}qM||joJ|di
�\}}|t|�|d}|t|�|d}qM||jo|d}|d}qM|tjoPqMqMWtt|ti��tt|ti��f|_|iS(Nliii(R&tANYtRANGEtINtLITERALtNOT_LITERALtCATEGORYt
MIN_REPEATt
MAX_REPEATR%tBRANCHtsystmaxinttgetwidthtmintmaxtCALLt
SUBPATTERNtlongtSUCCESStint(Rtlothit	UNITCODEStREPEATCODESR0R1Rtjtlth((s/sys/lib/python/sre_parse.pyRJ�sH



	








	3N(R!R"RRR+R3R5R7R8R:R=R>RRJ(((s/sys/lib/python/sre_parse.pyR#^s								t	TokenizercBsAeZd�Zd�Zdd�Zd�Zd�Zd�ZRS(cCs ||_d|_|i�dS(Ni(tstringR6t_Tokenizer__next(RRZ((s/sys/lib/python/sre_parse.pyR�s		cCs�|it|i�jod|_dSn|i|i}|ddjoEy|i|id}Wntj
otd�nX||}n|it|�|_||_dS(Nis\isbogus escape (end of line)(R6R4RZRtnextt
IndexErrorR(Rtchartc((s/sys/lib/python/sre_parse.pyt__next�s	icCs1||ijo|o|i�ndSndS(Nii(R\R[(RR^tskip((s/sys/lib/python/sre_parse.pytmatch�s
cCs|i}|i�|S(N(R\R[(Rtthis((s/sys/lib/python/sre_parse.pyR�s	
cCs|i|ifS(N(R6R\(R((s/sys/lib/python/sre_parse.pyttell�scCs|\|_|_dS(N(R6R\(RR6((s/sys/lib/python/sre_parse.pytseek�s(R!R"RR[RbRRdRe(((s/sys/lib/python/sre_parse.pyRY�s		
		cCsFd|jo
djnp(d|jo
djnp
|djS(NR2tztAtZt_((R^((s/sys/lib/python/sre_parse.pytisident�scCsd|jo
djnS(Nt0t9((R^((s/sys/lib/python/sre_parse.pytisdigit�scCsVt|d�ptSnx6|dD]*}t|�ot|�otSq$q$WtS(Nii(RjtFalseRmtTrue(RR^((s/sys/lib/python/sre_parse.pytisname�sc
Cs�ti|�}|o|Snti|�}|o|Snyh|dd!}|djo�x8|itjo't|�djo||i�}q\W|d}t|�djotdtd|��ntt	|d�d@fSn�|t
jo`x8|it
jo't|�djo||i�}q�|d}tt	|d	�d@fSn%|tjotdt|��nt|�djott|d�fSnWnt
j
onXtdt|��dS(
NiiRisbogus escape: %ss\ii�i(tESCAPESRt
CATEGORIESR\t	HEXDIGITSR4RRRBRQt	OCTDIGITStDIGITStordt
ValueError(tsourcetescapeR9R_((s/sys/lib/python/sre_parse.pyt
_class_escape�s6

&

&

c
Cswti|�}|o|Snti|�}|o|Sny|dd!}|djowx8|itjo't|�djo||i�}q\Wt|�djo
t�ntt|dd�d@fSnO|djoZx8|it	jo't|�djo||i�}q�Wtt|dd�d@fSn�|t
jo�|it
jou||i�}|dt	joP|dt	jo?|it	jo/||i�}tt|dd�d@fSq�nt|d�}||ijo+|i|�p
t
d	�nt|fSnt�nt|�djott|d�fSnWntj
onXt
d
t|��dS(NiiRiii�Rkiscannot refer to open groupsbogus escape: %s(RrRRqR\RsR4RwRBRQRtRuRR RtGROUPREFRvR(RxRytstateR9R_tgroup((s/sys/lib/python/sre_parse.pyt_escapesH

&

&
"#

icCs�g}|i}|i}x_|t||��|d�oqn|pPn|ip|dd�oPqtd�qt|�djo|dSnt|�}|i}x}d}xp|D]C}	|	pPn|djo|	d}q�|	d|joPq�q�Wx|D]
}	|	d=qW||�q�Pq�x}|D]3}	t|	�djp|	ddtjoPq5q5Wg}
|
i}x|D]}	||	d�q�W|t	|
f�|S|it
d|ff�|S(Nt|t)ispattern not properly closedi(RRbt_parseR\RR4R#RRBRARG(RxR|tnestedtitemstitemsappendtsourcematcht
subpatterntsubpatternappendtprefixtitemRt	setappend((s/sys/lib/python/sre_parse.pyt
_parse_sub3sZ		
	
	
(		cCs�t||�}|id�o0t||�}|id�o
td�qUnd}|io!|idd�o
td�nt|�}|it|||ff�|S(NRs/conditional backref with more than two branchesR�ispattern not properly closed(R�RbRRR\R#RtGROUPREF_EXISTS(RxR|t	condgrouptitem_yestitem_noR�((s/sys/lib/python/sre_parse.pyt_parse_sub_condns
s|)s=!<s=!c Cs�t|�}|i}|i}|i}t}t}t}t}	t}
x�|i	|joPn|�}|djoPn|it@oM|t
joqHn|djo(x|�}|d+joPq�q�qHq�n|o+|dtjo|tt|�f�qH|djo�g}|i}
|d�o|
tdf�n|}x�|�}|djo||joPnR|o$|ddjot||�}n'|ott|�f}n
td�|d	�o|�}|djoH|dtjo|d
d}n|
|�|
ttd	�f�Pq|o�|ddjot||�}ntt|�f}|dtjp|dtjo
td�n|d
}|d
}||jo
td�n|
t||ff�qtd�qL|dtjo|d
d}n|
|�qL||�d
jo'|ddtjo||d�q�||�djoF|ddtjo1|d
dtjo|t|d
d
f�q�|t|f�qH|ox|dtjog|d
jod,\}}n�|djodt}}nl|djod
t}}nN|djo7|i	djo|tt|�f�qHn|i�}dt}}d}}x%|i	tjo||i�}q�W|d�o)x,|i	tjo||�}q�Wn|}|d�p*|tt|�f�|i|�qHn|ot|�}n|ot|�}n||jo
td�q�n
td�|o|d}nd}|p(||�d
jo"|ddtjo
td�n|dd|
jo
td�n|d
�ot|||ff|d<q�t|||ff|d<qH|djo|t df�qH|djo�d
}d}d}|d
�o�d}|d�oe|d�ood}xB|�}|djo
td�n|djoPn||}q�d
}t!|�p
td�qqf
|d �o�d}xB|�}|djo
td�n|d!joPn||}q9t!|�p
td�n|i"i|�}|djo
td"�n|t#|f�qHqf
|�}|djo
td#�ntd$|�qj
|d%�o
d}qj
|d�oSx/|i	djp|i	d!joPn|�q3|d!�p
td&�qHqHqj
|i	|jo�|�}d
}|djo0|i	|	jo
td'�nd}|�}nt$||�}|d!�p
td&�n|d jo|t%||ff�qH|t&||ff�qHqj
|d�o�d}xB|�}|djo
td�n|d!joPn||}qb	d}t!|�o0|i"i|�}|djo
td"�q
qf
yt|�}Wqf
t'j
otd�qf
Xqj
|i	t(jo
td#�nx0|i	t(jo|it(|�B|_q:
Wn|o�|djo
d}n|i)|�}|ot*|||�}nt$||�}|d!�p
td&�n|dj	o|i+|�n|t,||ff�q�x�|�}|djo
td#�n|d!joPntd(�qqH|djo|tt-f�qH|d)jo|itt.f�qH|o1|ddjo t/|||�}||�qHtd*�qH|S(-Nt#s
it[t^t]s\s$unexpected end of regular expressiont-isbad character rangeit?Rt+t{t}tt,sbad repeat intervals
not supportedi�snothing to repeatsmultiple repeatt.t(tPt<sunterminated namet>sbad character in group namet=R�sunknown group namesunexpected end of patternsunknown specifier: ?P%st:sunbalanced parenthesisssyntax errorsunknown extensiont$sparser error(Ns
(ii(0R#RRRbR4t_PATTERNENDERSt_ASSERTCHARSt_LOOKBEHINDASSERTCHARSt_REPEATCODESR\RRtSRE_FLAG_VERBOSEt
WHITESPACEt
SPECIAL_CHARSRBRvtNEGATERzRRAR@RCtREPEAT_CHARSt	MAXREPEATRdRuReRQtATRERFR?RpRR{R�tASSERTt
ASSERT_NOTRwtFLAGSRR�RRNtAT_BEGINNINGtAT_ENDR~( RxR|R�R�t	sourcegetR�t_lent
PATTERNENDERStASSERTCHARStLOOKBEHINDASSERTCHARSRURcRR�R;tcode1tcode2RRRSRKRLthereR�R}RR�R^RtdirtptcondnameR9((s/sys/lib/python/sre_parse.pyR��s�				


	

	
		
	

"






(=









	0







	





	







	




 


	






	






 




	




icCs�t|�}|djo
t�}n||_||_t||d�}|i�}|djo
td�n|o
td�n|t@o|i	�n|t
@o(|iit
@ot||ii�Sn|S(NiR�sunbalanced parenthesiss-bogus characters at end of regular expression(
RYRRRtstrR�RRtSRE_FLAG_DEBUGR+R�R$tparse(R�RR$RxR�ttail((s/sys/lib/python/sre_parse.pyR��s 

		


cCs�t|�}|i}g}|i}||d�}|d }t|�td�jo
t}nt}x�|�}	|	djoPn|	o�|	ddjo�|	dd!}
|
djod}|id�oIxF|�}|djo
td	�n|d
joPn||}q�n|p
td�ny*t	|�}
|
djo
td�nWn]t
j
oQt|�p
td
�ny|i|}
Wq�t
j
otd�q�XnX|t|
f�qD|
djog|itjo2|	|�}	|itjo|	|�}	qn||t	|	dd�d@��qD|
tjo�t}|itjow|	|�}	|
tjoY|	dtjoH|itjo8|	|�}	t}||t	|	dd�d@��q�n|p|tt	|	d�f�q6qDy|t|	d�}	Wnt
j
onX||	�qi||	�qid}g}|i}dgt|�}xI|D]A\}
}|
tjo|||f�n|||<|d}qvW||fS(NcSsP|o5|ddtjo t|dd|f|d<n|t|f�dS(Ni�ii(RB(tliteralR�tpappend((s/sys/lib/python/sre_parse.pyR��s iR�s\iitgR�sunterminated group nameR�sbad group namesnegative group numbersbad character in group namesunknown group nameRkii�(RYRRR*tchrtunichrRRbRRQRwRpt
groupindextKeyErrorR]tMARKR\RtRuRnRoRqR4(RxR$RtsgetR�R2R�tseptmakecharRcR_RR^R6tisoctalRRtgroupsappendtliterals((s/sys/lib/python/sre_parse.pytparse_template�s�		

	


	








%


)"
	

c	
Cs�|i}|id }|\}}|}yIxB|D]:\}}||�||<}|djo
td�q3q3WWntj
otd�nX|i|�S(Nisunmatched groupsinvalid group reference(R}RZRRR]tjoin(	ttemplateRbR�R�RR�R6R}R((s/sys/lib/python/sre_parse.pytexpand_templates	

(8t__doc__RHt
sre_constantsRR�R�RuRtRsR�RBRvRqR�tAT_BEGINNING_STRINGtAT_BOUNDARYtAT_NON_BOUNDARYRARDtCATEGORY_DIGITtCATEGORY_NOT_DIGITtCATEGORY_SPACEtCATEGORY_NOT_SPACEt
CATEGORY_WORDtCATEGORY_NOT_WORDt
AT_END_STRINGRrtSRE_FLAG_IGNORECASEtSRE_FLAG_LOCALEtSRE_FLAG_MULTILINEtSRE_FLAG_DOTALLR�tSRE_FLAG_TEMPLATEtSRE_FLAG_UNICODER�RR#RYRjRmRpRzR~R�R�R�R�R�RERFR�R�RR�R�R�(((s/sys/lib/python/sre_parse.pys<module>sp
							Y!					 	,;		�	W

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.