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

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


�`^c@sndZddlZddlZddlZddlTejeksOtd��ejdkrgdZndZd�Z	e
eeg�Z
e
eeeg�Ze
eeg�Ze
eeg�Zd	�Zdd
�Zd�Zd�Zd
�Zd�Zd�Zye Wn e!k
r-e"d�fZ#nXe"d�e"e d��fZ#d�Z$d�Z%dd�Z&dS(sInternal support module for srei�N(t*sSRE module mismatchii�l�cCs|S(N((tx((s,/usr/stallion/src/cpython/Lib/sre_compile.pyt_identityfunctionscCs�|j}t}t}t}t}t}x�|D]�\}	}
|	|kr�|t@r{|tt|	�|t	j
|
|��q�t|	�||
�q.|	tkr!|t@r�|tt|	�|d�}n|t|	�t}||�}|d�t
|
|||�||�|||<q.|	tkrY|t@rH|tt�q�tt�q.|	|kr5|t@r�d�|tt�||�}|d�||
d�||
d�t||
d|�|tt�||�|||<q�|
�r�|	tk	r�|	tkr&|tt�n|tt�||�}|d�||
d�||
d�t||
d|�|tt�||�|||<q�tt�||�}|d�||
d�||
d�t||
d|�||�|||<|	tkr$|tt�q�tt�q.|	tkr�|
drr|tt�||
ddd�nt||
d|�|
dr�tt�||
dddd�q�.|	|kr�|t|	�q.|	|kr�|t|	�||�}|d�|
ddkr(|d�n8|
dj�\}
}|
|krVtd�n||
�t||
d|�|tt�||�|||<q.|	tkr�t|	�||�}|d�t||
|�|tt�||�|||<q.|	t kr�|t|	�|t!@r7t"j#|
|
�}
n|t$@rVt%j#|
|
�}
n|t&@rut'j#|
|
�}
n|t(|
�q.|	t)krX|t|	�g}|j}xt|
dD]h}
||�}|d�t||
|�|tt*�|||��|d�||�|||<q�W|d�x�|D]}||�|||<q7Wq.|	t+kr�|t|	�|t$@r�t,|
}
n|t&@r�t-|
}
n|t.|
�q.|	t/kr�t@r�|tt|	�n|t|	�||
d�q.|	t0kr�|t|	�||
dd�||�}|d�t||
d|�|
dr�|tt*�||�}|d�||�|d||<t||
d|�||�|||<q�|�|d||<q.t1d|	f�q.WdS(NcSstj||�S(N(t_sretgetlower(tliteraltflags((s,/usr/stallion/src/cpython/Lib/sre_compile.pytfixup3sis'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(tcodetpatternRtemitt_lent
LITERAL_CODEStREPEATING_CODESt
SUCCESS_CODEStASSERT_CODEStoptavRtskiptlothittailt
tailappendtskipyestskipno((s,/usr/stallion/src/cpython/Lib/sre_compile.pyR s	





	




 






	











cCs_|j}|dkrt}nx,t||�D]\}}|t|�|tkrWq.|tkrv|||��q.|tkr�|||d��|||d��q.|tkr�|j	|�q.|t
kr�j	|�q.|tkr@|t@r|t
t|�qI|t@r/|t
t|�qI|t
|�q.td�q.W|tt�dS(Niis"internal: unsupported set operator(RtNoneRt_optimize_charsetRtNEGATEtLITERALtRANGEtCHARSETtextendt
BIGCHARSETR0R)R3R1R+R2RtFAILURE(tcharsetRR7RR9R?R@((s,/usr/stallion/src/cpython/Lib/sre_compile.pyR�s0		


cCs/g}|j}dgd}y�x�|D]�\}}|tkrQ|||f�q&|tkrpd|||�<q&|tkr�xLt||d�||d�d�D]}d||<q�Wq&|tkr&|Sq&WWntk
r�t||�SXd}}}	g}
|
j}x_|D]W}|r@|	dkr3|}n|	d}	n|	r_|||	f�d}	n|d}qW|	r�|||	f�nt|
�dkrxQ|
D]I\}}	|	dkr�|t|f�q�|t|||	dff�q�Wt|�t|�kr+|Sn t	|�}
|t
|
f�|S|S(Niiii(RRJRKRLtrangeR0t
IndexErrort_optimize_unicodeR	t
_mk_bitmapRM(RQRtoutt	outappendtcharmapR?R@titptntrunst
runsappendtctdata((s,/usr/stallion/src/cpython/Lib/sre_compile.pyRI�sR	
.
	
	
	"cCs�g}|j}tjdkr'd}nd}|\}}xP|D]H}|rY||}n||}|tkr@||�|\}}q@q@W|S(Niiill(ii(ll(RRtCODESIZEtMAXCODE(tbitsR_t
dataappendtstarttmtvR^((s,/usr/stallion/src/cpython/Lib/sre_compile.pyRUs		



cCsfyddl}Wntk
r$|SXdgd}d}y�x�|D]�\}}|tkrcd}qB|tkr�d|||�<qB|tkr�xLt||d�||d�d�D]}d||<q�WqB|tkrB|SqBWWntk
r�|SX|r9tj	dkr|Sx&td�D]}||||<qWni}dgd}	d}
g}xxtd�D]j}t
||d|dd!�}|j||
�}
|
|	|<|
|
kre|
d}
|t|�}qeqeW|
g}t
jdkr�}nd	}|jd
|	�j�}	|j||	�}	|	jt
jks<t�||	j�}||dd+t|fgS(Ni�iiii�iitHtItB(tarraytImportErrorRJRKRLtxrangeR0RStsyst
maxunicodettuplet
setdefaultRURR`ttostringtitemsizetAssertionErrorttolistRO(RQRRjRXtnegateR?R@RYtcompstmappingtblockR_tchunktnewtheaderR7((s,/usr/stallion/src/cpython/Lib/sre_compile.pyRT-sZ

	.



		
cCsH|dj�\}}||ko-dknoG|dddtkS(Niii(R#R!(R@RBRC((s,/usr/stallion/src/cpython/Lib/sre_compile.pyRbscCsi|j�\}}|dkr"dSg}|j}d}g}|j}	|t@sfx�|jD]�\}
}|
tkr�t|�|kr�|d}n||�qZ|
tkr�|d�dkr�dd\}
}|
tkr�|�q�ZPqZW|rf|jrf|jd\}
}|
tkr�|dr�|dd\}
}|
tkrb|	|
|f�q`|
tkr`g}|j}
xU|dD]@}|s�Pn|d\}
}|
tkr�|
|
|f�q�Pq�W|}q`qc|
tkrKg}|j}
xj|dD]@}|sPn|d\}
}|
tkr=|
|
|f�q��}qc|
tkrc|}qcqfn|j}|t	t
�t|�}|d�d}|r�}t|�|ko�t|j�knr�t}q�|r�t
}n||�|tkr||�n|t�|t }|tkrC||�n
|d�|r8|t|��||�|j|�dgdgt|�}x�tt|��D]y}||d||d<xZ||ddkr|||||ddkr|||ddd||d<q�Wq�W|j|d�n|rQt|||�nt|�|||<dS(Niii�(R#RRR_RKR	R!R.RRtINFOtSRE_INFO_PREFIXtSRE_INFO_LITERALtSRE_INFO_CHARSETRaRNRlR(R7R8RRBRCtprefixtprefixappendtprefix_skipRQt
charsetappendR?R@R^tcappendRZR9RAtmaskttableRY((s,/usr/stallion/src/cpython/Lib/sre_compile.pyt
_compile_infogs�		


"
				
+








7*tcCs(x!tD]}t||�rdSqWdS(Nii(tSTRING_TYPESt
isinstance(tobjttp((s,/usr/stallion/src/cpython/Lib/sre_compile.pytisstring�s
cCsN|jj|B}g}t|||�t||j|�|jtt�|S(N(R8RR�RR_RRR(RZRR7((s,/usr/stallion/src/cpython/Lib/sre_compile.pyt_code�sicCs�t|�r'|}tj||�}nd}t||�}|jjdkr]td��n|jj}dg|jj}x$|j	�D]\}}|||<q�Wt
j|||jjB||jjd||�S(Nids6sorry, but this version only supports 100 named groupsi(
R�t	sre_parsetparseRHR�R8tgroupsRst	groupdicttitemsRtcompileR(RZRR8R7t
groupindext
indexgrouptkRY((s,/usr/stallion/src/cpython/Lib/sre_compile.pyR��s 
('t__doc__RRmR�t
sre_constantstMAGICRsR`RaRtsetRKtNOT_LITERALR
Rt
MIN_REPEATRRRRPRtASSERTt
ASSERT_NOTR
RRHRRIRURTRR�tunicodet	NameErrorttypeR�R�R�R�(((s,/usr/stallion/src/cpython/Lib/sre_compile.pyt<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 [email protected].