³ò
ÎÆHKc           @   s7   d  d k  Z  d  d k Z d „  Z d „  Z d „  Z d S(   iÿÿÿÿNc         C   sŽ   t  |  d ƒ } xn | D]f } t i d | ƒ } | o t | | i d ƒ <n t i d | ƒ } | o t | | i d ƒ <q q W| i ƒ  d  S(   Nt   rs!   ^\s*call\s+\w+\s+from\s+(\w+)\s*$i   s'   ^\s*call\s+expression.*from\s+(\w+)\s*$(   t   filet   ret   matcht   Truet   groupt   close(   t   fnt   labelst   ft   lt   m(    (    s$   renpy-6.10.2/renpy/tools/add_from.pyt   find_labels   s     c      
      sI  t  |  d ƒ } t  |  d d ƒ } ‡  f d †  } x¶ | D]® } t i d | | ƒ } t i d | ƒ os t i d | ƒ o_ d } x2 t o* | d	 7} d
 | } | ˆ  j o Pqƒ qƒ W| ˆ  | <| d  d | d } n | i | ƒ q8 W| i ƒ  | i ƒ  y t i |  d ƒ Wn n Xt i	 |  |  d ƒ t i	 |  d |  ƒ d  S(   NR    s   .newt   wc            s„   |  i  d ƒ } d } x8 t o0 | d 7} d | | f } | ˆ  j o Pq q Wt ˆ  | <|  i  d ƒ d | d | |  i  d ƒ S(   Ni   i    i   s   _call_%s_%ds   call s    from i   (   R   R   (   R   t   targett   numt   label(   R   (    s$   renpy-6.10.2/renpy/tools/add_from.pyt	   replaceit4   s    



s   ^(\s*)call\s+(\w+)(\s*$)s   call\s+expressiont   fromi    i   s   _call_expression_%diÿÿÿÿs    from s   
s   .bak(
   R   R   t   subt   searchR   t   writeR   t   ost   unlinkt   rename(   R   R   R	   t   ofR   R
   R   R   (    (   R   s$   renpy-6.10.2/renpy/tools/add_from.pyt   replace_labels.   s0     '






c   	   
   C   sù   h  } g  } t  i |  ƒ D]) } | i d ƒ o | |  d | q q ~ } | oJ g  } t  i | ƒ D]) } | i d ƒ o | | d | qg qg ~ } n g  } x( | | D] } d G| GHt | | ƒ q® Wx$ | D] } d G| GHt | | ƒ qÕ Wd  S(   Ns   .rpyt   /s   Finding labels ins   Replacing labels in(   R   t   listdirt   endswithR   R   (	   t   gamedirt	   commondirR   t   _[1]t   it
   game_filest   _[2]t   common_filesR   (    (    s$   renpy-6.10.2/renpy/tools/add_from.pyt   add_fromd   s    FJ 	 	(   R   R   R   R   R%   (    (    (    s$   renpy-6.10.2/renpy/tools/add_from.pys   <module>   s   		6