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

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


�
��c
@sndZddkZddkZddkTeiejp
td�eidjo
dZndZd�Zd	�Z	e	e
eg�Ze	e
eeg�Ze	eeg�Ze	eeg�Zd
�Zdd�Zd�Zd
�Zd�Zd�Zd�ZyeWn"e j
oe!d�fZ"n Xe!d�e!ed��fZ"d�Z#d�Z$dd�Z%dS(sInternal support module for srei�N(t*sSRE module mismatchii�l�cCs|S(N((tx((s/sys/lib/python/sre_compile.pyt_identityfunctionscCs%h}x|D]}d||<q
W|S(Ni((tseqtstelem((s/sys/lib/python/sre_compile.pytsets
cCs3|i}t}t}t}t}t}x|D]�}	}
|	|joS|t@o,|tt|	�|t	i
|
|��q+|t|	�||
�q.|	tjo�|t@o"|tt|	�|d�}n|t|	�t}||�}|d�t
|
|||�||�|||<q.|	tjo/|t@o|tt�q+|tt�q.|	|jo�|t@o�td�|tt�||�}|d�||
d�||
d�t||
d|�|tt�||�|||<q+t|
�o�|	tj	o�|	tjo|tt�n|tt�||�}|d�||
d�||
d�t||
d|�|tt�||�|||<q+|tt�||�}|d�||
d�||
d�t||
d|�||�|||<|	tjo|tt�q+|tt�q.|	tjo�|
do(|tt�||
ddd�nt||
d|�|
do,|tt�||
dddd�q+q.|	|jo|t|	�q.|	|jo�|t|	�||�}|d�|
ddjo|d�n;|
di�\}
}|
|jo
td�n||
�t||
d|�|tt�||�|||<q.|	tjoZ|t|	�||�}|d�t||
|�|tt�||�|||<q.|	t jo�|t|	�|t!@ot"i#|
|
�}
n|t$@ot%i#|
|
�}
n"|t&@ot'i#|
|
�}
n|t(|
�q.|	t)jo�|t|	�g}|i}xt|
dD]h}
||�}|d�t||
|�|tt*�|||��|d�||�|||<q�|d�x�|D]}||�|||<qgWq.|	t+joR|t|	�|t$@ot,|
}
n|t&@ot-|
}
n|t.|
�q.|	t/joA|t@o|tt|	�n|t|	�||
d�q.|	t0jo�|t|	�||
dd�||�}|d�t||
d|�|
doh|tt*�||�}|d�||�|d||<t||
d|�||�|||<q+||�|d||<q.t1d|	f�q.WdS(NcSsti||�S(N(t_sretgetlower(tliteraltflags((s/sys/lib/python/sre_compile.pytfixup9sis'internal: unsupported template operatoriis(look-behind requires fixed-width patternsunsupported operand type(2tappendtlent_LITERAL_CODESt_REPEATING_CODESt_SUCCESS_CODESt
_ASSERT_CODEStSRE_FLAG_IGNORECASEtOPCODESt	OP_IGNORERRtINRt_compile_charsettANYtSRE_FLAG_DOTALLtANY_ALLtSRE_FLAG_TEMPLATEterrortREPEATt_compiletSUCCESSt_simplet
MAX_REPEATt
REPEAT_ONEtMIN_REPEAT_ONEt	MAX_UNTILt	MIN_UNTILt
SUBPATTERNtMARKtgetwidthtCALLtATtSRE_FLAG_MULTILINEtAT_MULTILINEtgettSRE_FLAG_LOCALEt	AT_LOCALEtSRE_FLAG_UNICODEt
AT_UNICODEtATCODEStBRANCHtJUMPtCATEGORYt	CH_LOCALEt
CH_UNICODEtCHCODEStGROUPREFtGROUPREF_EXISTSt
ValueError(tcodetpatternR
temitt_lent
LITERAL_CODEStREPEATING_CODESt
SUCCESS_CODEStASSERT_CODEStoptavRtskiptlothittailt
tailappendtskipyestskipno((s/sys/lib/python/sre_compile.pyR&s
	



	


"







	



cCsq|i}|djo
t}nx<t||�D]+\}}|t|�|tjoq0|tjo|||��q0|tjo,|||d��|||d��q0|tjo|i	|�q0|t
jo|i	|�q0|tjoT|t@o|t
t|�q[|t@o|t
t|�q[|t
|�q0td�q0W|tt�dS(Niis"internal: unsupported set operator(RtNoneRt_optimize_charsetRtNEGATEtLITERALtRANGEtCHARSETtextendt
BIGCHARSETR4R-R7R5R/R6RtFAILURE(tcharsetR
R;RR=RCRD((s/sys/lib/python/sre_compile.pyR�s2	








c
CsPg}|i}dgd}y�x�|D]�\}}|tjo|||f�q&|tjod|||�<q&|tjo@xRt||d�||d�d�D]}d||<q�Wq&|tjo|Sq&q&WWn tj
ot||�SnXd}}}	g}
|
i}xe|D]]}|o%|	djo
|}n|	d}	n"|	o|||	f�d}	n|d}q"W|	o|||	f�nt|
�djo{xS|
D]K\}}	|	djo|t|f�q�|t|||	dff�q�Wt|�t|�jo|SqLn!t	|�}
|t
|
f�|S|S(Niiii(RRNRORPtrangeR4t
IndexErrort_optimize_unicodeR
t
_mk_bitmapRQ(RURtoutt	outappendtcharmapRCRDtitptntrunst
runsappendtctdata((s/sys/lib/python/sre_compile.pyRM�sZ	



(
	



"cCs�g}|i}tidjo
d}nd}|\}}xT|D]L}|o||}n||}|tjo||�|\}}qBqBW|S(Niiill(ii(ll(RRtCODESIZEtMAXCODE(tbitsRct
dataappendtstarttmtvRb((s/sys/lib/python/sre_compile.pyRYs	



cCs�yddk}Wntj
o|SnXdgd}d}y�x�|D]�\}}|tjo
d}qG|tjod|||�<qG|tjo@xRt||d�||d�d�D]}d||<q�WqG|tjo|SqGqGWWntj
o|SnX|oBti	djo|Snx'td�D]}||||<q8Wnh}dgd}	d}
g}xztd�D]l}t
||d|dd!�}|i||
�}
|
|	|<|
|
jo|
d}
|t|�}q�q�W|
g}t
idjo
d}nd	}|id
|	�i�}	|i||	�}	|	it
ijpt�||	i�}||dd+t|fgS(Ni�iiii�iitHtItb(tarraytImportErrorRNRORPtxrangeR4RWtsyst
maxunicodettuplet
setdefaultRYRRdttostringtitemsizetAssertionErrorttolistRS(RURRnR\tnegateRCRDR]tcompstmappingtblockRctchunktnewtheaderR;((s/sys/lib/python/sre_compile.pyRX3sb	




(
	





	

cCsq|di�\}}|djo|tjo
td�n||jo
djno|dddtjS(Niisnothing to repeati(R't	MAXREPEATRR%(RDRFRG((s/sys/lib/python/sre_compile.pyRhs
cCs�|i�\}}|djodSng}|i}d}g}|i}	|t@p6x�|iD]�\}
}|
tjo/t|�|jo|d}n||�q`|
tjoKt|d�djo4|dd\}
}|
tjo||�qPq`Pq`W|o{|ioq|id\}
}|
tjo�|do�|dd\}
}|
tjo|	|
|f�q�|
tjolg}|i}
xZ|dD]D}|pPn|d\}
}|
tjo|
|
|f�q�Pq�W|}q�q�|
tjolg}|i}
xq|dD]D}|pPn|d\}
}|
tjo|
|
|f�qPqW|}q�|
tjo
|}q�q�n|i}|t	t
�t|�}|d�d}|oEt}t|�|jot|i�jno|t}q n|o|t
}n||�|tjo||�n|t�|t }|tjo||�n|d�|o�|t|��||�|i|�dgdgt|�}x�tt|��D]|}||d||d<x]||ddjoG|||||ddjo&|||ddd||d<q�q�W|i|d�n|ot|||�nt|�|||<dS(Niii�(R'RRRcROR
R%R2RRtINFOtSRE_INFO_PREFIXtSRE_INFO_LITERALtSRE_INFO_CHARSETReRRRpR(R;R<R
RFRGtprefixtprefixappendtprefix_skipRUt
charsetappendRCRDRbtcappendR^R=REtmaskttableR]((s/sys/lib/python/sre_compile.pyt
_compile_infoos�
		

$


	

	


	-







9+tcCs-x&tD]}t||�odSqqWdS(Nii(tSTRING_TYPESt
isinstance(tobjttp((s/sys/lib/python/sre_compile.pytisstring�s
cCsN|ii|B}g}t|||�t||i|�|itt�|S(N(R<R
R�RRcRRR(R^R
R;((s/sys/lib/python/sre_compile.pyt_code�sic	
Cs�t|�o(ddk}|}|i||�}nd}t||�}|iidjotd��n|ii}dg|ii}x$|i	�D]\}}|||<q�Wt
i||||iid||�S(Ni�ids6sorry, but this version only supports 100 named groupsi(R�t	sre_parsetparseRLR�R<tgroupsRwt	groupdicttitemsRtcompile(	R^R
R�R<R;t
groupindext
indexgrouptkR]((s/sys/lib/python/sre_compile.pyR��s$


	
(&t__doc__RRqt
sre_constantstMAGICRwRdReRRROtNOT_LITERALRRt
MIN_REPEATR RRRTRtASSERTt
ASSERT_NOTRRRLRRMRYRXRR�tunicodet	NameErrorttypeR�R�R�R�(((s/sys/lib/python/sre_compile.pys<module>s6

			�	3	+	5		j		

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.