
:\c           @  s  d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d   Z d   Z	 d e
 f d     YZ e d  Z d e
 f d	     YZ d
   Z g  Z d e f d     YZ d   Z d e
 f d     YZ d   Z d e
 f d     YZ d e
 f d     YZ d   Z e j d  Z d d  Z d e f d     YZ e e d e j  d e f d     YZ  d e f d     YZ! d e f d      YZ" d! e f d"     YZ# d# e f d$     YZ$ d% e f d&     YZ% e d d'  Z& d d(  Z' d) e f d*     YZ( d+ e f d,     YZ) d- e f d.     YZ* d/ e f d0     YZ+ d1 e f d2     YZ, d3 e f d4     YZ- d5 e f d6     YZ. d7 e f d8     YZ/ e e/ d e/ j  d9 e f d:     YZ0 d; e f d<     YZ1 d= e f d>     YZ2 d? e f d@     YZ3 dA e f dB     YZ4 dC e f dD     YZ5 dE   Z6 dF e
 f dG     YZ7 dH   Z8 dI dJ dK h Z9 g  Z: dL e f dM     YZ; dN   Z< g  Z= dO e f dP     YZ> dQ e f dR     YZ? dS e f dT     YZ@ dU e f dV     YZA dW e f dX     YZB dY e f dZ     YZC d[ e f d\     YZD d] eD f d^     YZE d_ e f d`     YZF da e f db     YZG d S(c   i(   t   print_functionNc         C  s%   x t  j j D] } | |   q Wd S(   sI   
    Reports the name of this statement to systems like window auto.
    N(   t   renpyt   configt   statement_callbacks(   t   namet   i(    (    s   renpy/ast.pyt   statement_name'   s    c         C  s   |  t  j j   _ d S(   s   
    Indicates the next node that should be executed. When a statement
    can crash, this should be set as early as possible, so that ignore
    can bring us there.
    N(   R   t   gamet   contextt	   next_node(   t   n(    (    s   renpy/ast.pyR	   0   s    t   ParameterInfoc           B  s#   e  Z d  Z d   Z e d  Z RS(   sR   
    This class is used to store information about parameters to a
    label.
    c         C  s(   | |  _  | |  _ | |  _ | |  _ d  S(   N(   t
   parameterst
   positionalt   extrapost   extrakw(   t   selfR   R   R   R   (    (    s   renpy/ast.pyt   __init__@   s    			c   
      C  s  i  } i  } | d k r! d } n  | d k r6 i  } n  xR t |  j |  D]> \ } } | | k r} | s} t d |   q} n  | | | <qI Wt | t |  j   } xL | j   D]> \ } } | | k r | s t d |   q n  | | | <q Wxy |  j D]n \ } }	 | | k rV|	 d k r=| sSt d |   qSqkt j	 j
 |	  | | <q | | | | <| | =q W|  j r| | |  j <n5 | r| rt d t |  j  t |  f   n  |  j r| | |  j <nD | j d t  rn/ | r| rt d d j | j      n  | S(	   s  
        Applies `args` and `kwargs` to these parameters. Returns
        a dictionary that can be used to update an enclosing
        scope.

        `ignore_errors`
            If true, errors will be ignored, and this function will do the
            best job it can.
        s   Parameter %s has two values.s#   Required parameter %s has no value.s1   Too many arguments in call (expected %d, got %d).t   _ignore_extra_kwargss   Unknown keyword arguments: %ss   , N(    (   t   Nonet   zipR   t	   Exceptiont   tuplet   lent	   iteritemsR   R   t   pythont   py_evalR   R   t   gett   Falset   joint   keys(
   R   t   argst   kwargst   ignore_errorst   valuest   rvR   t   valueR   t   default(    (    s   renpy/ast.pyt   applyQ   sH    			(	"(   t   __name__t
   __module__t   __doc__R   R   R&   (    (    (    s   renpy/ast.pyR   :   s   	c         C  sA   |  d  k r. | s | r' t d   q. i  Sn  |  j | | |  S(   Ns2   Arguments supplied, but parameter list not present(   R   R   R&   (   R   R   R    R!   (    (    s   renpy/ast.pyt   apply_arguments   s
    t   ArgumentInfoc           B  s&   e  Z d    Z d d  Z d   Z RS(   c         C  s   | |  _  | |  _ | |  _ d  S(   N(   t	   argumentsR   R   (   R   R,   R   R   (    (    s   renpy/ast.pyR      s    		c         C  s   g  } t  j j   } xa |  j D]V \ } } | d k	 rV t  j j | d | | | <q | j t  j j | d |  q W|  j d k	 r | j t  j j |  j d |  n  |  j	 d k	 r | j
 t  j j |  j	 d |  n  t |  | f S(   sw   
        Evaluates the arguments, returning a list of arguments and a
        dictionary of keyword arguments.
        t   localsN(   R   R   t   RevertableDictR,   R   R   t   appendR   t   extendR   t   updateR   (   R   t   scopeR   R    t   kt   v(    (    s   renpy/ast.pyt   evaluate   s    #%%c         C  s   g  } xL |  j  D]A \ } } | d  k	 rD | j d j | |   q | j |  q W|  j d  k	 r{ | j d |  j  n  |  j d  k	 r | j d |  j  n  d d j |  d S(   Ns   {}={}t   *s   **t   (s   , t   )(   R,   R   R/   t   formatR   R   R   (   R   t   lt   keywordt
   expression(    (    s   renpy/ast.pyt   get_code   s    N(   R'   R(   R   R   R5   R=   (    (    (    s   renpy/ast.pyR+      s   	c         G  s   |  j  |  |  S(   N(   t   __new__(   t   clsR   (    (    s   renpy/ast.pyt
   __newobj__   s    t   PyExprc           B  s,   e  Z d  Z d d g Z d   Z d   Z RS(   s5   
    Represents a string containing python code.
    t   filenamet
   linenumberc         C  s\   t  j |  |  } | | _ | | _ | rX t j j j d  k	 rX t j j j j	 |  n  | S(   N(
   t   unicodeR>   RB   RC   R   R   t   scriptt
   all_pyexprR   R/   (   R?   t   sRB   RC   R   (    (    s   renpy/ast.pyR>      s    		c         C  s   t  |   |  j |  j f S(   N(   RD   RB   RC   (   R   (    (    s   renpy/ast.pyt   __getnewargs__   s    (   R'   R(   R)   t	   __slots__R>   RH   (    (    (    s   renpy/ast.pyRA      s
   		c         C  s
   d |  k S(   s   
    Returns true if an expr probably does not have side effects, and should
    be predicted. Basically, this just whitelists a set of characters that
    doesn't allow for a function call.
    R7   (    (   t   expr(    (    s   renpy/ast.pyt   probably_side_effect_free   s    t   PyCodec           B  sG   e  Z d  d d d d g Z d   Z d   Z d d	 d
  Z d   Z RS(   t   sourcet   locationt   modet   bytecodet   hashc         C  s   d |  j  |  j |  j f S(   Ni   (   RM   RN   RO   (   R   (    (    s   renpy/ast.pyt   __getstate__  s    c         C  sP   | \ } |  _  |  _ |  _ d  |  _ t j j j rL t j j j	 j
 |   n  d  S(   N(   RM   RN   RO   R   RP   R   R   RE   t   record_pycodet
   all_pycodeR/   (   R   t   statet   _(    (    s   renpy/ast.pyt   __setstate__  s    	s   <none>i   t   execc         C  s   t  | t  r' | j | j | f } n  | |  _ | t t j    f |  _ | |  _ d  |  _
 t j j j r t j j j j |   n  |  j   |  _ d  S(   N(   t
   isinstanceRA   RB   RC   RM   t   intt   timeRN   RO   R   RP   R   R   RE   RS   RT   R/   t   get_hashRQ   (   R   RM   t   locRO   (    (    s   renpy/ast.pyR     s    			c         C  s   y |  j  d  k	 r |  j  SWn n X|  j } t | t j j j  r] t j j j |  } n  t	 t j
  t j t |  j  | j d   j   |  _  |  j  S(   Ns   utf-8(   RQ   R   RM   RY   R   R   t   astt   ASTt   dumpt   chrt   bytecode_versiont   hashlibt   md5t   reprRN   t   encodet   digest(   R   t   code(    (    s   renpy/ast.pyR\   /  s    	;(   s   <none>i   (   R'   R(   RI   RR   RW   R   R\   (    (    (    s   renpy/ast.pyRL     s   			c         C  sP   |  s
 d Sx. t  |  |  d  D] \ } } | j |  q W|  d j |  d S(   s   
    This is called to chain together all of the nodes in a block. Node
    n is chained with node n+1, while the last node is chained with
    next.
    Ni   i(   R   t   chain(   t   blockt   nextt   at   b(    (    s   renpy/ast.pyt   chain_block>  s
     t   Scryc           B  s    e  Z d  Z d   Z d   Z RS(   s   
    This is used to store information about the future, if we know it. Unlike
    predict, this tries to only get things we _know_ will happen.
    c         C  s   d  S(   N(   R   (   R   R   (    (    s   renpy/ast.pyt   __getattr__U  s    c         C  s3   |  j  d  k r d  Sy |  j  j   SWn d  SXd  S(   N(   t   _nextR   t   scry(   R   (    (    s   renpy/ast.pyRk   X  s    (   R'   R(   R)   Rp   Rk   (    (    (    s   renpy/ast.pyRo   N  s   	t   Nodec           B  s   e  Z d  Z d d d d g Z e Z e Z d Z d   Z d   Z	 d   Z
 d	   Z d Z d
   Z d   Z d   Z d   Z d Z d   Z d   Z d   Z d d  Z d   Z e Z d   Z RS(   s   
    A node in the abstract syntax tree of the program.

    @ivar name: The name of this node.

    @ivar filename: The filename where this node comes from.
    @ivar linenumber: The line number of the line on which this node is defined.
    R   RB   RC   Rk   t   normalc         C  s(   | \ |  _  |  _ d |  _ d |  _ d S(   s   
        Initializes this Node object.

        @param loc: A (filename, physical line number) tuple giving the
        logical line on which this Node node starts.
        N(   RB   RC   R   R   Rk   (   R   R]   (    (    s   renpy/ast.pyR     s    	c         C  s   t  |   f S(   s   
        Returns a tuple of diff info about ourself. This is used to
        compare Nodes to see if they should be considered the same node. The
        tuple returned must be hashable.
        (   t   id(   R   (    (    s   renpy/ast.pyt	   diff_info  s    c         C  s   | |   d S(   s<   
        Calls `f` with this node and its children.
        N(    (   R   t   f(    (    s   renpy/ast.pyt   get_children  s    c         C  s   d S(   s   
        Returns a node that should be run at init time (that is, before
        the normal start of the script.), or None if this node doesn't
        care to suggest one.

        (The only class that needs to override this is Init.)
        N(   R   (   R   (    (    s   renpy/ast.pyt   get_init  s    	c         C  s   | |  _  d S(   s&  
        This is called with the Node node that should be followed after
        executing this node, and all nodes that this node
        executes. (For example, if this node is a block label, the
        next is the node that should be executed after all nodes in
        the block.)
        N(   Rk   (   R   Rk   (    (    s   renpy/ast.pyRi     s    	c         C  s   |  j  | k r | |  _  n  d S(   sc   
        Replaces instances of the `old` node with `new` when it is the next
        node.
        N(   Rk   (   R   t   oldt   new(    (    s   renpy/ast.pyt   replace_next  s    c         C  s   t  d   d S(   s   
        Causes this node to execute, and any action it entails to be
        performed. The node should call next_node with the node to
        be executed after this one.
        s'   Node subclass forgot to define execute.N(   R   (   R   (    (    s   renpy/ast.pyt   execute  s    c         C  s   d S(   s3   
        Called when the module is loaded.
        N(    (   R   (    (    s   renpy/ast.pyt   early_execute  s    c         C  s   |  j  r |  j  g Sg  Sd S(   s   
        This is called to predictively load images from this node.  It
        should cause renpy.display.predict.image and
        renpy.display.predict.screen to be called as necessary.
        N(   Rk   (   R   (    (    s   renpy/ast.pyt   predict  s    	
c         C  s   t    } |  j | _ | S(   st   
        Called to return an object with some general, user-definable information
        about the future.
        (   Ro   Rk   Rq   (   R   R#   (    (    s   renpy/ast.pyRr     s    	c         C  s   d S(   s   
        Called to restructure the AST.

        When this method is called, callback is called once for each child
        block of the node. The block, a list, can be updated by the callback
        using slice assignment to the list.
        N(    (   R   t   callback(    (    s   renpy/ast.pyt   restructure  s    
c         C  s   t  d   d S(   s   
        Returns the canonical form of the code corresponding to this statement.
        This only needs to be defined if the statement is translatable.

        `filter`
            If present, a filter that should be applied to human-readable
            text in the statement.
        s   Not ImplementedN(   R   (   R   t   dialogue_filter(    (    s   renpy/ast.pyR=     s    
c         C  s   d S(   sI   
        Called on all code after the init phase, to analyze it.
        N(    (   R   (    (    s   renpy/ast.pyt   analyze  s    c         C  s   |  j  S(   sT   
        Returns true if this should be run while warping, False otherwise.
        (   t   warp(   R   (    (    s   renpy/ast.pyt   can_warp	  s    N(   R'   R(   R)   RI   R   t   translatablet   translation_relevantt   rollbackR   Rv   Rx   Ry   R   Ri   R|   R}   R~   R   Rr   R   R=   R   R   R   (    (    (    s   renpy/ast.pyRs   b  s2   														
		c         C  s   |  d k	 r! t j j |   } n4 t j j rQ t j j j d k rQ t j j } n d S| s_ d St j j j r{ | |  n  d S(   sB   
    This handles the with clause of a say or menu statement.
    i   N(	   R   R   R   R   t   storet   default_transitionR   t   preferencest   transitions(   R<   R   t   what(    (    s   renpy/ast.pyt   say_menu_with  s    !s   [a-zA-Z_][a-zA-Z_0-9]*$c         C  s   |  d k r d S| d k r4 t t j |    } n  | r d t j j k rk t j j d j |  d  } n d } | d k r t j j d j |  d  } n  | d k r t d |  j	 d    n  | St j j
 |   S(   s;   
    Evaluates the `who` parameter to a say statement.
    s   store.characterR   s   Sayer '%s' is not defined.s   utf-8N(   R   t   boolt   fast_who_patternt   matchR   R   t   store_dictsR   R   Rf   R   (   t   whot   fastR#   (    (    s   renpy/ast.pyt   eval_who(  s    t   Sayc        	   B  sw   e  Z d  d d d d d d d d g	 Z d	   Z d
   Z e d d d d  Z d d  Z d   Z	 d   Z
 d   Z RS(   R   t   who_fastR   t   with_t   interactt
   attributesR,   t   temporary_attributesR   c         C  s   t  |  j |  j f S(   N(   R   R   R   (   R   (    (    s   renpy/ast.pyRv   S  s    c         O  s@   t  j |   } d  | _ t | _ d  | _ d  | _ d | _ | S(   NRt   (	   Rs   R>   R   R   t   TrueR   R,   R   R   (   R?   R   R    R   (    (    s   renpy/ast.pyR>   V  s    					c	   	      C  s   t  t |   j |  | d  k	 rh | j   |  _ t j t j	 j
 d |  j  r\ t |  _ qz t |  _ n d  |  _ t |  _ | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ d  S(   Nt   $(   t   superR   R   R   t   stripR   t   reR   R   t   parsert   word_regexpR   R   R   R   R   R   R,   R   R   (	   R   R]   R   R   R   R   R   R,   R   (    (    s   renpy/ast.pyR   _  s    							c         C  s  g  } |  j  r" | j |  j   n  |  j d  k	 rD | j |  j  n  |  j rm | j d  | j |  j  n  |  j } | d  k	 r | |  } n  | j t j j	 |   |  j
 s | j d  n  |  j r | j d  | j |  j  n  |  j r| j |  j j    n  d j |  S(   Nt   @t
   nointeractt   witht    (   R   R/   R   R   R0   R   R   R   t   translationt   encode_say_stringR   R   R,   R=   R   (   R   R   R#   R   (    (    s   renpy/ast.pyR=   {  s(    						c         C  s  t  |  j  t d  z|  j t j j   _ |  j t j j   _ t	 |  j
 |  j  } | d  k p} t |  p} t | t  s t d |  j
 j d    n  |  j } t j j r t j j |  } n  | t j _ |  j d  k	 r |  j j   \ } } n t   } t   } | j d |  j  t | d t  ri|  j
 t j _ | t j _  | t j _! | t j _" n  t# |  j$ t j j% j&  t j' j( | | | |  Wd  d  t j j   _ d  t j j   _ Xd  S(   Nt   says%   Sayer %s is not a function or string.s   utf-8R   t
   record_say()   R	   Rk   R   R   R   R   R   t   say_attributesR   R   R   R   R   t   callableRY   t
   basestringR   Rf   R   R   t   say_menu_text_filterR   t   _last_raw_whatR,   R5   R   t   dictt
   setdefaultR   t   getattrR   t   _last_say_whot   _last_say_whatt   _last_say_argst   _last_say_kwargsR   R   t	   interfacet   set_transitiont   exportsR   (   R   R   R   R   R    (    (    s   renpy/ast.pyR}     s8    
			c         C  s   t  j j   j } t  j j   j } z |  j t  j j   _ t |  j |  j  } d   } t	 |  j
 |  |  j } t  j j r t  j j |  } n  t  j j | |  Wd  | t  j j   _ | t  j j   _ X|  j g S(   Nc         S  s&   t  j j j |  d d  d d    d  S(   Nt
   old_widgett
   new_widget(   R   t   displayR   t   displayableR   (   t   trans(    (    s   renpy/ast.pyt   predict_with  s    (   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   t   predict_sayRk   (   R   t   old_attributest   old_temporary_attributesR   R   R   (    (    s   renpy/ast.pyR     s    		c         C  sP   t  j |   } t |  j |  j  } |  j rC t j j | |  n	 t	 | _
 | S(   N(   Rs   Rr   R   R   R   R   R   R   t   scry_sayR   t	   interacts(   R   R#   R   (    (    s   renpy/ast.pyRr     s    		N(   R'   R(   RI   Rv   R>   R   R   R   R=   R}   R   Rr   (    (    (    s   renpy/ast.pyR   E  s    					.	R   t   Initc           B  sJ   e  Z d  d g Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   Rj   t   priorityc         C  s,   t  t |   j |  | |  _ | |  _ d  S(   N(   R   R   R   Rj   R   (   R   R]   Rj   R   (    (    s   renpy/ast.pyR     s    	c         C  s/   | |   x |  j  D] } | j |  q Wd  S(   N(   Rj   Rx   (   R   Rw   R   (    (    s   renpy/ast.pyRx     s    
c         C  s   |  j  |  j d f S(   Ni    (   R   Rj   (   R   (    (    s   renpy/ast.pyRy     s    c         C  s   | |  _  t |  j d   d  S(   N(   Rk   Rn   Rj   R   (   R   Rk   (    (    s   renpy/ast.pyRi     s    	c         C  s+   t  |  j  t j j d  t d  d  S(   Ni<   t   init(   R	   Rk   R   t	   executiont   not_infinite_loopR   (   R   (    (    s   renpy/ast.pyR}     s    c         C  s   | |  j   d  S(   N(   Rj   (   R   R   (    (    s   renpy/ast.pyR     s    (	   R'   R(   RI   R   Rx   Ry   Ri   R}   R   (    (    (    s   renpy/ast.pyR     s   						t   Labelc           B  sh   e  Z d  Z e Z d d d d g Z d   Z e d  Z d   Z	 d   Z
 d	   Z d
   Z d   Z RS(   t   forceR   R   Rj   t   hidec         O  s%   t  j |   } d  | _ t | _ | S(   N(   Rs   R>   R   R   R   R   (   R?   R   R    R   (    (    s   renpy/ast.pyR>   (  s    		c         C  s>   t  t |   j |  | |  _ | |  _ | |  _ | |  _ d S(   s   
        Constructs a new Label node.

        @param name: The name of this label.
        @param block: A (potentially empty) list of nodes making up the
        block associated with this label.
        N(   R   R   R   R   Rj   R   R   (   R   R]   R   Rj   R   R   (    (    s   renpy/ast.pyR   .  s
    				c         C  s   t  |  j f S(   N(   R   R   (   R   (    (    s   renpy/ast.pyRv   >  s    c         C  s/   | |   x |  j  D] } | j |  q Wd  S(   N(   Rj   Rx   (   R   Rw   R   (    (    s   renpy/ast.pyRx   A  s    
c         C  s9   |  j  r, |  j  d |  _ t |  j  |  n	 | |  _ d  S(   Ni    (   Rj   Rk   Rn   (   R   Rk   (    (    s   renpy/ast.pyRi   G  s    	c         C  s   t  |  j  t d  t j j   j   t |  j t j	 j
 t j	 j  } x= | j   D]/ \ } } t j j |  t t j	 | |  qX Wd  t j	 _
 d  t j	 _ t j j r t j j |  j t j j   j  n  d  S(   Nt   label(   R	   Rk   R   R   R   R   t	   mark_seenR*   R   R   t   _argst   _kwargsR   R   t   dynamict   setattrR   R   t   label_callbackR   t   last_abnormal(   R   R"   R3   R4   (    (    s   renpy/ast.pyR}   O  s    
!c         C  s   | |  j   d  S(   N(   Rj   (   R   R   (    (    s   renpy/ast.pyR   a  s    (   R'   R(   R   R   R   RI   R>   R   R   Rv   Rx   Ri   R}   R   (    (    (    s   renpy/ast.pyR     s   						t   Pythonc           B  sS   e  Z d  d d g Z d   Z e d d  Z d   Z d   Z d   Z d   Z	 RS(	   R   Rh   R   c         O  s   t  j |   } d | _ | S(   NR   (   Rs   R>   R   (   R?   R   R    R   (    (    s   renpy/ast.pyR>   m  s    	c         C  sk   t  t |   j |  | |  _ | rC t | d | d d |  _ n t | d | d d |  _ | |  _ d S(   s   
        @param code: A PyCode object.

        @param hide: If True, the code will be executed with its
        own local dictionary.
        R]   RO   R   RX   N(   R   R   R   R   RL   Rh   R   (   R   R]   t   python_codeR   R   (    (    s   renpy/ast.pyR   r  s    	c         C  s   t  |  j j f S(   N(   R   Rh   RM   (   R   (    (    s   renpy/ast.pyRv     s    c         C  s   t  j j |  j  d  S(   N(   R   R   t   create_storeR   (   R   (    (    s   renpy/ast.pyR~     s    c         C  s{   t  |  j  t d  z) t j j |  j j |  j d |  j	 Wd  t j
 j   j sv x t j j D] } |   qb Wn  Xd  S(   NR   R   (   R	   Rk   R   R   R   t   py_exec_bytecodeRh   RP   R   R   R   R   t
   init_phaseR   t   python_callbacks(   R   R   (    (    s   renpy/ast.pyR}     s    
)c         C  s   t  j |   } t | _ | S(   N(   Rs   Rr   R   R   (   R   R#   (    (    s   renpy/ast.pyRr     s    	(
   R'   R(   RI   R>   R   R   Rv   R~   R}   Rr   (    (    (    s   renpy/ast.pyR   e  s   					t   EarlyPythonc           B  sJ   e  Z d  d d g Z d   Z e d d  Z d   Z d   Z d   Z RS(   R   Rh   R   c         O  s   t  j |   } d | _ | S(   NR   (   Rs   R>   R   (   R?   R   R    R   (    (    s   renpy/ast.pyR>     s    	c         C  sk   t  t |   j |  | |  _ | rC t | d | d d |  _ n t | d | d d |  _ | |  _ d S(   s   
        @param code: A PyCode object.

        @param hide: If True, the code will be executed with its
        own local dictionary.
        R]   RO   R   RX   N(   R   R   R   R   RL   Rh   R   (   R   R]   R   R   R   (    (    s   renpy/ast.pyR     s    	c         C  s   t  |  j j f S(   N(   R   Rh   RM   (   R   (    (    s   renpy/ast.pyRv     s    c         C  s+   t  |  j  t j j d  t d  d  S(   Ni<   s   python early(   R	   Rk   R   R   R   R   (   R   (    (    s   renpy/ast.pyR}     s    c         C  sK   t  j j |  j  |  j j rG t  j j |  j j |  j d |  j n  d  S(   NR   (   R   R   R   R   Rh   RP   R   R   (   R   (    (    s   renpy/ast.pyR~     s    (	   R'   R(   RI   R>   R   R   Rv   R}   R~   (    (    (    s   renpy/ast.pyR     s   				t   Imagec           B  sA   e  Z d  d d g Z d d d  Z d   Z d   Z d   Z RS(   t   imgnameRh   t   atlc         C  sb   t  t |   j |  | |  _ | rL t | d | d d |  _ d |  _ n d |  _ | |  _ d S(   s   
        @param name: The name of the image being defined.

        @param expr: An expression yielding a Displayable that is
        assigned to the image.
        R]   RO   t   evalN(   R   R   R   R   RL   Rh   R   R   (   R   R]   R   RJ   R   (    (    s   renpy/ast.pyR     s    		c         C  s   t  t |  j  f S(   N(   R   R   R   (   R   (    (    s   renpy/ast.pyRv     s    c         C  ss   t  |  j  t d  |  j d  k	 rA t j j |  j j  } n t j	 j
 j |  j  } t j j |  j |  d  S(   Nt   image(   R	   Rk   R   Rh   R   R   R   t   py_eval_bytecodeRP   R   t   motiont   ATLTransformR   R   R   R   (   R   t   img(    (    s   renpy/ast.pyR}     s    
c         C  s,   t  |  d d   d  k	 r( |  j j   n  d  S(   NR   (   R   R   R   t   mark_constant(   R   (    (    s   renpy/ast.pyR     s    N(   R'   R(   RI   R   R   Rv   R}   R   (    (    (    s   renpy/ast.pyR     s   			t	   Transformc           B  sV   e  Z d  d d g Z e g  g  d d  Z d e d  Z d   Z d   Z d   Z	 RS(   t   varnameR   R   c         C  s5   t  t |   j |  | |  _ | |  _ | |  _ d  S(   N(   R   R   R   R   R   R   (   R   R]   R   R   R   (    (    s   renpy/ast.pyR     s    		c         C  s   t  |  j f S(   N(   R   R   (   R   (    (    s   renpy/ast.pyRv     s    c         C  s   t  |  j  t d  t |  d d   } | d  k rA t j } n  t j j	 j
 |  j d | } t j j j |  j |  j |  j f  t j j |  j  t t j |  j |  d  S(   Nt	   transformR   (   R	   Rk   R   R   R   R   t   default_parametersR   R   R   R   R   R`   t
   transformsR/   R   RB   RC   R   t   pureR   R   (   R   R   R   (    (    s   renpy/ast.pyR}     s    
%c         C  s   |  j  j   d  S(   N(   R   R   (   R   (    (    s   renpy/ast.pyR   (  s    N(
   R'   R(   RI   R   R   R   R   Rv   R}   R   (    (    (    s   renpy/ast.pyR     s   			c         C  s  t  |   d k r0 |  \ } } } } } } }	 n] t  |   d k r] |  \ } } } } } } n0 t  |   d k r |  \ } } } d } d } n  | r y( t j j |  }
 t j j |
  }
 Wq d SXn d }
 g  } x5 | D]- } y | j t j j |   Wq q Xq W| d k	 rFy  | j t j j	 j
 |   WqFqFXn  t j j | | p[| |  } | rt j j   j j |  n  t j j | | d |
 d | d S(   sW   
    Call this to use the given callback to predict the image named
    in imspec.
    i   i   i   NR   t   tag(   R   R   R   R   R   t   easyR   R/   R   R   R   R   t   default_layerR   R   t   imagest   predict_scenet   predict_show(   t   imspect   sceneR   R   R<   R   t   at_expr_listt   layert   _zordert   _behindR   t   at_listR   (    (    s   renpy/ast.pyt   predict_imspec,  s<    	 c   
      C  s  t  |   d k r0 |  \ } } } } } } } no t  |   d k rc |  \ } } } } } } g  } n< t  |   d k r |  \ } } } d  } d  } d  } g  } n  | d  k	 r t j j |  } n d  } | d  k	 r t j j |  } t j j |  } n  g  | D] }	 t j j |	  ^ q } t j j | | p3| | oB| d  k  } t j	 j
 | d | d | d | d | d | d	 | d
 | d  S(   Ni   i   i   R   R   R   t   zorderR   t   behindR   (   R   R   R   R   R   R   R   R   R   R   t   show(
   R   R   R   R<   R   R   R   R   R   R   (    (    s   renpy/ast.pyt   show_imspec[  s6    		%*t   Showc           B  sJ   e  Z d  d g Z e Z d d  Z d   Z d   Z d   Z	 d   Z
 RS(   R   R   c         C  s,   t  t |   j |  | |  _ | |  _ d S(   s   
        @param imspec: A triple consisting of an image name (itself a
        tuple of strings), a list of at expressions, and a layer.
        N(   R   R   R   R   R   (   R   R]   R   R   (    (    s   renpy/ast.pyR     s    	c         C  s   t  t |  j d  f S(   Ni    (   R   R   R   (   R   (    (    s   renpy/ast.pyRv     s    c         C  s:   t  |  j  t d  t |  j d t |  d d   d  S(   NR   R   (   R	   Rk   R   R   R   R   R   (   R   (    (    s   renpy/ast.pyR}     s    
c         C  s)   t  |  j d t |  d d   |  j g S(   NR   (   R   R   R   R   Rk   (   R   (    (    s   renpy/ast.pyR     s    c         C  s,   t  |  d d   d  k	 r( |  j j   n  d  S(   NR   (   R   R   R   R   (   R   (    (    s   renpy/ast.pyR     s    N(   R'   R(   RI   R   R   R   R   Rv   R}   R   R   (    (    (    s   renpy/ast.pyR     s   				t	   ShowLayerc           B  sJ   e  Z e Z d  d d g Z d   Z d   Z d   Z d   Z d   Z	 RS(   R   R   R   c         C  s5   t  t |   j |  | |  _ | |  _ | |  _ d  S(   N(   R   R   R   R   R   R   (   R   R]   R   R   R   (    (    s   renpy/ast.pyR     s    		c         C  s   t  |  j f S(   N(   R   R   (   R   (    (    s   renpy/ast.pyRv     s    c         C  s   t  |  j  t d  g  |  j D] } t j j |  ^ q! } |  j d  k	 rv t j	 j
 j |  j  } | j |  n  t j j | d |  j d  S(   Ns
   show layerR   (   R	   Rk   R   R   R   R   R   R   R   R   R   R   R/   R   t   layer_at_listR   (   R   R   R   R   (    (    s   renpy/ast.pyR}     s    
(c         C  s
   |  j  g S(   N(   Rk   (   R   (    (    s   renpy/ast.pyR     s    c         C  s#   |  j  d  k	 r |  j  j   n  d  S(   N(   R   R   R   (   R   (    (    s   renpy/ast.pyR     s    (
   R'   R(   R   R   RI   R   Rv   R}   R   R   (    (    (    s   renpy/ast.pyR     s   					t   Scenec           B  sM   e  Z d  d d g Z e Z d d  Z d   Z d   Z d   Z	 d   Z
 RS(	   R   R   R   c         C  s5   t  t |   j |  | |  _ | |  _ | |  _ d S(   s   
        @param imspec: A triple consisting of an image name (itself a
        tuple of strings), a list of at expressions, and a layer, or
        None to not have this scene statement also display an image.
        N(   R   R  R   R   R   R   (   R   R]   t   imgspecR   R   (    (    s   renpy/ast.pyR     s    		c         C  s/   |  j  r t |  j  d  } n d  } t | f S(   Ni    (   R   R   R   R  (   R   t   data(    (    s   renpy/ast.pyRv     s    	c         C  sY   t  |  j  t d  t j j |  j  |  j rU t |  j d t	 |  d d   n  d  S(   NR   R   (   R	   Rk   R   R   R   R   R   R   R   R   R   (   R   (    (    s   renpy/ast.pyR}     s
    
	c         C  s;   |  j  r1 t |  j  d t |  d d   d t n  |  j g S(   NR   R   (   R   R   R   R   R   Rk   (   R   (    (    s   renpy/ast.pyR     s    	(c         C  s,   t  |  d d   d  k	 r( |  j j   n  d  S(   NR   (   R   R   R   R   (   R   (    (    s   renpy/ast.pyR     s    N(   R'   R(   RI   R   R   R   R   Rv   R}   R   R   (    (    (    s   renpy/ast.pyR    s   				
	t   Hidec           B  s;   e  Z d  g Z e Z d   Z d   Z d   Z d   Z RS(   R   c         C  s#   t  t |   j |  | |  _ d S(   s   
        @param imspec: A triple consisting of an image name (itself a
        tuple of strings), a list of at expressions, and a list of
        with expressions.
        N(   R   R  R   R   (   R   R]   R  (    (    s   renpy/ast.pyR     s    c         C  s   t  t |  j d  f S(   Ni    (   R  R   R   (   R   (    (    s   renpy/ast.pyRv     s    c         C  s  t  |  j  d k rB |  j \ } } } d  } d  } d  } d  } no t  |  j  d k r{ |  j \ } } } } } } d  } n6 t  |  j  d k r |  j \ } } } } } } } n  | d  k r | d } n  t j j | |  } t j j   j j	 | |  |  j
 g S(   Ni   i   i   i    (   R   R   R   R   R   R   R   R   R   t   predict_hideRk   (   R   R   t   _at_listR   R   t   _expressionR   R   (    (    s   renpy/ast.pyR     s     		!c         C  s   t  |  j  t d  t |  j  d k rS |  j \ } } } d  } d  } d } ni t |  j  d k r |  j \ } } } } } } n6 t |  j  d k r |  j \ } } } } } } } n  t j j | | p |  } t j	 j
 | p | |  d  S(   NR   i   i    i   i   (   R	   Rk   R   R   R   R   R   R   R   R   R   (   R   R   R  R   R  R   R   R   (    (    s   renpy/ast.pyR}   3  s    
	!(	   R'   R(   RI   R   R   R   Rv   R   R}   (    (    (    s   renpy/ast.pyR    s   				t   Withc           B  sD   e  Z d  d g Z d   Z d d  Z d   Z d   Z d   Z RS(   RJ   t   pairedc         O  s   t  j |   } d  | _ | S(   N(   Rs   R>   R   R	  (   R?   R   R    R   (    (    s   renpy/ast.pyR>   N  s    	c         C  s,   t  t |   j |  | |  _ | |  _ d S(   sI   
        @param expr: An expression giving a transition or None.
        N(   R   R  R   RJ   R	  (   R   R]   RJ   R	  (    (    s   renpy/ast.pyR   S  s    	c         C  s   t  |  j f S(   N(   R  RJ   (   R   (    (    s   renpy/ast.pyRv   \  s    c         C  sp   t  |  j  t d  t j j |  j  } |  j d  k	 rS t j j |  j  } n d  } t j	 j
 | |  d  S(   NR   (   R	   Rk   R   R   R   R   RJ   R	  R   R   t   with_statement(   R   R   R	  (    (    s   renpy/ast.pyR}   _  s    
c         C  sX   yD t  j j |  j  } | rC t  j j j | d d  d d    n  Wn n X|  j g S(   NR   R   (	   R   R   R   RJ   R   R   R   R   Rk   (   R   R   (    (    s   renpy/ast.pyR   m  s    )N(	   R'   R(   RI   R>   R   R   Rv   R}   R   (    (    (    s   renpy/ast.pyR  G  s   					t   Callc           B  sM   e  Z d  d d g Z d   Z d   Z d   Z d   Z d   Z d   Z RS(	   R   R,   R<   c         O  s   t  j |   } d  | _ | S(   N(   Rs   R>   R   R,   (   R?   R   R    R   (    (    s   renpy/ast.pyR>     s    	c         C  s5   t  t |   j |  | |  _ | |  _ | |  _ d  S(   N(   R   R  R   R   R<   R,   (   R   R]   R   R<   R,   (    (    s   renpy/ast.pyR     s    		c         C  s   t  |  j |  j f S(   N(   R  R   R<   (   R   (    (    s   renpy/ast.pyRv     s    c         C  s   t  d  |  j } |  j r1 t j j |  } n  t j j   j | d |  j	 j
 } t |  t t j j   _ |  j r |  j j   \ } } | t j _ | t j _ n d  t j _ d  t j _ d  S(   Nt   callt   return_site(   R   R   R<   R   R   R   R   R   R  Rk   R   R	   R   t   abnormalR,   R5   R   R   R   R   (   R   R   R#   R   R    (    (    s   renpy/ast.pyR}     s    
		$
	c         C  sY   |  j  } |  j r7 t |  s" g  St j j |  } n  t j j   j | |  j	 j
  g S(   N(   R   R<   RK   R   R   R   R   R   t   predict_callRk   R   (   R   R   (    (    s   renpy/ast.pyR     s    		c         C  s   t  j |   } d  | _ | S(   N(   Rs   Rr   R   Rq   (   R   R#   (    (    s   renpy/ast.pyRr     s    	(	   R'   R(   RI   R>   R   Rv   R}   R   Rr   (    (    (    s   renpy/ast.pyR  {  s   						t   Returnc           B  sP   e  Z d  g Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   R<   c         O  s   t  j |   } d  | _ | S(   N(   Rs   R>   R   R<   (   R?   R   R    R   (    (    s   renpy/ast.pyR>     s    	c         C  s#   t  t |   j |  | |  _ d  S(   N(   R   R  R   R<   (   R   R]   R<   (    (    s   renpy/ast.pyR     s    c         C  s   t  f S(   N(   R  (   R   (    (    s   renpy/ast.pyRv     s    c         C  s   d  |  _ d  S(   N(   R   Rk   (   R   Rk   (    (    s   renpy/ast.pyRi     s    	c         C  s   t  d  |  j r1 t j j |  j  t j _ n d  t j _ t j j	   } t j j	   j
 r t | j  d k r t j j r t d   n  d  Sn  t t j j	   j d t   t j j	   j   d  S(   Nt   returni    s(   Unexpected return during the init phase.t   pop(   R   R<   R   R   R   R   t   _returnR   R   R   R   R   t   return_stackR   t	   developerR   R	   t   lookup_returnR   t   pop_dynamic(   R   t   ctx(    (    s   renpy/ast.pyR}     s    
	c         C  s   t  j j   j   g S(   N(   R   R   R   t   predict_return(   R   (    (    s   renpy/ast.pyR     s    c         C  s   t  j |   } d  | _ | S(   N(   Rs   Rr   R   Rq   (   R   R#   (    (    s   renpy/ast.pyRr     s    	(
   R'   R(   RI   R>   R   Rv   Ri   R}   R   Rr   (    (    (    s   renpy/ast.pyR    s   							t   Menuc           B  s   e  Z e Z d  d d d d d d g Z d   Z d   Z d	   Z d
   Z d   Z	 d   Z
 d   Z d   Z d   Z d   Z RS(   t   itemst   setR   t   has_captionR,   t   item_argumentsR   c         O  s7   t  j |   } t | _ d  | _ d  | _ d | _ | S(   NR   (   Rs   R>   R   R  R   R,   R  R   (   R?   R   R    R   (    (    s   renpy/ast.pyR>     s    				c         C  sP   t  t |   j |  | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ d  S(   N(	   R   R  R   R  R  R   R  R,   R  (   R   R]   R  R  R   R  R,   R  (    (    s   renpy/ast.pyR     s    					c         C  s   t  f S(   N(   R  (   R   (    (    s   renpy/ast.pyRv     s    c         C  sR   | |   xA |  j  D]6 \ } } } | r x | D] } | j |  q0 Wq q Wd  S(   N(   R  Rx   (   R   Rw   t   _labelt
   _conditionRj   R   (    (    s   renpy/ast.pyRx     s
    
c         C  s@   | |  _  x0 |  j D]% \ } } } | r t | |  q q Wd  S(   N(   Rk   R  Rn   (   R   Rk   R  R   Rj   (    (    s   renpy/ast.pyRi     s    	c         C  s]   t  j |  | |  xC |  j D]8 \ } } } | r | d | k r | j d |  q q Wd  S(   Ni    (   Rs   R|   R  t   insert(   R   Rz   R{   R  R   Rj   (    (    s   renpy/ast.pyR|   "  s    c         C  s0  t  |  j  |  j r# t d  n
 t d  |  j d  k	 rT |  j j   \ } } n
 d  } } g  } g  } g  } xt |  j  D]\ } \ } } }	 t	 j
 j r t	 j
 j |  } n  t }
 |	 d  k r	t	 j
 j r | r | j |  q3| j | | d  f  t }
 n* | j | | | f  t }
 t  |	 d  |
 r |  j rr|  j | d  k	 rr| j |  j | j    q| j t   t   f  q q W| rt	 j j d  d j |  d t n  t |  j t	 j j j  t	 j j | |  j | | |  } | d  k	 rt  |  j | d d  n t  |  j  d  S(   Ns   menu-with-captiont   menui    s   
R   i   (   R	   Rk   R  R   R,   R   R5   t	   enumerateR  R   R   R   R   t   narrator_menuR/   R   R  R   R   R   R   R   R   R   R   R   R   R"  R  (   R   R   R    t   choicest	   narrationR  R   R   t	   conditionRj   t   has_itemt   choice(    (    s   renpy/ast.pyR}   )  sB    	

%	 %!c         C  sg   g  } d   } t  |  j |  t j j   x4 |  j D]) \ } } } | r6 | j | d  q6 q6 W| S(   Nc         S  s&   t  j j j |  d d  d d    d  S(   NR   R   (   R   R   R   R   R   (   R   (    (    s   renpy/ast.pyR   d  s    i    (   R   R   R   R   t   predict_menuR  R/   (   R   R#   R   R  R   Rj   (    (    s   renpy/ast.pyR   a  s    	c         C  s%   t  j |   } d  | _ t | _ | S(   N(   Rs   Rr   R   Rq   R   R   (   R   R#   (    (    s   renpy/ast.pyRr   q  s    		c         C  s:   x3 |  j  D]( \ } } } | d  k	 r
 | |  q
 q
 Wd  S(   N(   R  R   (   R   R   R  R   Rj   (    (    s   renpy/ast.pyR   w  s    (   R'   R(   R   R   RI   R>   R   Rv   Rx   Ri   R|   R}   R   Rr   R   (    (    (    s   renpy/ast.pyR    s$   			
						8		t   Jumpc           B  sJ   e  Z d  d g Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   t   targetR<   c         C  s,   t  t |   j |  | |  _ | |  _ d  S(   N(   R   R+  R   R,  R<   (   R   R]   R,  R<   (    (    s   renpy/ast.pyR     s    	c         C  s   t  |  j |  j f S(   N(   R+  R,  R<   (   R   (    (    s   renpy/ast.pyRv     s    c         C  s   d  |  _ d  S(   N(   R   Rk   (   R   Rk   (    (    s   renpy/ast.pyRi     s    	c         C  sf   t  d  |  j } |  j r1 t j j |  } n  t j j j |  } t	 t j j
   _ t |  d  S(   Nt   jump(   R   R,  R<   R   R   R   R   RE   t   lookupR   R   R  R	   (   R   R,  R#   (    (    s   renpy/ast.pyR}     s    
		c         C  sM   |  j  } |  j r7 t |  s" g  St j j |  } n  t j j j |  g S(   N(	   R,  R<   RK   R   R   R   R   RE   R.  (   R   R   (    (    s   renpy/ast.pyR     s    		c         C  sC   t  j |   } |  j r$ d  | _ n t j j j |  j	  | _ | S(   N(
   Rs   Rr   R<   R   Rq   R   R   RE   R.  R,  (   R   R#   (    (    s   renpy/ast.pyRr     s
    	(	   R'   R(   RI   R   Rv   Ri   R}   R   Rr   (    (    (    s   renpy/ast.pyR+    s   						t   Passc           B  s    e  Z g  Z d    Z d   Z RS(   c         C  s   t  f S(   N(   R/  (   R   (    (    s   renpy/ast.pyRv     s    c         C  s   t  |  j  t d  d  S(   Nt   pass(   R	   Rk   R   (   R   (    (    s   renpy/ast.pyR}     s    (   R'   R(   RI   Rv   R}   (    (    (    s   renpy/ast.pyR/    s   	t   Whilec           B  se   e  Z d  d g Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d	   Z
 d
   Z RS(   R'  Rj   c         C  s,   t  t |   j |  | |  _ | |  _ d  S(   N(   R   R1  R   R'  Rj   (   R   R]   R'  Rj   (    (    s   renpy/ast.pyR     s    	c         C  s   t  |  j f S(   N(   R1  R'  (   R   (    (    s   renpy/ast.pyRv     s    c         C  s/   | |   x |  j  D] } | j |  q Wd  S(   N(   Rj   Rx   (   R   Rw   R   (    (    s   renpy/ast.pyRx     s    
c         C  s   | |  _  t |  j |   d  S(   N(   Rk   Rn   Rj   (   R   Rk   (    (    s   renpy/ast.pyRi     s    	c         C  sI   t  j |  | |  |  j rE |  j d | k rE |  j j d |  n  d  S(   Ni    (   Rs   R|   Rj   R!  (   R   Rz   R{   (    (    s   renpy/ast.pyR|     s    c         C  sD   t  |  j  t d  t j j |  j  r@ t  |  j d  n  d  S(   Nt   whilei    (   R	   Rk   R   R   R   R   R'  Rj   (   R   (    (    s   renpy/ast.pyR}     s    
c         C  s   |  j  d |  j g S(   Ni    (   Rj   Rk   (   R   (    (    s   renpy/ast.pyR     s    c         C  s   t  j |   } d  | _ | S(   N(   Rs   Rr   R   Rq   (   R   R#   (    (    s   renpy/ast.pyRr     s    	c         C  s   | |  j   d  S(   N(   Rj   (   R   R   (    (    s   renpy/ast.pyR     s    (   R'   R(   RI   R   Rv   Rx   Ri   R|   R}   R   Rr   R   (    (    (    s   renpy/ast.pyR1    s   									t   Ifc           B  sb   e  Z d  g Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z RS(
   t   entriesc         C  s#   t  t |   j |  | |  _ d S(   sF   
        @param entries: A list of (condition, block) tuples.
        N(   R   R3  R   R4  (   R   R]   R4  (    (    s   renpy/ast.pyR      s    c         C  s   t  f S(   N(   R3  (   R   (    (    s   renpy/ast.pyRv   	  s    c         C  sF   | |   x5 |  j  D]* \ } } x | D] } | j |  q' Wq Wd  S(   N(   R4  Rx   (   R   Rw   R   Rj   R   (    (    s   renpy/ast.pyRx     s    
c         C  s4   | |  _  x$ |  j D] \ } } t | |  q Wd  S(   N(   Rk   R4  Rn   (   R   Rk   R   Rj   (    (    s   renpy/ast.pyRi     s    	c         C  sZ   t  j |  | |  x@ |  j D]5 \ } } | r | d | k r | j d |  q q Wd  S(   Ni    (   Rs   R|   R4  R!  (   R   Rz   R{   R   Rj   (    (    s   renpy/ast.pyR|     s    c         C  sY   t  |  j  t d  x; |  j D]0 \ } } t j j |  r! t  | d  d  Sq! Wd  S(   Nt   ifi    (   R	   Rk   R   R4  R   R   R   (   R   R'  Rj   (    (    s   renpy/ast.pyR}      s    
c         C  s.   g  |  j  D] \ } } | d ^ q
 |  j g S(   Ni    (   R4  Rk   (   R   R   Rj   (    (    s   renpy/ast.pyR   *  s    #c         C  s   t  j |   } d  | _ | S(   N(   Rs   Rr   R   Rq   (   R   R#   (    (    s   renpy/ast.pyRr   /  s    	c         C  s(   x! |  j  D] \ } } | |  q
 Wd  S(   N(   R4  (   R   R   R   Rj   (    (    s   renpy/ast.pyR   4  s    (   R'   R(   RI   R   Rv   Rx   Ri   R|   R}   R   Rr   R   (    (    (    s   renpy/ast.pyR3    s   								
		t   UserStatementc           B  s   e  Z d  d d d d d d d g Z d   Z d	   Z d
   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d d  Z d   Z RS(   t   linet   parsedRj   R   t
   code_blockR   R   t	   subparsesc         O  sI   t  j |   } g  | _ d  | _ t | _ t | _ d | _ g  | _	 | S(   NRt   (
   Rs   R>   Rj   R   R9  R   R   R   R   R:  (   R?   R   R    R   (    (    s   renpy/ast.pyR>   F  s    						c         C  sz   t  t |   j |  d  |  _ | |  _ | |  _ | |  _ g  |  _ |  j	 d  |  _
 t j j d |  j  pp d |  _ d  S(   NR   R   Rt   (   R   R6  R   R   R9  R8  R7  Rj   R:  R  R   R   t
   statementsR   R   (   R   R]   R7  Rj   R8  (    (    s   renpy/ast.pyR   P  s    					c         C  s   d j  |  j  S(   Ns   <UserStatement {!r}>(   R9   R7  (   R   (    (    s   renpy/ast.pyt   __repr__\  s    c         C  sv   | |   |  j  d  k	 r= x! |  j  D] } | j |  q# Wn  x2 |  j D]' } x | j D] } | j |  qW WqG Wd  S(   N(   R9  R   Rx   R:  Rj   (   R   Rw   R   t   j(    (    s   renpy/ast.pyRx   _  s    
c         C  sS   | |  _  |  j d  k	 r+ t |  j |  n  x! |  j D] } t | j |  q5 Wd  S(   N(   Rk   R9  R   Rn   R:  Rj   (   R   Rk   R   (    (    s   renpy/ast.pyRi   j  s
    	c         C  s   t  j |  | |  |  j rE |  j d | k rE |  j j d |  n  x: |  j D]/ } | j d | k rO |  j j d |  qO qO Wd  S(   Ni    (   Rs   R|   R9  R!  R:  Rj   (   R   Rz   R{   R   (    (    s   renpy/ast.pyR|   s  s    c         C  s>   |  j  r | |  j   n  x |  j D] } | | j  q# Wd  S(   N(   R9  R:  Rj   (   R   R   R   (    (    s   renpy/ast.pyR   }  s    	c         C  s   t  |  j f S(   N(   R6  R7  (   R   (    (    s   renpy/ast.pyRv     s    c         O  sX   |  j  } | d  k r? t j j |  |  j |  j  } | |  _  n  t j j | | | |  S(   N(   R8  R   R   R;  t   parseR7  Rj   R  (   R   t   methodR   R    R8  (    (    s   renpy/ast.pyR    s
    	c         C  s   |  j  d  d  S(   Nt   execute_init(   R  (   R   (    (    s   renpy/ast.pyR@    s    c         C  s   d |  j  f S(   Ni    (   R@  (   R   (    (    s   renpy/ast.pyRy     s    c         C  s1   t  |  j    t |  j    |  j d  d  S(   NR}   (   R	   t   get_nextR   t   get_nameR  (   R   (    (    s   renpy/ast.pyR}     s    c         C  s(  |  j  d  } | d  k	 r? x! | D] } t j j |  q" Wn  |  j r t j j d |  j  r g  |  j D] } | j	 d ^ qj |  j
 g S|  j
 r |  j
 j } n d  } |  j  d |  } | d  k	 rg  | D]' } | d  k	 r t j j j |  ^ q } g  | D] } | d  k	 r| ^ qS|  j
 g S(   NR   t   predict_alli    t   predict_next(   R  R   R   R   R   R8  R;  R   R:  Rj   Rk   R   R   RE   t   lookup_or_none(   R   t   predictionsR   t
   next_labelt	   next_listt   nexts(    (    s   renpy/ast.pyR     s    !+	4#c         C  sO   |  j  } | d  k r? t j j |  |  j |  j  } | |  _  n  t j j |  S(   N(   R8  R   R   R;  R>  R7  Rj   RB  (   R   R8  (    (    s   renpy/ast.pyRB    s
    	c         C  sp   |  j  r7 t |  j   r7 |  j d |  j  d j  } n |  j d  } | d  k	 re t j j j |  S|  j	 Sd  S(   NRk   i    (
   R9  R   R  R   R   R   R   RE   R.  Rk   (   R   R#   (    (    s   renpy/ast.pyRA    s    c         C  s2   t  j |   } |  j   | _ |  j d |  | S(   NRr   (   Rs   Rr   RA  Rq   R  (   R   R#   (    (    s   renpy/ast.pyRr     s    c         C  s   |  j  S(   N(   R7  (   R   R   (    (    s   renpy/ast.pyR=     s    c         C  s   |  j  d  r t St S(   NR   (   R  R   R   (   R   (    (    s   renpy/ast.pyR     s    N(   R'   R(   RI   R>   R   R<  Rx   Ri   R|   R   Rv   R  R@  Ry   R}   R   RB  RA  Rr   R   R=   R   (    (    (    s   renpy/ast.pyR6  9  s4   		
						
			
								t   PostUserStatementc           B  s5   e  Z d  g Z d   Z d   Z d   Z d   Z RS(   t   parentc         C  s8   t  t |   j |  | |  _ |  j j d  |  _ d  S(   Nt
   post_label(   R   RJ  R   RK  R  R   (   R   R]   RK  (    (    s   renpy/ast.pyR     s    	c         C  s   d j  |  j j  S(   Ns   <PostUserStatement {!r}>(   R9   RK  R7  (   R   (    (    s   renpy/ast.pyR<    s    c         C  s   t  |  j j f S(   N(   RJ  RK  R7  (   R   (    (    s   renpy/ast.pyRv     s    c         C  s8   t  |  j  t d |  j j    |  j j d  d  S(   Ns   post t   post_execute(   R	   Rk   R   RK  RB  R  (   R   (    (    s   renpy/ast.pyR}     s    (   R'   R(   RI   R   R<  Rv   R}   (    (    (    s   renpy/ast.pyRJ    s
   				c         C  s)   |  t  j j k r% t  j j |   n  d  S(   N(   R   R   t   special_namespacesR   R   (   R   (    (    s   renpy/ast.pyR     s    t   StoreNamespacec           B  s   e  Z d    Z d   Z RS(   c         C  s   | |  _  d  S(   N(   R   (   R   R   (    (    s   renpy/ast.pyR     s    c         C  s   | t  j j |  j | <d  S(   N(   R   R   R   R   (   R   R   R$   (    (    s   renpy/ast.pyR    s    (   R'   R(   R   R  (    (    (    s   renpy/ast.pyRO    s   	c         C  s6   |  t  j j k r& t  j j |  t f St |   t f S(   s   
    Returns the namespace object for `store`, and a flag that is true if the
    namespace is special, and false if it is a normal store.
    (   R   R   RN  R   RO  R   (   R   (    (    s   renpy/ast.pyt   get_namespace  s    t   save_directoryt   allow_duplicate_labelst   keyword_after_pythont   Definec           B  sM   e  Z d  d d g Z d   Z d   Z d   Z d   Z d   Z d   Z RS(	   R   Rh   R   c         O  s   t  j |   } d | _ | S(   NR   (   Rs   R>   R   (   R?   R   R    R   (    (    s   renpy/ast.pyR>     s    	c         C  sG   t  t |   j |  | |  _ | |  _ t | d | d d |  _ d  S(   NR]   RO   R   (   R   RT  R   R   R   RL   Rh   (   R   R]   R   R   RJ   (    (    s   renpy/ast.pyR   "  s    		c         C  s   t  |  j |  j f S(   N(   RT  R   R   (   R   (    (    s   renpy/ast.pyRv   )  s    c         C  s`   t  |  j  |  j d k r\ |  j t k r\ t j j |  j j  } t	 t j
 |  j |  n  d  S(   Ns   store.config(   R   R   R   t   EARLY_CONFIGR   R   R   Rh   RP   R   R   (   R   R$   (    (    s   renpy/ast.pyR~   ,  s    c         C  s   t  |  j  t d  t j |   t j j |  j j	  } |  j
 d k r t j j |  j  t j j j |  j |  j |  j f  n4 t j j j |  j
 d d |  j |  j |  j f  t |  j
  \ } } | j |  j |  d  S(   Nt   defineR   i   t   .(   R	   Rk   R   t   define_statementsR/   R   R   R   Rh   RP   R   R   R   R   R`   t   definitionsRB   RC   RP  R  (   R   R$   t   nst   _special(    (    s   renpy/ast.pyR}   3  s    
(4c         C  sW   |  j  | k r d  St j j |  j j  } t |  j   \ } } | j |  j |  d  S(   N(	   R   R   R   R   Rh   RP   RP  R  R   (   R   t   storesR$   RZ  R[  (    (    s   renpy/ast.pyt   redefineE  s
    (	   R'   R(   RI   R>   R   Rv   R~   R}   R]  (    (    (    s   renpy/ast.pyRT    s   						c         C  s"   x t  D] } | j |   q Wd S(   s.   
    Re-runs the given define statements.
    N(   RX  R]  (   R\  R   (    (    s   renpy/ast.pyR]  O  s    t   Defaultc           B  sV   e  Z d  d d g Z d   Z d   Z d   Z d   Z d   Z d   Z d	   Z	 RS(
   R   Rh   R   c         O  s   t  j |   } d | _ | S(   NR   (   Rs   R>   R   (   R?   R   R    R   (    (    s   renpy/ast.pyR>   e  s    	c         C  sG   t  t |   j |  | |  _ | |  _ t | d | d d |  _ d  S(   NR]   RO   R   (   R   R^  R   R   R   RL   Rh   (   R   R]   R   R   RJ   (    (    s   renpy/ast.pyR   j  s    		c         C  s   t  |  j |  j f S(   N(   R^  R   R   (   R   (    (    s   renpy/ast.pyRv   r  s    c         C  s   t  |  j  d  S(   N(   R   R   (   R   (    (    s   renpy/ast.pyR~   u  s    c         C  s   t  |  j  t d  t |  j  \ } } | ra t j j |  j j	  } | j
 |  j |  d  St j |   |  j d k r t j j j |  j |  j |  j f  n4 t j j j |  j d d |  j |  j |  j f  d  S(   NR%   R   i   RW  (   R	   Rk   R   RP  R   R   R   R   Rh   RP   t   set_defaultR   t   default_statementsR/   R`   RY  RB   RC   (   R   RZ  t   specialR$   (    (    s   renpy/ast.pyR}   x  s    
(c         C  s  t  j j |  j } | j d d   } | d  k r[ t  j j   | d <} | j j d  n  |  j	 | k r | s |  j	 | j k r t  j j
 |  j j  | |  j	 <n  | j j |  j	  | j |  j	  n3 | r t  j j r t d j |  j |  j	    n  d  S(   Nt   _defaults_sets-   {}.{} is being given a default a second time.(   R   R   R   R   R   R   t   RevertableSett   ever_been_changedt   addR   R   Rh   RP   R   R  R   R9   (   R   t   startt   dt   defaults_set(    (    s   renpy/ast.pyR_    s    "c         C  s   |  j  |  j | d  f g S(   N(   RB   RC   R   (   R   R   t   last(    (    s   renpy/ast.pyt   report_traceback  s    (
   R'   R(   RI   R>   R   Rv   R~   R}   R_  Rj  (    (    (    s   renpy/ast.pyR^  ]  s   							t   Screenc           B  s,   e  Z d  g Z d   Z d   Z d   Z RS(   t   screenc         C  s#   t  t |   j |  | |  _ d S(   s   
        @param name: The name of the image being defined.

        @param expr: An expression yielding a Displayable that is
        assigned to the image.
        N(   R   Rk  R   Rl  (   R   R]   Rl  (    (    s   renpy/ast.pyR     s    c         C  s   t  |  j j f S(   N(   Rk  Rl  R   (   R   (    (    s   renpy/ast.pyRv     s    c         C  s_   t  |  j  t d  |  j j |  j |  j f  t j j	 j
 |  j j |  j |  j f  d  S(   NRl  (   R	   Rk   R   Rl  RV  RB   RC   R   R`   t   screensR/   R   (   R   (    (    s   renpy/ast.pyR}     s    
(   R'   R(   RI   R   Rv   R}   (    (    (    s   renpy/ast.pyRk    s   			t	   Translatec           B  s   e  Z d  Z d Z e Z d d d d d g Z d d  Z d   Z	 d	   Z
 d
   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   s  
    A translation block, produced either by explicit translation statements
    or implicit translation blocks.

    If language is None, when executed this transfers control to the translate
    statement in the current language, if any, and otherwise runs the block.
    If language is not None, causes an error to occur if control reaches this
    statement.

    When control normally leaves a translate statement, in any language, it
    goes to the end of the translate statement in the None language.
    t   nevert
   identifiert	   alternatet   languageRj   t   afterc         C  s>   t  t |   j |  | |  _ | |  _ | |  _ | |  _ d  S(   N(   R   Rn  R   Rp  Rq  Rr  Rj   (   R   R]   Rp  Rr  Rj   Rq  (    (    s   renpy/ast.pyR     s
    			c         C  s   t  |  j |  j f S(   N(   Rn  Rp  Rr  (   R   (    (    s   renpy/ast.pyRv     s    c         C  sB   |  j  r, |  j  d |  _ t |  j  |  n	 | |  _ | |  _ d  S(   Ni    (   Rj   Rk   Rn   Rs  (   R   Rk   (    (    s   renpy/ast.pyRi     s
    		c         C  sd   t  j |  | |  |  j rE |  j d | k rE |  j j d |  n  |  j | k r` | |  _ n  d  S(   Ni    (   Rs   R|   Rj   R!  Rs  (   R   Rz   R{   (    (    s   renpy/ast.pyR|     s
    c         C  s(   t  j j j j |  j t |  d d    S(   NRq  (   R   R   RE   t
   translatort   lookup_translateRp  R   R   (   R   (    (    s   renpy/ast.pyR.    s    c         C  s   t  d  |  j d  k	 r5 t |  j  t d   n  |  j t j j	 j
 k r t j j	 j
 j |  j  t j j d 7_ t j j d 7_ n  t |  j    |  j t j j   _ t |  d d   t j j   _ d  S(   Nt	   translates)   Translation nodes cannot be run directly.i   Rq  (   R   Rr  R   R	   Rk   R   Rp  R   R   t
   persistentt   _seen_translatesRe  t   seen_translates_countt   new_translates_countR.  R   t   translate_identifierR   t   alternate_translate_identifier(   R   (    (    s   renpy/ast.pyR}   	  s    
c         C  s   |  j    } | g S(   N(   R.  (   R   t   node(    (    s   renpy/ast.pyR   	  s    c         C  s   t    } |  j   | _ | S(   N(   Ro   R.  Rq   (   R   R#   (    (    s   renpy/ast.pyRr   	  s    	c         C  s/   | |   x |  j  D] } | j |  q Wd  S(   N(   Rj   Rx   (   R   Rw   R   (    (    s   renpy/ast.pyRx   	  s    
c         C  s   | |  j   S(   N(   Rj   (   R   R   (    (    s   renpy/ast.pyR   #	  s    N(   R'   R(   R)   R   R   R   RI   R   R   Rv   Ri   R|   R.  R}   R   Rr   Rx   R   (    (    (    s   renpy/ast.pyRn    s$   											t   EndTranslatec           B  s/   e  Z d  Z d Z d   Z d   Z d   Z RS(   s|   
    A node added implicitly after each translate block. It's responsible for
    resetting the translation identifier.
    Ro  c         C  s   t  t |   j |  d  S(   N(   R   R~  R   (   R   R]   (    (    s   renpy/ast.pyR   /	  s    c         C  s   t  f S(   N(   R~  (   R   (    (    s   renpy/ast.pyRv   2	  s    c         C  s?   t  |  j  t d  d  t j j   _ d  t j j   _ d  S(   Ns   end translate(	   R	   Rk   R   R   R   R   R   R{  R|  (   R   (    (    s   renpy/ast.pyR}   5	  s    
(   R'   R(   R)   R   R   Rv   R}   (    (    (    s   renpy/ast.pyR~  '	  s
   		t   TranslateStringc           B  sA   e  Z d  Z e Z d d d d g Z d   Z d   Z d   Z RS(   s-   
    A node used for translated strings.
    Rr  Rz   R{   t   newlocc         C  s>   t  t |   j |  | |  _ | |  _ | |  _ | |  _ d  S(   N(   R   R  R   Rr  Rz   R{   R  (   R   R]   Rr  Rz   R{   R  (    (    s   renpy/ast.pyR   K	  s
    			c         C  s   t  f S(   N(   R  (   R   (    (    s   renpy/ast.pyRv   S	  s    c         C  s_   t  |  j  t d  t |  d |  j |  j d f  } t j j |  j	 |  j
 |  j |  d  S(   Ns   translate stringR  i   (   R	   Rk   R   R   RB   RC   R   R   t   add_string_translationRr  Rz   R{   (   R   R  (    (    s   renpy/ast.pyR}   V	  s    
"(	   R'   R(   R)   R   R   RI   R   Rv   R}   (    (    (    s   renpy/ast.pyR  =	  s   			t   TranslatePythonc           B  s;   e  Z d  Z e Z d d g Z d   Z d   Z d   Z RS(   s{   
    Runs python code when changing the language.

    This is no longer generated, but is still run when encountered.
    Rr  Rh   c         C  s>   t  t |   j |  | |  _ t | d | d d |  _ d S(   s   
        @param code: A PyCode object.

        @param hide: If True, the code will be executed with its
        own local dictionary.
        R]   RO   RX   N(   R   R  R   Rr  RL   Rh   (   R   R]   Rr  R   (    (    s   renpy/ast.pyR   l	  s    	c         C  s   t  |  j j f S(   N(   R  Rh   RM   (   R   (    (    s   renpy/ast.pyRv   y	  s    c         C  s   t  |  j  t d  d  S(   Nt   translate_python(   R	   Rk   R   (   R   (    (    s   renpy/ast.pyR}   |	  s    (	   R'   R(   R)   R   R   RI   R   Rv   R}   (    (    (    s   renpy/ast.pyR  ^	  s   			t   TranslateBlockc           B  sM   e  Z d  Z e Z d d g Z d   Z d   Z d   Z d   Z	 d   Z
 RS(   s:   
    Runs a block of code when changing the language.
    Rj   Rr  c         C  s,   t  t |   j |  | |  _ | |  _ d  S(   N(   R   R  R   Rr  Rj   (   R   R]   Rr  Rj   (    (    s   renpy/ast.pyR   	  s    	c         C  s/   | |   x |  j  D] } | j |  q Wd  S(   N(   Rj   Rx   (   R   Rw   R   (    (    s   renpy/ast.pyRx   	  s    
c         C  s   | |  _  t |  j d   d  S(   N(   Rk   Rn   Rj   R   (   R   Rk   (    (    s   renpy/ast.pyRi   	  s    	c         C  s   t  |  j  t d  d  S(   Nt   translate_block(   R	   Rk   R   (   R   (    (    s   renpy/ast.pyR}   	  s    c         C  s   | |  j   d  S(   N(   Rj   (   R   R   (    (    s   renpy/ast.pyR   	  s    (   R'   R(   R)   R   R   RI   R   Rx   Ri   R}   R   (    (    (    s   renpy/ast.pyR  	  s   						t   TranslateEarlyBlockc           B  s   e  Z d  Z RS(   s^   
    This is similar to the TranslateBlock, except it runs before deferred
    styles do.
    (   R'   R(   R)   (    (    (    s   renpy/ast.pyR  	  s   t   Stylec           B  sG   e  Z d  d d d d d d g Z d   Z d   Z d	   Z d
   Z RS(   t
   style_nameRK  t
   propertiest   cleart   taket   delattrt   variantc         C  sY   t  t |   j |  | |  _ d |  _ i  |  _ t |  _ d |  _	 g  |  _
 d |  _ d S(   sE   
        `name`
            The name of the style to define.
        N(   R   R  R   R  R   RK  R  R   R  R  R  R  (   R   R]   R   (    (    s   renpy/ast.pyR   	  s    						c         C  s   t  |  j f S(   N(   R  R  (   R   (    (    s   renpy/ast.pyRv   	  s    c         C  sH  |  j  d  k	 r= t j j |  j   } t j j  |  s= d  Sn  t j j |  j  } |  j	 rh | j	   n  |  j
 d  k	 r | j |  j
  n  |  j d  k	 r | j |  j  n  x |  j D] } | j |  q W|  j rDi  } xU |  j j   D]D \ } } t j j |  } | d k r&| j |  q | | | <q W| j |  n  d  S(   NR  (   R  R   R   R   R   R   t   stylet   get_or_create_styleR  R  RK  t
   set_parentR  R  R  R  R1   t   add_properties(   R   R  RG   R   R  R   RJ   R$   (    (    s   renpy/ast.pyR&   	  s*    		c         C  sZ   t  |  j  t d  t j j rL t j j   j rL t j	 j
 j |   d  S|  j   d  S(   NR  (   R	   Rk   R   R   R   t   defer_stylesR   R   R   R   t   deferred_stylesR/   R&   (   R   (    (    s   renpy/ast.pyR}    
  s    
(   R'   R(   RI   R   Rv   R&   R}   (    (    (    s   renpy/ast.pyR  	  s   				"t   Testcasec           B  s/   e  Z d  d g Z d   Z d   Z d   Z RS(   R   t   testc         C  s,   t  t |   j |  | |  _ | |  _ d  S(   N(   R   R  R   R   R  (   R   R]   R   R  (    (    s   renpy/ast.pyR   
  s    	c         C  s   t  |  j f S(   N(   R  R   (   R   (    (    s   renpy/ast.pyRv   
  s    c         C  s4   t  |  j  t d  |  j t j j j |  j <d  S(   Nt   testcase(   R	   Rk   R   R  R   t   testexecutiont	   testcasesR   (   R   (    (    s   renpy/ast.pyR}   
  s    
(   R'   R(   RI   R   Rv   R}   (    (    (    s   renpy/ast.pyR  
  s
   			(H   t
   __future__R    t   renpy.displayR   t
   renpy.testRc   R   R[   R   R	   t   objectR   R   R*   R+   R@   t   pyexpr_listRD   RA   RK   RL   Rn   Ro   Rs   R   t   compileR   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R  R  R  R  R  R  R+  R/  R1  R3  R6  RJ  R   RO  RP  RU  RX  RT  R]  R`  R^  Rk  Rn  R~  R  R  R  R  R  R  (    (    (    s   renpy/ast.pyt   <module>   s   			
\:		
8		'I8/2./'&(6A4>5:4=			:	J!_!''X