ó
ÔŒ\c           @  s/   d  d l  m Z d  d l Z d a d „  Z d S(   iÿÿÿÿ(   t   print_functionNc            s  t  }  d a  |  d k r d Sd |  k r7 t d ƒ ‚ n  |  j d d ƒ \ } } t | ƒ } t j j sv t d ƒ ‚ n  | j d ƒ s’ d | } n  i  ‰  t	 t j
 j j j ƒ  ƒ } ‡  f d †  } xÏ| D]Ç} t | t j j ƒ ró | j ró qÉ n  t | t j j ƒ rGx< | j D]. } | d d k	 r| | | d d ƒ qqWn  t | t j j ƒ r¤| j r¤| j t j
 j j k r¤| | t j
 j j | j ƒ qÉ q¤n  t | t j j ƒ rÐ| | | j d ƒ n  t | t j j ƒ r:t } x= | j D]2 \ } }	 | | |	 d ƒ | d	 k rõt } qõqõW| r:qÉ q:n  t | t j j ƒ re| | | j ƒ  ƒ qÉ t | d
 d ƒ d k	 rÉ | | | j  ƒ qÉ qÉ Wg  | D]3 } | j! | k r›| j" | k r›| j" | f ^ q›}
 |
 sòt d j# |  ƒ ƒ ‚ n  |
 j$ ƒ  |
 d d } g  } | } x: t rRˆ  j% | d ƒ } | rNˆ  | =| j& | ƒ qPqW| j' ƒ  | t j j( } d t j _) x5 | D]- } | j* ƒ  ry | j+ ƒ  Wq®q®XqqWd t j _) t t j
 _, t j- j. ƒ  t j
 j/ ƒ  j0 | j1 ƒ t j
 j/ ƒ  j2 | j1 d ƒ t j
 j3 ƒ  ‚ d S(   sp   
    Given a filename and line number, this attempts to warp the user
    to that filename and line number.
    t   :s   No : found in warp location.i   s$   Can't warp, developer mode disabled.s   game/c           s¡   ˆ  ˆ k r ˆ ˆ ˆ  <d  Sˆ ˆ  ‰ ‡ ‡ f d †  } d  } | pT | ‡  f d †  ƒ } | po | ‡  f d †  ƒ } | p„ | d „  ƒ } | p ˆ } | ˆ ˆ  <d  S(   Nc           s*   |  ˆ  ˆ ƒ r ˆ  S|  ˆ ˆ  ƒ r& ˆ Sd  S(   N(   t   None(   t   fn(   t   nodet   old(    s   renpy/warp.pyt   preferM   s
    c           s"   |  j  ˆ  j  k o! | j  ˆ  j  k S(   N(   t   filename(   t   at   b(   t   next(    s   renpy/warp.pyt   <lambda>W   s    c           s"   |  j  ˆ  j  k o! | j  ˆ  j  k S(   N(   t
   linenumber(   R   R	   (   R
   (    s   renpy/warp.pyR   X   s    c         S  s   |  j  | j  k S(   N(   R   (   R   R	   (    (    s   renpy/warp.pyR   Y   s    (   R   (   R   R
   R   t   n(   t   prev(   R
   R   R   s   renpy/warp.pyt   addC   s    

	i   i    t   TrueR
   s+   Could not find a statement to warp to. ({})iÿÿÿÿt   fastt   _after_warpN(4   t	   warp_specR   t	   Exceptiont   splitt   intt   renpyt   configt	   developert
   startswitht   sett   gamet   scriptt   namemapt   valuest
   isinstancet   astt	   Translatet   languaget   Menut   itemst   Jumpt
   expressiont   targett   Whilet   blockt   Ift   Falset   entriesR   t   UserStatementt   get_nextt   getattrR
   R   R   t   formatt   sortt   gett   appendt   reverset
   warp_limitt   skippingt   can_warpt   executet   after_rollbackt   exportst   block_rollbackt   contextt
   goto_labelt   namet	   come_fromt   RestartContext(   t   specR   t   linet   seensetR   R   t   it	   seen_truet	   conditionR*   t
   candidatesR   t   run(    (   R   s   renpy/warp.pyt   warp!   sŒ    "		
3
	
(   t
   __future__R    R   R   R   RJ   (    (    (    s   renpy/warp.pyt   <module>   s   