Your IP : 3.129.210.35


Current Path : /opt/alt/python34/lib64/python3.4/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/__pycache__/sre_parse.cpython-34.pyc

�
e f�z�@sdZddlTddlmZdZdZed�Zed�Zed�Z	ed	�Z
ieed
�fd6eed�fd
6eed�fd6eed�fd6eed�fd6eed�fd6eed�fd6eed�fd6Z
i
eefd6eefd
6eefd6eeefgfd6eeefgfd6eeefgfd6eeefgfd6eeefgfd 6eeefgfd!6eefd"6Zied#6ed$6ed%6ed&6e d'6e!d(6e"d)6e#d*6Z$Gd+d,�d,�Z%Gd-d.�d.�Z&Gd/d0�d0�Z'd1d2�Z(d3d4�Z)d5d6�Z*d7d8�Z+d9d:�Z,d;d<d=�Z-d>d?�Z.ed@�Z/edA�Z0edB�Z1ee2e3g�Z4dCdD�Z5dEdF�Z6ddGdHdI�Z7dJdK�Z8dLdM�Z9dGS)NzInternal support module for sre�)�*)�	MAXREPEATz.\[{()*+?^$|z*+?{�
0123456789Z01234567Z0123456789abcdefABCDEFz 	

�z\a�z\b�z\f�
z\n�
z\r�	z\t�z\v�\z\\z\Az\Bz\dz\Dz\sz\Sz\wz\Wz\Z�i�L�m�s�x�a�t�uc@sCeZdZdd�Zddd�Zdd�Zdd	�ZdS)
�PatterncCs1d|_g|_d|_i|_d|_dS)Nr�)�flags�open�groups�	groupdict�
lookbehind)�self�r�./opt/alt/python34/lib64/python3.4/sre_parse.py�__init__Cs
				zPattern.__init__NcCs�|j}|d|_|dk	ru|jj|d�}|dk	retdt|�||f��n||j|<n|jj|�|S)Nrz7redefinition of group name %s as group %d; was group %d)rr�get�error�reprr�append)r�name�gid�ogidrrr�	opengroupJs	
zPattern.opengroupcCs|jj|�dS)N)r�remove)rr%rrr�
closegroupUszPattern.closegroupcCs||jko||jkS)N)rr)rr%rrr�
checkgroupWszPattern.checkgroup)�__name__�
__module__�__qualname__rr'r)r*rrrrrAsrc@s�eZdZddd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�ZdS)�
SubPatternNcCs4||_|dkrg}n||_d|_dS)N)�pattern�data�width)rr/r0rrrr\s
			zSubPattern.__init__rcCsd}ttf}x�|jD]�\}}t|d|dd�|tkr�t�x�|D]%\}}t|dd||�qZWq|tkr�t�xct|d�D]8\}}|r�t|dd�n|j|d�q�Wq|tkrQ|\}}	}
td|�|	j|d�|
r�t|dd�|
j|d�q�qt	||�r�d}xv|D]n}t	|t
�r�|s�t�n|j|d�d}qm|s�td	dd�nt|dd�d}qmW|s�t�q�qtd|�qWdS)
NTz  �end�r�or�elseF� )�tuple�listr0�print�IN�BRANCH�	enumerate�dump�GROUPREF_EXISTS�
isinstancer.)r�level�nl�seqtypes�op�avrr
�	condgroup�item_yes�item_norrrr=bsH 


	

zSubPattern.dumpcCs
t|j�S)N)r"r0)rrrr�__repr__�szSubPattern.__repr__cCs
t|j�S)N)�lenr0)rrrr�__len__�szSubPattern.__len__cCs|j|=dS)N)r0)r�indexrrr�__delitem__�szSubPattern.__delitem__cCs1t|t�r&t|j|j|�S|j|S)N)r?�slicer.r/r0)rrKrrr�__getitem__�szSubPattern.__getitem__cCs||j|<dS)N)r0)rrK�coderrr�__setitem__�szSubPattern.__setitem__cCs|jj||�dS)N)r0�insert)rrKrOrrrrQ�szSubPattern.insertcCs|jj|�dS)N)r0r#)rrOrrrr#�szSubPattern.appendcCs�|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)Nrr�)r1�ANY�RANGEr:�LITERAL�NOT_LITERAL�CATEGORY�
MIN_REPEAT�
MAX_REPEATr0r;r�getwidth�min�max�CALL�
SUBPATTERN�SUCCESS)r�lo�hi�	UNITCODES�REPEATCODESrCrDr
�j�l�hrrrrZ�sD	









%zSubPattern.getwidth)
r+r,r-rr=rHrJrLrNrPrQr#rZrrrrr.Zs(r.c@sgeZdZdd�Zdd�Zddd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)�	TokenizercCs2t|t�|_||_d|_|j�dS)Nr)r?�str�istext�stringrK�_Tokenizer__next)rrjrrrr�s		zTokenizer.__init__cCs�|jt|j�kr%d|_dS|j|j|jd�}|re|jret|d�}n|dkr�y|j|jd}Wntk
r�td��YnX|js�t|�}n||}n|jt|�|_||_dS)Nrrrzbogus escape (end of line))rKrIrj�nextri�chr�
IndexErrorr!)r�char�crrr�__next�s 	
	
zTokenizer.__nextrcCs*||jkr&|r"|j�ndSdS)Nrr)rlrk)rro�skiprrr�match�s

zTokenizer.matchcCs|j}|j�|S)N)rlrk)r�thisrrrr �s	
z
Tokenizer.getcCsNd}xAt|�D]3}|j}||kr2Pn||7}|j�qW|S)Nr3)�rangerlrk)r�n�charset�result�_rprrr�getwhile�s	
zTokenizer.getwhilecCs|j|jfS)N)rKrl)rrrr�tell�szTokenizer.tellcCs|\|_|_dS)N)rKrl)rrKrrr�seek�szTokenizer.seekN)
r+r,r-rrkrsr rzr{r|rrrrrg�s	rgcCsdddl}|jdtdd�d|ko9dknpcd|koUdknpc|d	kS)
Nrz*sre_parse.isident() will be removed in 3.5�
stacklevelrRr�z�A�Zry)�warnings�warn�DeprecationWarning)ror�rrr�isident�s	
r�cCs:ddl}|jdtdd�d|ko7dkSS)Nrz*sre_parse.isdigit() will be removed in 3.5r}rR�0�9)r�r�r�)ror�rrr�isdigit�s	
r�cCssddl}|jdtdd�t|d�s6dSx6|dd�D]$}t|�rGt|�rGdSqGWdS)Nrz)sre_parse.isname() will be removed in 3.5r}rRFrT)r�r�r�r�r�)r$r�rorrr�isname�s	
r�cCs7tj|�}|r|Stj|�}|rB|dtkrB|Sy�|dd�}|dkr�||jdt�7}t|�dkr�t�ntt	|dd�d�d@fS|dkr|j
r||jdt�7}t|�d	kr�t�ntt	|dd�d�fS|d
kr�|j
r�||jdt�7}t|�dkr\t�nt	|dd�d�}t|�t|fS|tkr�||jdt�7}tt	|dd�d�d@fS|t
kr�t�nt|�dkrtt|d�fSWntk
rYnXtd
t|���dS)NrrrRr���r��U��
zbogus escape: %s)�ESCAPESr �
CATEGORIESr:rz�	HEXDIGITSrI�
ValueErrorrU�intrirm�	OCTDIGITS�DIGITS�ordr!r")�source�escaperOrprrr�
_class_escapesF	!		

!	
r�cCstj|�}|r|Stj|�}|r2|Sy�|dd�}|dkr�||jdt�7}t|�dkr�t�ntt|dd�d�d@fS|dkr|j	r||jdt�7}t|�dkr�t�ntt|dd�d�fS|d	kry|j	ry||jd
t�7}t|�dkrLt�nt|dd�d�}t
|�t|fS|dkr�||jdt�7}tt|dd�d
�d@fS|tkr�|j
tkrJ||j�}|dtkrJ|dtkrJ|j
tkrJ||j�}tt|dd�d
�d@fSnt|dd��}||jkr�|j|�s�td
��n|jr�ddl}|jdt�nt|fSt�nt|�dkr�tt|d�fSWntk
rYnXtdt|���dS)NrrRrr�r�r�rr�r�r�r�r�zcannot refer to open grouprz;group references in lookbehind assertions are not supportedzbogus escape: %s)r�r r�rzr�rIr�rUr�rirmr�r�rlrr*r!rr�r��RuntimeWarning�GROUPREFr�r")r�r��staterOrp�groupr�rrr�_escape5sd	!		

! $		

	
r�rcCs�g}|j}|j}x\|t||��|d�r@qn|sJPn|jsc|dd�rgPqtd��qWt|�dkr�|dSt|�}|j}xxd}xj|D]=}	|	s�Pn|dkr�|	d}q�|	d|kr�Pq�q�Wx|D]
}	|	d=q�W||�q�Pq�Wxz|D]0}	t|	�dksT|	ddtkr(Pq(q(Wg}
|
j}x|D]}	||	d�qrW|t|
f�|S|jt	d|ff�|S)N�|�)rzpattern not properly closedr)
r#rs�_parserlr!rIr.rUr:r;)r�r��nested�items�itemsappend�sourcematch�
subpattern�subpatternappend�prefix�item�set�	setappendrrr�
_parse_subrsR			




&	
r�cCs�t||�}|jd�rNt||�}|jd�rTtd��qTnd}|jr|jdd�rtd��nt|�}|jt|||ff�|S)Nr�z/conditional backref with more than two branchesr�rzpattern not properly closed)r�rsr!rlr.r#r>)r�r�rErFrGr�rrr�_parse_sub_cond�sr�z|)z=!<z=!c"Cs�t|�}|j}|j}|j}t}t}t}t}	t}
xp|j	|kr[Pn|�}|dkrtPn|j
t@r�|tkr�qHn|dkr�x|�}|d/kr�Pq�q�WqHq�n|r�|dt
kr�|tt|�f�qH|dkr�g}|j}
|d�r1|
tdf�n|dd�}x�|�}|dkri||kriPnO|r�|ddkr�t||�}n'|r�tt|�f}ntd��|d	�r�|�}|dkr|dtkr�|d
d}n|
|�|
ttd	�f�Pq	|r�|ddkrFt||�}ntt|�f}|dtksx|dtkr�td��n|d
}|d
}||kr�td��n|
t||ff�q	td��qD|dtkr�|d
d}n|
|�qDW||�d
krD|ddtkrD||d�q�||�dkr�|ddtkr�|d
dtkr�|t|d
d
f�q�|t|f�qH|rN|dtkrN|d
kr�d0\}}n�|dkr�dt}}n�|dkrd
t}}nw|dkr�|j	dkrL|tt|�f�qHn|j�}dt}}d}}x#|j	tkr�||j�}qrW|d�r�x)|j	tkr�||�}q�Wn|}|d�s|tt|�f�|j|�qHn|r2t|�}|tkr2td��q2n|r�t|�}|tkr_td��n||kr}td��q}q�ntd��|r�|d1d�}nd}|s�||�d
kr�|ddtkr�td��n|dd|
kr
td��n|d
�r2t|||ff|d2<q�t|||ff|d3<qH|dkrm|t df�qH|dkr2d
}d}d}|d
�rDd}|d�ry|d�r=d}xB|�}|dkr�td��n|dkr�Pn||}q�Wd
}|std��n|j!�svtd |��qvqA|d!�rBd}xB|�}|dkrvtd��n|d"kr�Pn||}qRW|s�td��n|j!�s�td#|��n|j"j|�}|dkrd$j#|�}t|��n|j$r,ddl%}|j&d%t'�n|t(|f�qHqA|�}|dkrftd&��ntd'|��qD|d(�r�d}qD|d�r�x-|j	dks�|j	d"kr�Pn|�q�W|d"�sHtd)��qHqHqD|j	|kr�	|�}d
}|dkrT	|j	|	kr3	td*��nd4}|�}|j$d
7_$nt)||�}|dkr�	|j$d
8_$n|d"�s�	td)��n|d!kr�	|t*||ff�qH|t+||ff�qHqD|d�r�
d} xB|�}|dkr
td��n|d"kr&
Pn| |} q�	Wd}| sO
td��n| j!�r�
|j"j| �}|dkr�
d$j#| �}t|��q�
n1yt| �}Wnt,k
r�
td+��YnX|j$rAddl%}|j&d%t'�qAqD|j	t-krtd&��nx-|j	t-kr@|j
t-|�B|_
qWn|r�|dkr_d}n|j.|�}|r�t/|||�}nt)||�}|d"�s�td)��n|dk	r�|j0|�n|t1||ff�q�x�|�}|dkrtd&��n|d"krPntd,��q�WqH|dkrQ|tt2f�qH|d-krs|jtt3f�qH|r�|ddkr�t4|||�}!||!�qHtd.��qHW|S)5N�#rr�[�^�]rz$unexpected end of regular expression�-rzbad character rangerR�?r�+�{�}r3�,z"the repetition number is too largezbad repeat intervalz
not supportedznothing to repeatzmultiple repeat�.�(�P�<zunterminated name�>zmissing group namezbad character in group name %r�=r�z&bad character in backref group name %rzunknown group name: {0!r}z;group references in lookbehind assertions are not supportedzunexpected end of patternzunknown specifier: ?P%s�:zunbalanced parenthesiszsyntax errorzbad character in group namezunknown extension�$zparser error)Nr)rr���r�r�r�)5r.r#r rsrI�_PATTERNENDERS�_ASSERTCHARS�_LOOKBEHINDASSERTCHARS�_REPEATCODESrlr�SRE_FLAG_VERBOSE�
WHITESPACE�
SPECIAL_CHARSrUr��NEGATEr�r!r:rTrV�REPEAT_CHARSrr{r�r|r��
OverflowError�ATrXrYrS�isidentifierr�formatrr�r�r�r�r��ASSERT�
ASSERT_NOTr��FLAGSr'r�r)r^�AT_BEGINNING�AT_ENDr�)"r�r�r�r��	sourcegetr��_len�
PATTERNENDERS�ASSERTCHARS�LOOKBEHINDASSERTCHARSrcrtr�r��start�code1�code2r`rar[r\�herer�r�r$rEror%�msgr��dir�p�condnamerOrrrr��s�				
					
 

&:


-		
		
					
		
		
r�cCs_t|t�rB|t@s&|tO}q[|t@r[td��q[n|t@r[td��n|S)Nz(ASCII and UNICODE flags are incompatiblez+can't use UNICODE flag with a bytes pattern)r?rh�SRE_FLAG_ASCII�SRE_FLAG_UNICODEr�)�srcrrrr�	fix_flags�s



r�NcCs�t|�}|dkr$t�}n||_||_t||d�}t||jj�|j_|j�}|dkr�td��n|r�td��n|t	@r�|j
�n|t@r�|jjt@r�t||jj�S|S)Nrr�zunbalanced parenthesisz-bogus characters at end of regular expression)
rgrrrhr�r�r/r r!�SRE_FLAG_DEBUGr=r��parse)rhrr/r�r��tailrrrr�s"		

r�c
snt|�}|j}g�g�g��j}���fdd�}x�|�}|dkrdPn|ddkr|d}|dkr�d}|jd�r�xE|�}	|	dkr�td	��n|	d
kr�Pn||	7}q�Wn|s�td��ny+t|�}
|
dkr&td��nWnntk
r�|j�sRtd
��ny|j|}
Wn-t	k
r�dj
|�}t|��YnXYnX||
�q|dkr|jt
kr�||�7}|jt
kr�||�7}q�n|tt|dd�d�d@��q|tkr�d}|jtkr�||�7}|t
kr�|dt
kr�|jt
kr�||�7}d}|tt|dd�d�d@��q�n|s|t|dd���qqytt|d�}Wnt	k
rYnX||�qK||�qKW�r?�jdj���nt|t�sddd��D��n��fS)NcsV�r,�jdj����dd�=n�jt��|f��jd�dS)Nr3)r#�joinrI)rK)r�literal�literalsrr�addgroup(s
z parse_template.<locals>.addgrouprrr�gr3r�zunterminated group namer�zmissing group nameznegative group numberzbad character in group namezunknown group name: {0!r}r�r�r�FrRTcSs1g|]'}|dkrdn|jd��qS)Nzlatin-1)�encode)�.0rrrr�
<listcomp>ls	z"parse_template.<locals>.<listcomp>)rgr r#rsr!r�r�r��
groupindex�KeyErrorr�rnrlr�rmr�r�r�r?rh)
r�r/r�sget�lappendr�rtrpr$rorKr��isoctalr)rr�r�r�parse_templates�			
	



*

- 

r�c	Cs�|j}|jdd�}|\}}|dd�}yJxC|D];\}}||�||<}|dkrBtd��qBqBWWntk
r�td��YnX|j|�S)Nrzunmatched groupzinvalid group reference)r�rjr!rnr�)	�templatersr��seprr�rKr�rrrr�expand_templateos	
r�):�__doc__�
sre_constants�_srerr�r�r�r�r�r�r�rUr�r�r��AT_BEGINNING_STRING�AT_BOUNDARY�AT_NON_BOUNDARYr:rW�CATEGORY_DIGIT�CATEGORY_NOT_DIGIT�CATEGORY_SPACE�CATEGORY_NOT_SPACE�
CATEGORY_WORD�CATEGORY_NOT_WORD�
AT_END_STRINGr��SRE_FLAG_IGNORECASE�SRE_FLAG_LOCALE�SRE_FLAG_MULTILINE�SRE_FLAG_DOTALLr�r��SRE_FLAG_TEMPLATEr�r�rr.rgr�r�r�r�r�r�r�r�r�r�rXrYr�r�r�r�r�r�rrrr�<module>sr




e4*=;�7P

?>