ó
éxTc           @   sn   d  d l  m Z d  d l m Z d   Z d   Z d   Z e d k rj d  d l Z e d e j	 d	  n  d S(
   i˙˙˙˙(   t   division(   t	   tokenizerc         C   s¸  d g  g d d d d d d d d g g d	 d d d d d g g d
 d d d d d g g d d d g g d d d g g d d d d d g g d d d d d g g d d d d d d d g g d d d d d d d d d d g	 g d d d d d d g g d d d d d d g g d d d d d d g g d d  d d! d d d d" g g d# d$ d d d% d d g g d& d$ d d d d g g d' d$ d d d d g g d( d d) g g d* d d g g d+ d d, g g d- d d. g g d/ d d0 g g d1 d d2 g g d3 d d2 g g d4 d d5 g g d6 d d7 g g g } x | D] \ } } |  p>| d  k } | rO| GHn  g  t j d8 |  D] } | j ^ qb} | r| GHn  | d  k	 rŚ| | k sŚt  n  | r#Hq#q#Wd  S(9   Nt    s   resname=a and chain=bt   resnamet   =t   at   andt   chaint   bs   resname a and chain bs   resname resname and chain chains   resname "a b"s   a bs	   resname as   resname ala and backbonet   alat   backbones   resname ala or backbonet   ors   name x and x > 10t   namet   xt   >t   10s   ((expr or expr) and expr)t   (t   exprt   )s   resname and and chain bs   resname ( and chain bs   resname "(" and chain bs)   all_hydrophobic_within(5) and resname ALAt   all_hydrophobic_withint   5t   ALAs   something(a, b)t	   somethingt   ,s   something(a b)s   something("a""b")s   resname 'a \\'s   a \s   resname 'a's   resname '"'t   "s   resname '"\''s   "'s   resname "'\""s   '"s   name o1's   o1's   name """o1'"""s   name """o1
  o2'"""s   o1
  o2's   name """o1\
  o2'"""s   o1  o2't   input_string(   t   NoneR   t   word_iteratort   valuet   AssertionError(   t   verboset   testsR   t   expected_resultt   showt   wordt   result(    (    sG   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/phil/tst_tokenizer.pyt   exercise_basic   s    ! %  c          C   só   d d  l  }  d d  l } xÔ |  | g D]Ć } t j d d  } | j | j |   } | j d k sj t  t j d d  } | j | j |   } | j	 d k sŠ t  t j
 d d  } | j | j |   } | j j d k s% t  q% Wd  S(   Ni˙˙˙˙R   t   hellot   meta_commentt   %R   t   all(   t   picklet   cPickleR   R"   t   loadst   dumpsR   R   t   settingsR&   R   t	   char_iterR   (   R)   R*   t   pt   ot   l(    (    sG   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/phil/tst_tokenizer.pyt   exercise_pickleE   s    c         C   sJ   |  g  d g g k s t   t |   d k } t d |  t   d GHd  S(   Ns	   --verbosei    R   t   OK(   R   t   lenR$   R2   (   t   argsR   (    (    sG   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/phil/tst_tokenizer.pyt   runS   s
    t   __main__NR5   i   (
   t
   __future__R    t   libtbx.philR   R$   R2   R6   t   __name__t   syst   argv(    (    (    sG   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/libtbx/phil/tst_tokenizer.pyt   <module>   s   	A		