ó
è¾bc           @   s“   d  Z  d d l Z i
 d d 6d d 6d d 6d	 d
 6d d 6d d 6d d 6d d 6d d 6d d 6Z d „  Z d „  Z d „  Z e d k r e ƒ  n  d S(   s<   Safely evaluate Python string literals without using eval().iÿÿÿÿNs   t   as   t   bs   t   fs   
t   ns   t   rs   	t   ts   t   vt   't   "s   \c         C   s  |  j  d d ƒ \ } } | j d ƒ s- t ‚ t j | ƒ } | d  k	 rL | S| j d ƒ rÄ | d } t | ƒ d k  rŠ t d | ƒ ‚ n  y t | d ƒ } Wqû t k
 rÀ t d | ƒ ‚ qû Xn7 y t | d ƒ } Wn! t k
 rú t d	 | ƒ ‚ n Xt	 | ƒ S(
   Ni    i   s   \t   xi   s!   invalid hex string escape ('\%s')i   i   s#   invalid octal string escape ('\%s')(
   t   groupt
   startswitht   AssertionErrort   simple_escapest   gett   Nonet   lent
   ValueErrort   intt   chr(   t   mt   allt   tailt   esct   hexest   i(    (    s,   /usr/lib/python2.7/lib2to3/pgen2/literals.pyt   escape   s$    
c         C   sÚ   |  j  d ƒ s4 |  j  d ƒ s4 t t |  d  ƒ ƒ ‚ |  d } |  d  | d k r_ | d } n  |  j | ƒ s‹ t t |  t | ƒ ƒ ƒ ‚ t |  ƒ d t | ƒ k s­ t ‚ |  t | ƒ t | ƒ !}  t j d t |  ƒ S(   NR   R   i   i    i   i   s)   \\(\'|\"|\\|[abfnrtv]|x.{0,2}|[0-7]{1,3})(   R   R   t   reprt   endswithR   t   ret   subR   (   t   st   q(    (    s,   /usr/lib/python2.7/lib2to3/pgen2/literals.pyt
   evalString(   s    4
,"c          C   s_   xX t  d ƒ D]J }  t |  ƒ } t | ƒ } t | ƒ } | | k r |  G| G| G| GHq q Wd  S(   Ni   (   t   rangeR   R   R!   (   R   t   cR   t   e(    (    s,   /usr/lib/python2.7/lib2to3/pgen2/literals.pyt   test2   s    t   __main__(   t   __doc__R   R   R   R!   R%   t   __name__(    (    (    s,   /usr/lib/python2.7/lib2to3/pgen2/literals.pyt   <module>   s    

		
		