Your IP : 18.217.180.169


Current Path : /lib64/python3.6/lib2to3/pgen2/__pycache__/
Upload File :
Current File : //lib64/python3.6/lib2to3/pgen2/__pycache__/literals.cpython-36.pyc

3


 \O�@sPdZddlZddddddd	d
ddd
�
Zdd�Zdd�Zdd�ZedkrLe�dS)z<Safely evaluate Python string literals without using eval().�N����
�
�	��'�"�\)
�a�b�f�n�r�t�vr	r
rcCs�|jdd�\}}|jd�st�tj|�}|dk	r4|S|jd�r�|dd�}t|�dkrbtd|��yt|d�}Wq�tk
r�td|��Yq�Xn0yt|d�}Wn tk
r�td	|��YnXt|�S)
Nr�r�x�z!invalid hex string escape ('\%s')��z#invalid octal string escape ('\%s'))	�group�
startswith�AssertionError�simple_escapes�get�len�
ValueError�int�chr)�m�all�tail�escZhexes�i�r&� /usr/lib64/python3.6/literals.py�escapes$

r(cCs�|jd�s(|jd�s(tt|dd����|d}|dd�|dkrL|d}|j|�sptt|t|�d����t|�dt|�ks�t�|t|�t|��}tjdt|�S)Nr	r
rr�rz)\\(\'|\"|\\|[abfnrtv]|x.{0,2}|[0-7]{1,3}))rr�repr�endswithr�re�subr()�s�qr&r&r'�
evalString(s($r0cCsDx>td�D]2}t|�}t|�}t|�}||kr
t||||�q
WdS)N�)�ranger r*r0�print)r%�cr.�er&r&r'�test2sr6�__main__)�__doc__r,rr(r0r6�__name__r&r&r&r'�<module>s