ó
[‘Œ\c        "   @  sÙ  d  d l  m Z d  d l Z d  d l Z e d ƒ Z d a d a	 e j
 d „  ƒ Z d „  Z d e j f d „  ƒ  YZ d a d	 e f d
 „  ƒ  YZ d e f d „  ƒ  YZ d d d d d d d d d d g
 Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ e j j d ƒ Z d e f d „  ƒ  YZ g  Z g  Z g  Z d  d! d" d# d$ d% d& d' d( d) d* d+ d, d- d. d/ d0 d1 d2 d3 d4 d5 d6 d7 d8 g Z g  e D] Z e e ƒ ^ qžZ g  e D] Z e d9 e ƒ ^ q½Z  g  e D] Z e d: e ƒ ^ qßZ! d; d< d= d> d? d@ dA dB dC dD dE dF dG dH dI dJ dK dL dM dN dO dP dQ dR dS dT dU dV dW dX dY dZ d[ d\ g" Z" g  e" D] Z e e ƒ ^ qmZ# g  e" D] Z e d9 e ƒ ^ qŒZ$ g  d] d^ d_ d` da db dc dd de df dg dh di dj dk dZ d[ d\ g D] Z e e ƒ ^ qäZ% g  dl dm dn do dp g D] Z e e ƒ ^ qZ& g  dq dr ds dt du dv dw dx dy dz d{ d| d} d~ dm d dp g D] Z e e ƒ ^ qdZ' g  d€ d d‚ dƒ d„ d… d† d‡ dZ d[ d\ g D] Z e e ƒ ^ q¤Z( e dˆ ƒ e d‰ ƒ e dŠ ƒ e d‹ ƒ e dŒ ƒ e d ƒ g Z) dŽ „  Z* e d d d ƒ e d‘ ƒ e d’ ƒ e* e) ƒ e* e ƒ e d“ d” d d• e+ ƒe d“ ƒ e d– ƒ e d— ƒ e d˜ ƒ e d• ƒ e* e) ƒ e* e ƒ e* e# ƒ e d™ dš e ƒ e* e) ƒ e* e ƒ e* e( ƒ e d› dœ e ƒ e* e) ƒ e* e ƒ e* e( ƒ e d dž e ƒ e* e) ƒ e* e ƒ e* e( ƒ e dŸ d  e ƒ e d¡ ƒ e d¢ ƒ e d£ ƒ e d… ƒ e* e) ƒ e* e ƒ e d¤ d¥ e ƒ e d¦ ƒ e d… ƒ e* e) ƒ e* e ƒ xF d§ d¨ g D]8 Z, e e, d© e, dª ƒ e* e) ƒ e* e ƒ e* e% ƒ qºWe d« d¬ d ƒ e d« ƒ e d­ ƒ e d® d¯ d ƒ e d° ƒ e d­ ƒ e d± ƒ e d² d³ d ƒ e d ƒ e d´ ƒ e dµ ƒ e d¶ ƒ e d· ƒ e d¸ ƒ e d¹ ƒ e dº ƒ e d» ƒ e* e) ƒ e* e ƒ e* e# ƒ e d¼ d½ d ƒ e d¾ ƒ e d¿ dÀ dª ƒ e d­ ƒ e dÁ ƒ e dÂ ƒ e dÃ ƒ e dÄ ƒ e dÅ ƒ e dÆ ƒ e* e) ƒ e* e ƒ e* e% ƒ e* e& ƒ e dÇ dÈ d ƒ e dÉ ƒ e dÊ ƒ e dË ƒ e dÌ ƒ e dÍ ƒ e dÎ ƒ e dÏ ƒ e d­ ƒ e dÁ ƒ e dÂ ƒ e dÃ ƒ e dÄ ƒ e dÐ ƒ e dÅ ƒ e dÆ ƒ e* e) ƒ e* e ƒ e* e% ƒ e* e& ƒ e dÑ dÒ d d• e+ ƒe dÓ ƒ e d­ ƒ e dÁ ƒ e dÂ ƒ e dÃ ƒ e dÄ ƒ e dÔ ƒ e d˜ ƒ e d• ƒ e dÅ ƒ e dÆ ƒ e* e) ƒ e* e ƒ e* e% ƒ e* e& ƒ e* e  ƒ e* e$ ƒ e dÓ dÕ d d• e+ ƒe dÓ ƒ e dÔ ƒ e* e) ƒ e* e ƒ e* e% ƒ e* e  ƒ e* e$ ƒ x‚ dÖ d× g D]t Z, e e, d© e, d ƒ e dØ ƒ e dÙ ƒ e dÚ ƒ e dº ƒ e dÂ ƒ e dÃ ƒ e* e) ƒ e* e ƒ e* e' ƒ q_	We dÛ dÜ dª ƒ e dÝ ƒ e dÞ ƒ e dß ƒ e dà ƒ e dá ƒ e dâ ƒ e dã ƒ e dä ƒ e då ƒ e dæ ƒ e d: d… ƒ e* e) ƒ e* e ƒ e* e! ƒ e dç dè e ƒ e dé ƒ e dË ƒ e dÌ ƒ e dÊ ƒ e dÎ ƒ e dÍ ƒ e dÏ ƒ e dÉ ƒ e dê ƒ e dë ƒ e* e) ƒ e* e ƒ e dì dí dª ƒ e dî ƒ e d­ ƒ e dÁ ƒ e dÂ ƒ e dÃ ƒ e* e) ƒ e* e ƒ e* e% ƒ e* e& ƒ e dï dð d ƒ e dî ƒ e dØ ƒ e dÙ ƒ e dÚ ƒ e* e) ƒ e* e ƒ e* e' ƒ e dñ dò dª ƒ e dˆ ƒ e d‰ ƒ x e j- j. D] Z e e ƒ qïWe dó dô d ƒ e d¾ ƒ e dˆ ƒ e d‰ ƒ x e j- j. D] Z e e ƒ q>We dõ dö d ƒ e d÷ ƒ e d­ ƒ e dø dù dª ƒ e dú ƒ e dà ƒ e dû ƒ e dü ƒ e dý ƒ e dþ ƒ e dÿ ƒ e d ƒ e dƒ e dÁ ƒ e dÂ ƒ e dÃ ƒ e dƒ e do ƒ e* e) ƒ e* e ƒ e dde ƒ e dƒ e* e) ƒ e* e ƒ e ddd ƒ e dÂ ƒ e dÃ ƒ e dn ƒ e* e) ƒ e* e ƒ de f d	„  ƒ  YZ/ e/ d
ƒ de f d„  ƒ  YZ0 e0 d ƒ de f d„  ƒ  YZ1 e1 dƒ de f d„  ƒ  YZ2 e2 dƒ de f d„  ƒ  YZ3 e3 dƒ de f d„  ƒ  YZ4 e4 de+ ƒ e4 de5 ƒ x e D] Z e j* e ƒ qmWde j j6 f d„  ƒ  YZ7 de f d„  ƒ  YZ8 e8 ƒ  Z9 e9 j* e ƒ d„  Z: d S(  iÿÿÿÿ(   t   print_functionNt   asti    c           c  s!   t  d 7a  d t  Vt  d 8a  d  S(   Ni   s   _%d(   t   new_variable_serial(    (    (    s   renpy/screenlang.pyt   new_variable&   s    
	c         C  s?   x8 t  j |  ƒ D]' }  t |  d ƒ r |  j | 7_ q q Wd  S(   Nt   lineno(   R   t   walkt   hasattrR   (   t   nodet   amount(    (    s   renpy/screenlang.pyt   increment_lineno/   s    t   LineNumberNormalizerc           B  s   e  Z d  „  Z d „  Z RS(   c         C  s   d |  _  d  S(   Ni   (   t	   last_line(   t   self(    (    s   renpy/screenlang.pyt   __init__7   s    c         C  sP   t  | d ƒ r6 t |  j | j ƒ |  _ |  j | _ n  t t |  ƒ j | ƒ d  S(   NR   (   R   t   maxR   R   t   superR
   t   generic_visit(   R   R   (    (    s   renpy/screenlang.pyR   :   s    (   t   __name__t
   __module__R   R   (    (    (    s   renpy/screenlang.pyR
   5   s   	t
   Positionalc           B  s   e  Z d  Z d „  Z RS(   s?   
    This represents a positional parameter to a function.
    c         C  s#   | |  _  t r t j |  ƒ n  d  S(   N(   t   namet   parsert   add(   R   R   (    (    s   renpy/screenlang.pyR   O   s    	(   R   R   t   __doc__R   (    (    (    s   renpy/screenlang.pyR   J   s   t   Keywordc           B  s   e  Z d  Z d „  Z RS(   sF   
    This represents an optional keyword parameter to a function.
    c         C  s#   | |  _  t r t j |  ƒ n  d  S(   N(   R   R   R   (   R   R   (    (    s   renpy/screenlang.pyR   [   s    	(   R   R   R   R   (    (    (    s   renpy/screenlang.pyR   V   s   t    t   insensitive_t   hover_t   idle_t	   activate_t	   selected_t   selected_insensitive_t   selected_hover_t   selected_idle_t   selected_activate_t   Stylec           B  s   e  Z d  Z d „  Z RS(   s:   
    This represents a style parameter to a function.
    c         C  s#   | |  _  t r t j |  ƒ n  d  S(   N(   R   R   R   (   R   R   (    (    s   renpy/screenlang.pyR   u   s    	(   R   R   R   R   (    (    (    s   renpy/screenlang.pyR#   p   s   t   PrefixStylec           B  s   e  Z d  Z d „  Z RS(   sC   
    This represents a prefixed style parameter to a function.
    c         C  s,   | |  _  | |  _ t r( t j |  ƒ n  d  S(   N(   t   prefixR   R   R   (   R   R%   R   (    (    s   renpy/screenlang.pyR      s    		(   R   R   R   R   (    (    (    s   renpy/screenlang.pyR$   |   s   t   Parserc           B  st   e  Z d  „  Z d „  Z d „  Z e d „ Z d „  Z d „  Z d d „ Z	 d d „ Z
 d	 „  Z d
 „  Z d „  Z RS(   c         C  s5   | |  _  g  |  _ i  |  _ i  |  _ t j |  ƒ d  S(   N(   R   t
   positionalt   keywordt   childrent   all_statementst   append(   R   R   (    (    s   renpy/screenlang.pyR   ‹   s
    				c         C  s   d |  j  j |  j f S(   Ns   <%s: %s>(   t	   __class__R   R   (   R   (    (    s   renpy/screenlang.pyt   __repr__˜   s    c         C  s  t  | t ƒ r1 x | D] } |  j | ƒ q Wd St  | t ƒ rS |  j j | ƒ n¹ t  | t ƒ ru | |  j | j <n— t  | t	 ƒ r¬ x… t
 D] } | |  j | | j <q‹ Wn` t  | t ƒ rê xN t
 D]! } | |  j | j | | j <qÂ Wn" t  | t ƒ r| |  j | j <n  d S(   s/   
        Adds a clause to this parser.
        N(   t
   isinstancet   listR   R   R'   R+   R   R(   R   R#   t   STYLE_PREFIXESR$   R%   R&   R)   (   R   t   it   j(    (    s   renpy/screenlang.pyR   ›   s     "c         C  sw   | j  ƒ  p | j d ƒ } | ro | |  j k ro | rR |  j | j | | ƒ } n |  j | j | | ƒ } | Sd  Sd  S(   Ns   \$(   t   wordt   matchR)   t   parse_layoutt   parset   None(   R   t   lR   t   layout_modeR3   t   c(    (    s   renpy/screenlang.pyt   parse_statement·   s    c         C  s   | j  d |  j ƒ d  S(   NsE   The %s statement cannot be used as a container for the has statement.(   t   errorR   (   R   R8   R   (    (    s   renpy/screenlang.pyR5   Ä   s    c      
   C  sÚ   | j  | ƒ | j ƒ  } g  } t ƒ  ¬ } d } xœ | j ƒ  rÏ t | j ƒ d k r | j |  j d | | | f | j ƒ ƒ n | } |  j	 | | ƒ } | d  k rµ | j d ƒ n  | j | ƒ | d 7} q4 WWd  QX| S(   Ni    i   s   %s = (%s, %d)s#   Expected screen language statement.(   t   expect_blockt   subblock_lexerR   t   advancet   lent   blockt   extendt
   parse_exect   numberR;   R7   R<   (   R   t   stmtR8   R   t   rvt
   child_namet   countR:   (    (    s   renpy/screenlang.pyt   parse_childrenÇ   s    ,i   c         C  s­   t  | t ƒ r$ t j j | ƒ } n  y  t j | d ƒ j d j } WnQ t	 k
 r— } t j
 j t | | d d d d | d d | d d ƒ ‚ n Xt | | d ƒ | S(   sˆ   
        Parses an expression for eval, and then strips off the module
        and expr instances, and adjusts the line number.
        t   evali    i   s-   Syntax error while parsing python expression.i   i   (   R.   t   unicodet   renpyt   pythont   escape_unicodeR   R6   t   bodyt   valuet   SyntaxErrorR   t
   ParseErrort   filenameR	   (   R   t   exprR   RF   t   e(    (    s   renpy/screenlang.pyt
   parse_evalâ   s     	c         C  s¦   t  | t ƒ r$ t j j | ƒ } n  y t j | d ƒ } WnQ t k
 r } t j j	 t
 | | d d d d | d d | d d ƒ ‚ n Xt | | d ƒ | j S(   sŽ   
        Parses an expression for exec, then strips off the module and
        adjusts the line number. Returns a list of statements.
        t   execi   s'   Syntax error while parsing python code.i   i   (   R.   RK   RL   RM   RN   R   R6   RQ   R   RR   RS   R	   RO   (   R   t   codeR   RF   RU   (    (    s   renpy/screenlang.pyRC   ù   s    	c         C  s+   | j  } | j | j ƒ } |  j | | ƒ S(   N(   RD   t   requiret   simple_expressionRV   (   R   R8   R   RT   (    (    s   renpy/screenlang.pyt   parse_simple_expression  s    	c         C  s+   | j  } | j | j ƒ } |  j | | ƒ S(   N(   RD   RY   t   comma_expressionRV   (   R   R8   R   RT   (    (    s   renpy/screenlang.pyt   parse_comma_expression  s    	c         C  s   t  d ƒ ‚ d S(   sï   
        This is expected to parse a function statement, and to return
        a list of python ast statements.

        `l` the lexer.

        `name` the name of the variable containing the name of the
        current statement.
        s   Not ImplementedN(   t	   Exception(   R   R8   R   (    (    s   renpy/screenlang.pyR6     s    (   R   R   R   R-   R   t   FalseR;   R5   RI   RV   RC   R[   R]   R6   (    (    (    s   renpy/screenlang.pyR&   ‰   s   							t   manyt   FunctionStatementParserc           B  s5   e  Z d  Z d e e d „ Z d „  Z e d „ Z RS(   s>   
    This is responsible for parsing function statements.
    i    c         C  s`   t  t |  ƒ j | ƒ | |  _ | |  _ | |  _ |  a | d k rS t j |  ƒ n  | |  _	 d  S(   Ni    (
   R   Ra   R   t   functiont	   nchildrent   unevaluatedR   t   childbearing_statementsR+   t   scope(   R   R   Rb   Rc   Rd   Rf   (    (    s   renpy/screenlang.pyR   4  s    			c         C  s   |  j  | | t ƒ S(   N(   R6   t   True(   R   R8   R   (    (    s   renpy/screenlang.pyR5   K  s    c           s,  g  } | j  } | r; ˆ j d k r; | j d ˆ j ƒ n  ˆ j ˆ j | ƒ } t j d | d d d | d g  d g  d d  d	 d  ƒ ‰  t	 ƒ  ‰ ‡  ‡ ‡ f d
 †  } x* ˆ j
 D] } ˆ  j j ˆ j | ƒ ƒ q® Wxp t rC| j d ƒ r| j ƒ  | j ˆ j ƒ t }	 Pn  | j ƒ  r3| j ˆ j ƒ t }	 Pn  | | d ƒ qÔ W| j t j d ˆ  ƒ ƒ ˆ j d k r…| j ˆ j d ƒ ƒ n  ˆ j d k }
 d } g  } |	 r¼| j | j ƒ  ƒ n  | rÒ| j | ƒ n  t ƒ  ©} xŸ| D]—} xŽ| j ƒ  r{| j ƒ  } | j d ƒ rÑˆ j d k r;| j d ˆ j ƒ n  | d k rW| j d ƒ n  ˆ j | | d t ƒ} | d  k r‹| j d ƒ n  | j ƒ  | j ˆ j d | | | f ƒ ƒ | j | ƒ t }
 qîn  ˆ j | | ƒ } | d  k	 r/| j ˆ j d | | | f ƒ ƒ | j | ƒ | d 7} qîn  | j | ƒ | j ƒ  sX| | d ƒ n  x | j ƒ  sw| | d ƒ q[WqîWqåWWd  QX|
 r¥| j ˆ j d ƒ ƒ n  d ˆ k râˆ  j  j t j d d d ˆ j | | ƒ ƒ ƒ n  d ˆ k r(ˆ j! r(ˆ  j  j t j d d d ˆ j d | ƒ ƒ ƒ n  | S(   Ni    s,   The %s statement cannot be used as a layout.R   t
   col_offsett   funct   argst   keywordst   starargst   kwargsc           sÅ   |  j  ƒ  } | d  k r( |  j | ƒ n  | ˆ j k rT |  j d | ˆ j f ƒ n  | ˆ k r} |  j d | ˆ j f ƒ n  ˆ j | ƒ ˆ j |  ƒ } ˆ  j j t	 j d t
 | ƒ d | ƒ ƒ d  S(   NsA   %r is not a keyword argument or valid child for the %s statement.s=   keyword argument %r appears more than once in a %s statement.t   argRP   (   R3   R7   R<   R(   R   R   R]   Rk   R+   R   t   str(   R8   t   expectR   RT   (   t	   call_nodet   seen_keywordsR   (    s   renpy/screenlang.pyt   parse_keywordh  s    	t   :s3   expected a keyword argument, colon, or end of line.RP   i   s   ui.child_or_fixed()t   hass(   The %s statement does not take a layout.sC   The has statement may not be given after a child has been supplied.R9   s   Has expects a child statement.s   %s = (%s, %d)s/   expected a keyword argument or child statement.s+   expected a keyword argument or end of line.s
   ui.close()t   idRn   Rf   t   _scope("   RD   Rc   R<   R   RV   Rb   R   t   CallR7   t   setR'   Rj   R+   R[   Rg   R4   t
   expect_eolR=   t   eolt   expect_noblockR_   t   ExprRB   RC   R>   R   R?   t
   checkpointR(   R;   t   popt   revertRk   Rf   (   R   R8   R   R9   RF   R   Ri   Rs   t   _iRA   t   needs_closet   child_indext   lexersRG   t   stateR:   (    (   Rq   Rr   R   s   renpy/screenlang.pyR6   N  s’    					

##
11(   R   R   R   R_   R   R5   R6   (    (    (    s   renpy/screenlang.pyRa   /  s   	t   anchort   xanchort   yanchort   post   xpost   ypost   alignt   xalignt   yalignt   xoffsett   yoffsett   maximumt   xmaximumt   ymaximumt   areat   clippingt   xfillt   yfillt   xcentert   ycentert   xsizet   ysizet   xysizet   altt   debugt   text_t   side_t	   antialiast   verticalt   black_colort   boldt   colort   drop_shadowt   drop_shadow_colort   first_indentt   fontt   sizet   hyperlink_functionst   italict   justifyt   kerningt   languaget   layoutt   line_leadingt   line_spacingt   minwidtht	   min_widtht   newline_indentt   outlinest   rest_indentt
   ruby_stylet   slow_cpst   slow_cps_multipliert   slow_abortablet   strikethrought
   text_alignt   text_y_fudget	   underlinet   minimumt   xminimumt   yminimumt
   backgroundt
   foregroundt   left_margint   right_margint   bottom_margint
   top_margint   xmargint   ymargint   left_paddingt   right_paddingt   top_paddingt   bottom_paddingt   xpaddingt   ypaddingt
   size_groupt   soundt   mouset
   focus_maskt   childt   keyboard_focust   bar_verticalt
   bar_invertt   bar_resizingt   left_guttert   right_guttert
   top_guttert   bottom_guttert   left_bart	   right_bart   top_bart
   bottom_bart   thumbt   thumb_shadowt   thumb_offsett   unscrollablet
   box_layoutt   box_wrapt   box_wrap_spacingt   box_reverset   order_reverset   spacingt   first_spacingt	   fit_firstt   atRv   t   stylet   style_groupt   focust   defaultc         C  s   t  j |  ƒ d  S(   N(   R   R   (   t   thing(    (    s   renpy/screenlang.pyR     s    t   nulls   ui.nullt   widtht   heightt   texts   ui.textRf   t   slowt	   slow_donet
   substitutet   hboxs   ui.hboxt   vboxs   ui.vboxt   fixeds   ui.fixedt   grids   ui.gridt   colst   rowst	   transposet   sides   ui.sidet	   positionst   windowt   frames   ui.i   t   keys   ui.keyt   actiont   timers   ui.timert   delayt   repeatt   inputs   ui.inputt   lengtht   allowt   excludet	   copypasteR%   t   suffixt   changedt   pixel_widtht   images   ui.imaget   imt   buttons	   ui.buttont   clickedt   hoveredt	   unhoveredt	   alternatet   selectedt	   sensitivet   imagebuttons   ui.imagebuttont   autot   idlet   hovert   insensitivet   selected_idlet   selected_hovert   selected_insensitivet   image_stylet
   textbuttons   ui.textbuttont   labelt
   text_styles   ui.labelt   bart   vbart
   adjustmentt   rangeRP   t   viewports   ui.viewportt
   child_sizet
   mousewheelt	   arrowkeyst	   draggablet
   edgescrollt   xadjustmentt   yadjustmentt   xinitialt   yinitialt
   scrollbarst   imagemaps   ui.imagemapt   groundt   alphat   cachet   hotspots   ui.hotspot_with_childt   spott   hotbars	   ui.hotbart	   transforms   ui.transformR   s   ui.addt   ons   ui.ont   eventt   drags   ui.dragt	   drag_namet	   droppablet
   drag_raiset   draggedt   droppedt   drop_allowablet   drag_handlet   drag_joinedt
   mouse_dropt	   draggroups   ui.draggroupt   min_overlapt	   mouseareas   ui.mouseareat
   PassParserc           B  s   e  Z d  „  Z d „  Z RS(   c         C  s   t  t |  ƒ j | ƒ d  S(   N(   R   RN  R   (   R   R   (    (    s   renpy/screenlang.pyR   “  s    c         C  s   |  j  d | j ƒ S(   Nt   pass(   RC   RD   (   R   R8   R   (    (    s   renpy/screenlang.pyR6   –  s    (   R   R   R   R6   (    (    (    s   renpy/screenlang.pyRN  ‘  s   	RO  t   DefaultParserc           B  s   e  Z d  „  Z d „  Z RS(   c         C  s   t  t |  ƒ j | ƒ d  S(   N(   R   RP  R   (   R   R   (    (    s   renpy/screenlang.pyR   Ÿ  s    c         C  sN   | j  | j ƒ } | j  d ƒ | j ƒ  } d | | f } |  j | | j ƒ S(   Nt   =s   _scope.setdefault(%r, (%s))(   RY   R3   t   restRC   RD   (   R   R8   R   RR  RX   (    (    s   renpy/screenlang.pyR6   ¢  s
    (   R   R   R   R6   (    (    (    s   renpy/screenlang.pyRP    s   	t	   UseParserc           B  s   e  Z d  „  Z d „  Z RS(   c         C  s'   t  t |  ƒ j | ƒ t j |  ƒ d  S(   N(   R   RS  R   Re   R+   (   R   R   (    (    s   renpy/screenlang.pyR   ²  s    c   	      C  sö   | j  } | j | j ƒ } d | } t j j | ƒ } | r‹ xK | j D]= \ } } | d  k rp | d | 7} qG | d | | f 7} qG Wn  | d | 7} | rÜ | j r¼ | d | j 7} n  | j	 rÜ | d | j	 7} qÜ n  | d 7} |  j
 | | ƒ S(   Ns   renpy.use_screen(%rs   , (%s)s	   , %s=(%s)s   , _name=%s, _scope=_scopes   , *(%s)s   , **(%s)t   )(   RD   RY   R3   RL   R   t   parse_argumentst	   argumentsR7   t   extrapost   extrakwRC   (	   R   R8   R   R   t   target_nameRX   Rj   t   kt   v(    (    s   renpy/screenlang.pyR6   ¶  s"    	
		
(   R   R   R   R6   (    (    (    s   renpy/screenlang.pyRS  °  s   	t   uset   IfParserc           B  s   e  Z d  „  Z d „  Z RS(   c         C  s'   t  t |  ƒ j | ƒ t j |  ƒ d  S(   N(   R   R]  R   Re   R+   (   R   R   (    (    s   renpy/screenlang.pyR   Ü  s    c         C  s  t  ƒ   } d } | j } |  j | j | j ƒ | ƒ } | j d ƒ | j ƒ  |  j d | | | f ƒ } | j |  j d | | ƒ ƒ g  } t	 j
 d | d | d | d | d	 d ƒ }	 | d
 7} | j ƒ  }
 x4| j ƒ  r| } | j } | j d ƒ r¡|  j | j | j ƒ | ƒ } |  j d | | | f ƒ } | j |  j d | | ƒ ƒ g  } | j t	 j
 d | d | d | d | d	 d ƒ ƒ | d
 7} | j ƒ  }
 qÑ | j d ƒ ró| j |  j d | | | f ƒ ƒ | j |  j d | | ƒ ƒ PqÑ | j |
 ƒ PqÑ WWd  QX|	 g S(   Ni    Rt   s   %s = (%s, %d)t   ift   testRO   t   orelseR   Rh   i   t   elift   else(   R   RD   RV   RY   t   python_expressionRz   RC   RB   RI   R   t   IfR~   R?   R(   R+   R€   (   R   R8   R   RG   RH   R   t	   conditionRO   R`  RF   R…   t
   old_orelse(    (    s   renpy/screenlang.pyR6   à  s<    	
*
	1
#(   R   R   R   R6   (    (    (    s   renpy/screenlang.pyR]  Ú  s   	R^  t	   ForParserc           B  s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C  s'   t  t |  ƒ j | ƒ t j |  ƒ d  S(   N(   R   Rg  R   Re   R+   (   R   R   (    (    s   renpy/screenlang.pyR     s    c      
   C  sð   t  } g  } x t r« | j } | j d ƒ r? |  j | ƒ } n | j ƒ  j d ƒ } | s^ Pn  | j t j	 d | d t j
 ƒ  d | d d ƒ ƒ | j d ƒ r§ t } q Pq W| sÂ | j d	 ƒ n  | sÐ | d St j d
 | d t j
 ƒ  ƒ Sd  S(   Ns   \(s   utf-8Rv   t   ctxR   Rh   i    t   ,s   Expected tuple pattern.t   elts(   R_   Rg   RD   R4   t   parse_tuple_patternR   t   encodeR+   R   t   Namet   StoreR<   t   Tuple(   R   R8   t   is_tuplet   patternR   t   p(    (    s   renpy/screenlang.pyRk     s$    		1	c   
      C  s!  | j  } |  j | ƒ } | j d ƒ |  j | j | j ƒ | j  ƒ } | j d ƒ | j ƒ  t ƒ  µ } t ƒ  Y } |  j d | | | f ƒ } | j |  j	 d | | ƒ ƒ | j |  j d | ƒ ƒ Wd  QX|  j d | ƒ }	 |	 j
 t j d | d | d	 | d
 g  d | d d ƒ ƒ Wd  QX|	 S(   Nt   inRt   s   %s = (%s, %s)t   fors   %s += 1s   %s = 0t   targett   iterRO   R`  R   Rh   i    (   RD   Rk  RY   RV   Rc  Rz   R   RC   RB   RI   R+   R   t   For(
   R   R8   R   R   Rq  t
   expressiont   counter_nameRG   R)   RF   (    (    s   renpy/screenlang.pyR6   @  s(    	!
 (   R   R   R   Rk  R6   (    (    (    s   renpy/screenlang.pyRg    s   		 Rt  t   PythonParserc           B  s   e  Z d  „  Z d „  Z RS(   c         C  s#   t  t |  ƒ j | ƒ | |  _ d  S(   N(   R   Rz  R   t   one_line(   R   R   R{  (    (    s   renpy/screenlang.pyR   g  s    c         C  sn   | j  } |  j r. | j ƒ  } | j d ƒ n0 | j d ƒ | j d ƒ | j ƒ  } | d 7} |  j | | ƒ S(   Ns   one-line python statementRt   s   python blocki   (   RD   R{  RR  R|   RY   R=   t   python_blockRC   (   R   R8   R   R   t   python_code(    (    s   renpy/screenlang.pyR6   l  s    		
(   R   R   R   R6   (    (    (    s   renpy/screenlang.pyRz  e  s   	t   $RM   t   ScreenLangScreenc           B  sP   e  Z d  Z d Z d Z d Z d Z d Z d „  Z	 d „  Z
 d „  Z d „  Z RS(	   sB   
    This represents a screen defined in the screen language.
    i   R7   R_   c         C  sL   t  |  _  d |  _ d |  _ d  |  _ d  |  _ d |  _ d |  _ d  |  _ d  S(   NR_   t   0R7   (	   R   t   modalt   zorderR7   t   tagRX   t   variantt   predictt
   parameters(   R   (    (    s   renpy/screenlang.pyR   ¹  s    							c         C  s%   | d k  r! d |  _  d |  _ n  d  S(   Ni   R_   R€  (   R  R‚  (   R   t   version(    (    s   renpy/screenlang.pyt   after_upgradeÓ  s    	c         C  st   t  j j j |  j |  d |  j d |  j d |  j d t  j j	 |  j
 ƒ d t  j j	 |  j ƒ d |  j d |  j ƒd S(	   s#   
        Defines a screen.
        R  R‚  Rƒ  R„  R…  R†  t   locationN(   RL   t   displayt   screent   define_screenR   R  R‚  Rƒ  RM   t   py_evalR„  R…  R†  R‰  (   R   R‰  (    (    s   renpy/screenlang.pyt   defineØ  s    				c         O  s‚   | d } |  j  rb | j d d ƒ } | j d i  ƒ } t j j |  j  | | ƒ } | j | ƒ n  t j j |  j j	 d | ƒd  S(   NRw   t   _argst   _kwargst   locals(    (
   R†  t   getRL   R   t   apply_argumentst   updateRM   t   py_exec_bytecodeRX   t   bytecode(   R   Rj   Rm   Rf   t   values(    (    s   renpy/screenlang.pyt   __call__é  s    
	N(   R   R   R   t   __version__R„  R…  R7   R†  R‰  R   Rˆ  RŽ  R˜  (    (    (    s   renpy/screenlang.pyR  ©  s   			t   ScreenParserc           B  s   e  Z d  „  Z d d „ Z RS(   c         C  s   t  t |  ƒ j d ƒ d  S(   NR‹  (   R   Rš  R   (   R   (    (    s   renpy/screenlang.pyR   ù  s    t   _namec      
     sÈ  | j  ƒ  } t ƒ  ‰  ‡  f d †  } | j } | j | j ƒ ˆ  _ t j j | ƒ ˆ  _	 x | | ƒ rl qZ qZ W| j d ƒ | j
 ƒ  | j d ƒ | j ƒ  } g  } d } t ƒ  º } x° | j ƒ  rg| | ƒ rö x | | ƒ rå qÓ qÓ W| j
 ƒ  q¸ n  | j |  j d | | | f | j ƒ ƒ |  j | | ƒ }	 |	 d  k rM| j d ƒ n  | j |	 ƒ | d 7} q¸ WWd  QXt j d | d	 | d
 d ƒ }
 t j |
 ƒ t ƒ  j |
 ƒ t j j |
 | d ƒ ˆ  _ ˆ  S(   Nc           sÌ   |  j  d ƒ r( |  j |  j ƒ ˆ  _ t S|  j  d ƒ rP |  j |  j ƒ ˆ  _ t S|  j  d ƒ rx |  j |  j ƒ ˆ  _ t S|  j  d ƒ r  |  j |  j ƒ ˆ  _ t S|  j  d ƒ rÈ |  j |  j ƒ ˆ  _	 t St
 S(   NR  R‚  Rƒ  R„  R…  (   R4   RY   RZ   R  Rg   R‚  R3   Rƒ  R„  R…  R_   (   R8   (   R‹  (    s   renpy/screenlang.pyRs     s     Rt   s   screen statementi    s   %s = (%s, %d)s%   Expected a screen language statement.i   RO   R   Rh   RW   (   t   get_locationR  RD   RY   R3   R   RL   R   t   parse_parametersR†  Rz   R=   R>   R   R?   RB   RC   R;   R7   R<   R   t   Modulet   fix_missing_locationsR
   t   visitt   PyCodeRX   (   R   R8   R   R‰  Rs   R   RF   RH   RG   R:   R   (    (   R‹  s   renpy/screenlang.pyR6   ü  s@    		

)(   R   R   R   R6   (    (    (    s   renpy/screenlang.pyRš  ÷  s   	c         C  s   |  j  a  t j |  ƒ } | S(   s&   
    Parses the screen statement.
    (   RS   t   screen_parserR6   (   R8   R‹  (    (    s   renpy/screenlang.pyt   parse_screenX  s    	(;   t
   __future__R    t   renpy.displayRL   t
   contextlibt
   __import__R   R7   RS   R   t   contextmanagerR   R	   t   NodeVisitorR
   R   t   objectR   R   R0   R#   R$   R&   t   SentinelR`   Ra   t   stylesR*   Re   t   position_property_namesR1   t   position_propertiest   text_position_propertiest   side_position_propertiest   text_property_namest   text_propertiest   text_text_propertiest   window_propertiest   button_propertiest   bar_propertiest   box_propertiest   ui_propertiesR   Rg   R   t   atlt
   PROPERTIESRN  RP  RS  R]  Rg  Rz  R_   t   ObjectR  Rš  R¢  R£  (    (    (    s   renpy/screenlang.pyt   <module>   s  			£º	""	"						
























































































































































































	

'
=
H
%N]	