
26ic           @  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  d l j	 Z	 d  d l
 Z g  a d e f d     YZ d e f d     YZ d   Z e j d e j  Z d	   Z d
   Z d   Z d a e d d  Z d   Z e d d d d d d d d d d d d d d d d d  d! d" d# d$ d% d& g  Z d' d( d) d* d+ d, d- d. d/ d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d: g Z d; d< d= d> d? g Z d. j g  e D] Z  e j! e   ^ qe  Z" d@ Z# dA Z$ dB e f dC     YZ% e& e& dD  Z' dE   Z( dF   Z) dG   Z* dH   Z+ dI   Z, dJ   Z- dK e f dL     YZ. e.   Z/ dM   Z0 e0 d  dN    Z1 e0 d$  dO    Z2 e0 dP  dQ    Z3 e0 d  dR    Z4 e0 d  dS    Z5 e0 d  dT    Z6 e0 d  dU    Z7 e0 d   dV    Z8 e0 d"  dW    Z9 e0 dX  dY    Z: e0 d  dZ    Z; e0 d#  d[    Z< e0 d  d\    Z= e0 d]  d^    Z> e0 d_  d`    Z? e0 d&  da    Z@ e0 d  db    ZA e0 d  dc    ZB e0 dd  e& de   ZC e0 df  dg    ZD e0 dh  di    ZE e0 d  dj    ZF dk   ZG dl   ZH eI e jJ jK dm dn   ZL e0 do  dp    ZM e0 dq  dr    ZN ds   ZO e0 dt  du    ZP e0 dv  dw    ZQ e0 d  dx    ZR dy   ZS dz   ZT e d d{  ZU d|   ZV d}   ZW d S(~   i(   t   print_functionNt
   ParseErrorc           B  s#   e  Z d d e d   Z d   Z RS(   c         C  s  d t  |  | | f } | r{| j d  } t |  d k r d  }	 d }
 x |
 t | d  k  r | d |
 } | d k r |
 d 7}
 nK | |	 k r d  }	 n6 |	 r n- | d k s | d k s | d k r | }	 n  |
 d 7}
 qO W|	 r | d	 |	 7} q n  xy | D]n } | d
 | 7} | d  k	 rj| t |  k rW| d
 d | d 7} d  } qj| t |  8} n  | rPqqWn  | |  _ t j |  |  d  S(   Nu   File "%s", line %d: %ss   
i   i    s   \t   `s   't   "s:   
(Perhaps you left out a %s at the end of the first line.)s   
    t    t   ^(   t   unicode_filenamet   splitt   lent   Nonet   messaget	   Exceptiont   __init__(   t   selft   filenamet   numbert   msgt   linet   post   firstR
   t   linest   open_stringt   it   ct   l(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyR   *   s<    	$			c         C  s   |  j  S(   N(   R
   (   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   __unicode__V   s    N(   t   __name__t
   __module__R	   t   FalseR   R   (    (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyR   (   s   ,t   LineNumberHolderc           B  s   e  Z d  Z d   Z RS(   s)   
    Holds the expected line number.
    c         C  s   d |  _  d  S(   Ni    (   R   (   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyR   a   s    (   R   R   t   __doc__R   (    (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyR   \   s   c         C  sV   t  |  t  r |  Sy |  j d  SWn n Xy |  j d  SWn n X|  j d  S(   s4   
    Converts the supplied filename to unicode.
    t   mbcss   utf-8s   latin-1(   t
   isinstancet   unicodet   decode(   t   fn(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyR   e   s    s   __(\w+)|\w+| +|.c         C  sd   t  j j |   } t  j j |  d } | j d d  } d   } t j d | |  } d | d S(   Ni    R   t   _c         S  s   t  t |  j d    S(   Ni    (   t   hext   ordt   group(   t   m(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt
   munge_char   s    s   [^a-zA-Z0-9_]t   _m1_t   __(   t   ost   patht   basenamet   splitextt   replacet   ret   sub(   R#   t   rvR)   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   munge_filename   s    	c         C  s   t  j j |   }  t  j j t j j  } t  j j t j j  } |  j |  rp t  j j |  |  j	 d d  S|  j |  r t  j j |  |  j	 d d  S|  j	 d d  Sd S(   sy   
    Returns a version of fn that is either relative to the base directory,
    or relative to the Ren'Py directory.
    s   \t   /N(
   R,   R-   t   abspatht   renpyt   configt   basedirt
   renpy_baset
   startswitht   relpathR0   (   R#   R9   R:   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   elide_filename   s    c         C  sf   t  j j t j j |   } t  j j |  r1 | St  j j t j j |   } t  j j |  rb | S|  S(   N(   R,   R-   t   joinR7   R8   R9   t   exists(   R#   t   fn1t   fn2(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   unelide_filename   s    t    i   c         C  s  |  a  | r | } n+ t j |  d d  } | j   } | j   t |   }  t |   } | d 7} g  } | } d } t |  r | d d k r | d 7} n  t j	 j
   j r t j j }	 n i  }	 x#| t |  k  r| }
 d } d } |  |
 f } t j j t  |
 |  |	 | <d! } x| t |  k  r| | } | d k rYt |  | d	   n  | d
 k rW| rWt j d |  s| j |  |
 | f  n  | d! k r| } n  | d |	 | _ x" | | d d k r| d 8} qW| |	 | _ | |	 | j |	 | j !|	 | _ | |	 | j |	 | j !|	 | _ | d 7} | d 7} d! } d } Pn  | d
 k rv| d 7} d! } n  | d k r| d 7} qn  | d k r| | d d
 k r| d 7} | d 7} | d 7} qn  | d" k r| d 7} n  | d# k r| r| d 8} n  | d k rG| } x | | d
 k r@| d 7} q#Wqn  | d$ k rG| } | | 7} | d 7} t } x | t |  k  r@| | } | d
 k r| d 7} n  | d k r| d 7} qvn  | rt } | d 7} | | 7} qvn  | | k r| d 7} | | 7} Pn  | d k r&t } n  | | 7} | d 7} qvqvWqn  t j | |  } | j d  } | j d  } | rd | k r| | } n  | | 7} t |  d k rt |  |
 d d | d t  n  | j d  } qWq W| d k st |  |
 d  d | d t  n  | S(%   s  
    Reads `filename`, and divides it into logical lines.

    Returns a list of (filename, line number, line text) triples.

    If `filedata` is given, it should be a unicode string giving the file
    contents. In that case, `filename` need not exist.
    t   rs   utf-8s   

i    u   ﻿i   RC   s   	s1   Tab characters are not allowed in Ren'Py scripts.s   
s   ^\s*$s    s   s   \i   s   \
t   (t   [t   {t   }t   ]t   )t   #R   t   'R   R+   i   s:   Overly long logical line. (Check strings and parenthesis.)R   R   sB   is not terminated with a newline. (Check strings and parenthesis.)N(   RE   RF   RG   (   RH   RI   RJ   (   R   RL   R   (   t   original_filenamet   codecst   opent   readt   closeR=   R4   R   R7   t   gamet   contextt
   init_phaset
   scripteditR   t   LineR	   R   R1   t   matcht   appendt	   end_delimt   endt   startt   textt	   full_textR   t   Truet   lllwordR'   (   R   t   filedatat
   linenumbert   datat   ft   prefixR3   R   R   R   t   start_numberR   t
   parendeptht   loct   endposR   t   delimt   escapeR(   t   wordt   rest(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   list_logical_lines   s    	


	""


	
 










	


!!c           s/   d         f d     d d  d S(   sE  
    This takes as input the list of logical line triples output from
    list_logical_lines, and breaks the lines into blocks. Each block
    is represented as a list of (filename, line number, line text,
    block) triples, where block is a block list (which may be empty if
    no block is associated with this line.)
    c         S  sR   d } d } x5 t  rC |  | d k r? | d 7} | d 7} q n  Pq W| |  | f S(   Ni    R   i   (   R^   (   R   t   deptht   index(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   depth_splitu  s    	

c   
        s   g  } d  } x |  t   k  r  |  \ } } }   |  \ } } | | k  rV Pn  | d  k rk | } n  | | k r t | | d   n  |  d 7}   |  | d  \ }	 }  | j | | | |	 f  q W| |  f S(   Ns   indentation mismatch.i   (   R	   R   R   RX   (
   R   t	   min_depthR3   Rn   R   R   R\   t
   line_depthRl   t   block(   Rp   t   gll_coreR   (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyRt     s    	
i    (    (   R   (    (   Rp   Rt   R   s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   group_logical_linesk  s    
	t   $t   ast   att   behindt   callt
   expressiont   hidet   ift   int   imaget   initt   jumpt   menut   onlayert   pythont   returnt   scenet   sett   showt   witht   whilet   zordert	   transformt   <s   <=t   >s   >=s   <>s   !=s   ==t   |R   t   &s   <<s   >>t   +t   -t   *R5   s   //t   %t   ~s   **s   \bor\bs   \band\bs   \bnot\bs   \bin\bs   \bis\bu"   [a-zA-Z_ -�][0-9a-zA-Z_ -�]*u'   [-0-9a-zA-Z_ -�][-0-9a-zA-Z_ -�]*t   Lexerc           B  s^  e  Z d  Z e d d% d  Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d	   Z d
   Z d   Z d   Z e d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z e d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z e d  Z  d   Z! d   Z" d    Z# d!   Z$ d% d"  Z% d#   Z& d$   Z' RS(&   s   
    The lexer that is used to lex script files. This works on the idea
    that we want to lex each line in a block individually, and use
    sub-lexers to lex sub-blocks.
    i    c         C  s   | |  _  | |  _ | |  _ t |  _ d |  _ d |  _ d |  _ d |  _ g  |  _	 | |  _
 d |  _ d |  _ d |  _ d |  _ d  S(   NiRC   i    (   R   t   init_offsetRs   R   t   eobR   R   R\   R   t   subblockt   global_labelR   t   word_cache_post   word_cache_newpost
   word_cache(   R   Rs   R   R   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyR     s    													c         C  sr   |  j  d 7_  |  j  t |  j  k r4 t |  _ t S|  j |  j  \ |  _ |  _ |  _ |  _	 d |  _
 d |  _ t S(   s'  
        Advances this lexer to the next line in the block. The lexer
        starts off before the first line, so advance must be called
        before any matching can be done. Returns True if we've
        successfully advanced to a line in the block, or False if we
        have advanced beyond all lines in the block. In general, once
        this method has returned False, the lexer is in an undefined
        state, and it doesn't make sense to call any method other than
        advance (which will always return False) on the lexer.
        i   i    i(   R   R   Rs   R^   R   R   R   R   R\   R   R   R   (   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   advance  s    	(		c         C  sv   |  j  r d S|  j t |  j  k r) d St j | t j  j |  j |  j  } | sZ d S| j	   |  _ | j
 d  S(   s  
        Tries to match the given regexp at the current location on the
        current line. If it succeds, it returns the matched text (if
        any), and updates the current position to be after the
        match. Otherwise, returns None and the position is unchanged.
        i    N(   R   R	   R   R   R\   R1   t   compilet   DOTALLRW   RZ   R'   (   R   t   regexpR(   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   match_regexp'  s    	'c         C  s   |  j  d  d S(   sQ   
        Advances the current position beyond any contiguous whitespace.
        u   (\s+|\\\n)+N(   R   (   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   skip_whitespace>  s    c         C  s   |  j    |  j |  S(   s   
        Matches something at the current position, skipping past
        whitespace. Even if we can't match, the current position is
        still skipped past the leading whitespace.
        (   R   R   (   R   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyRW   G  s    
c         C  s,   |  j  } |  j   | k r | S| |  _  d S(   s   
        Matches a keyword at the current position. A keyword is a word
        that is surrounded by things that aren't words, like
        whitespace. (This prevents a keyword from matching a prefix.)
        RC   (   R   Rk   (   R   Rk   t   oldpos(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   keywordQ  s
    		c         C  s(   t  |  j |  j | |  j |  j   d S(   sc   
        Convenience function for reporting a parse error at the current
        location.
        N(   R   R   R   R\   R   (   R   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   error_  s    c         C  s    |  j    |  j t |  j  k S(   s   
        Returns True if, after skipping whitespace, the current
        position is at the end of the end of the current line, or
        False otherwise.
        (   R   R   R   R\   (   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   eolg  s    
c         C  s    |  j    s |  j d  n  d S(   sG   
        If we are not at the end of the line, raise an error.
        s   end of line expected.N(   R   R   (   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt
   expect_eolq  s    c         C  s7   |  j  r3 |  j   } | j   | j d |  n  d S(   sz   
        Called to indicate this statement does not expect a block.
        If a block is found, raises an error.
        so   Line is indented, but the preceding %s statement does not expect a block. Please check this line's indentation.N(   R   t   subblock_lexerR   R   (   R   t   stmtt   ll(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   expect_noblocky  s    	
c         C  s!   |  j  s |  j d |  n  d S(   sk   
        Called to indicate that the statement requires that a non-empty
        block is present.
        s   %s expects a non-empty block.N(   R   R   (   R   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   expect_block  s    	c         C  s4   |  j  p | } t |  j d | d |  j d |  j S(   sk   
        Returns a new lexer object, equiped to parse the block
        associated with this line.
        R   R   R   (   R   R   R   R   R   (   R   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyR     s    c         C  s(  |  j  d  } | d k r- |  j  d  } n  | d k rK |  j  d  } n  | d k r[ d S| d d k r~ t } | d } n t } | d d !} | s$t j d d	 |  } | j d
 d  } | j d d  } | j d d  } | j d d  } t j d d   |  } t j d d |  } n  | S(   s'  
        Lexes a string, and returns the string to the user, or none if
        no string could be found. This also takes care of expanding
        escapes and collapsing whitespace.

        Be a little careful, as this can return an empty string, which is
        different than None.
        s   r?"([^\\"]|\\.)*"s   r?'([^\\']|\\.)*'s   r?`([^\\`]|\\.)*`i    RD   i   is   \s+R   s   \ns   
s   \{s   {{s   \[s   [[s   \%s   %%s   \\u([0-9a-fA-F]{1,4})c         S  s   t  t |  j d  d   S(   Ni   i   (   t   unichrt   intR'   (   R(   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   <lambda>  s    s   \\(.)s   \1N(   RW   R	   R^   R   R1   R2   R0   (   R   t   st   raw(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   string  s,    
	c         C  s   |  j  d  S(   sf   
        Tries to parse an integer. Returns a string containing the
        integer, or None.
        s   (\+|\-)?\d+(   RW   (   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   integer  s    c         C  s   |  j  d  S(   sk   
        Tries to parse a number (float). Returns a string containing the
        number, or None.
        s(   (\+|\-)?(\d+\.?\d*|\.\d+)([eE][-+]?\d+)?(   RW   (   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   float  s    c         C  s   |  j  d  S(   sG   
        Matches the characters in an md5 hash, and then some.
        s   \w+(   RW   (   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   hash  s    c         C  sY   |  j  |  j k r% |  j |  _  |  j S|  j  |  _ |  j t  } | |  _ |  j  |  _ | S(   s?   
        Parses a name, which may be a keyword or not.
        (   R   R   R   R   RW   t   word_regexp(   R   R3   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyRk     s    	c         C  s2   |  j  } |  j   } | t k r. | |  _  d S| S(   sG   
        This tries to parse a name. Returns the name or None.
        N(   R   Rk   t   KEYWORDSR	   (   R   R   R3   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   name  s    		c         C  s3   | r/ | d d k r/ | j  d  d |  _ n  d S(   s   
        Set current global_label, which is used for label_name calculations.
        label can be any valid label or None, but this has only effect if label
        has global part.
        i    t   .N(   R   R   (   R   t   label(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   set_global_label  s    c         C  s   |  j  } d } |  j   } | ss |  j d  s; |  j rH | |  _  d S|  j } |  j   } | s | |  _  d SnS |  j d  r | r | |  j k r | |  _  d S|  j   } | s | |  _  d Sn  | s | S| d | S(   s  
        Try to parse label name. Returns name in form of "global.local" if local
        is present, "global" otherwise; or None if it doesn't parse.

        If declare is True, allow only such names that are valid for declaration
        (e.g. forbid global name mismatch)
        s   \.R   N(   R   R	   R   RW   R   (   R   t   declaret   old_post
   local_namet   global_name(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt
   label_name  s.    							c         C  s   |  j  d t  S(   s>   
        Same as label_name, but set declare to True.
        R   (   R   R^   (   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   label_name_declare*  s    c         C  s5   |  j  } |  j t  } | t k r1 | |  _  d S| S(   s   
        Matches a word that is a component of an image name. (These are
        strings of numbers, letters, and underscores.)
        N(   R   RW   t   image_word_regexpR   R	   (   R   R   R3   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   image_name_component0  s    		c         C  s7  |  j    r t S|  j |  j } | d k r |  j d 7_ |  j t |  j  k rf |  j d 8_ t S|  j |  j } | d k r |  j d 8_ t Sn | d k r t S| } xs t r#|  j d 7_ |  j    r |  j d  n  |  j |  j } | | k rPn  | d k r |  j d 7_ q q W|  j d 7_ t S(	   s   
        This tries to match a python string at the current
        location. If it matches, it returns True, and the current
        position is updated to the end of the string. Otherwise,
        returns False.
        t   ui   R   RL   s)   end of line reached while parsing string.s   \(   R   RL   (   R   RL   (   R   R   R\   R   R   R^   R   (   R   R   Ri   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   python_string?  s4    	c         C  s`   |  j    } | s d SxC |  j d  r[ |  j    } | sJ |  j d  n  | d | 7} q W| S(   sQ  
        This tries to match a dotted name, which is one or more names,
        separated by dots. Returns the dotted name if it can, or None
        if it cannot.

        Once this sees the first name, it commits to parsing a
        dotted_name. It will report an error if it then sees a dot
        without a name behind it.
        s   \.s   expecting name.R   N(   R   R	   RW   R   (   R   R3   t   n(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   dotted_namep  s    c         C  s   |  j  } x |  j   s |  j |  j  } | | k r] t j j |  j | |  j  !|  j |  j  S| d k ry |  j   q n  |  j	   r q n  |  j  d 7_  q W|  j
 d |  d S(   s#  
        This matches python code up to, but not including, the non-whitespace
        delimiter characters. Returns a string containing the matched code,
        which may be empty if the first thing is the delimiter. Raises an
        error if EOL is reached before the delimiter.
        s   '"i   s(   reached end of line when expecting '%s'.N(   R   R   R\   R7   t   astt   PyExprR   R   R   t   parenthesised_pythonR   (   R   Ri   R[   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   delimited_python  s    	)
c         C  sM   |  j  d  } | s% |  j d  n  t j j | j   | j | j  } | S(   sk   
        Returns a python expression, which is arbitrary python code
        extending to a colon.
        t   :s   expected python_expression(   R   R   R7   R   R   t   stripR   Ra   (   R   t   peR3   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   python_expression  s
    $c         C  s   |  j  |  j } | d k rK |  j d 7_ |  j d  |  j d 7_ t S| d k r |  j d 7_ |  j d  |  j d 7_ t S| d k r |  j d 7_ |  j d  |  j d 7_ t St S(   s   
        Tries to match a parenthesised python expression. If it can,
        returns true and updates the current position to be after the
        closing parenthesis. Returns False otherwise.
        RE   i   RJ   RF   RI   RG   RH   (   R\   R   R   R^   R   (   R   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyR     s"    c         C  sd  |  j  } xt rx |  j t  r' q W|  j   r8 Pn  |  j   pe |  j   pe |  j   pe |  j   sl Pn  xn t r |  j	   |  j   r Pn  |  j d  r |  j
   } | so |  j d  qo qo n  |  j   r qo n  Pqo W|  j t  r q n  | r|  j d  rq n  Pq W|  j | |  j  !j   } | s5d St j j |  j | |  j  !j   |  j |  j  S(   so   
        Tries to parse a simple_expression. Returns the text if it can, or
        None if it cannot.
        s   \.s   expecting name after dot.t   ,N(   R   R^   RW   t   operator_regexpR   R   R   R   R   R   Rk   R   R\   R   R	   R7   R   R   R   R   (   R   t   commaR[   R   R\   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   simple_expression  s@    			
c         C  s   |  j  d t  S(   st   
        One or more simple expressions, separated by commas, including an
        optional trailing comma.
        R   (   R   R^   (   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   comma_expression  s    c         C  s(   |  j  |  j |  j |  j |  j |  j f S(   s   
        Returns an opaque representation of the lexer state. This can be
        passed to revert to back the lexer up.
        (   R   R   R   R\   R   R   (   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt
   checkpoint  s    c         C  s7   | \ |  _  |  _ |  _ |  _ |  _ |  _ d |  _ d S(   s   
        Reverts the lexer to the given state. State must have been returned
        by a previous checkpoint operation on this lexer.
        iN(   R   R   R   R\   R   R   R   (   R   t   state(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   revert  s    *c         C  s   |  j  |  j f S(   s   
        Returns a (filename, line number) tuple representing the current
        physical location of the start of the current logical line.
        (   R   R   (   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   get_location'  s    c         C  sl   t  | t  r- | p | } |  j |  } n | p< | j j } |   } | d k rh |  j d |  n  | S(   s   
        Tries to parse thing, and reports an error if it cannot be done.

        If thing is a string, tries to parse it using
        self.match(thing). Otherwise, thing must be a method on this lexer
        object, which is called directly.
        s   expected '%s' not found.N(   R    t   strRW   t   im_funct	   func_nameR	   R   (   R   t   thingR   R3   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   require/  s    		c         C  sN   |  j    |  j } t |  j  |  _ t j j |  j | j   |  j |  j	  S(   s   
        Skips whitespace, then returns the rest of the current
        line, and advances the current position to the end of
        the current line.
        (
   R   R   R   R\   R7   R   R   R   R   R   (   R   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyRl   D  s    
	c           sM   g   t      |  j   _     f d     |  j d  d j   S(   s   
        Returns the subblock of this code, and subblocks of that
        subblock, as indented python code. This tries to insert
        whitespace to ensure line numbers match up.
        c           s   x |  D] \ } } } } x3   j  | k  rN  j | d    j  d 7_  q W| | d }  j |    j  | j d  7_   | | d  q Wd  S(   Ns   
i   s       (   R   RX   t   count(   Rs   t   indentt   _fnt   lnR\   R   t   linetext(   t   ot   processR3   (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyR   ]  s    RC   (   R   R   R   R   R>   (   R   (    (   R   R   R3   s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   python_blockQ  s    	N((   R   R   R   R   R	   R   R   R   R   RW   R   R   R   R   R   R   R   R   R   R   R   Rk   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   Rl   R   (    (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyR     sH   					
			
				
	-							(			1				=						c   	      C  s;  |  j    g } |  j |  j  g } xP t rv | j |  j     |  j   } | s` | j   Pn  | j | j    q' W| r | j |  j     |  j   } | d k	 r | j t	 |   q | j   n  | r1x] t
 | |  D]I \ } } | r | d d k r |  j |  |  j   |  j d  q q Wn  t |  S(   so   
    This parses an image name, and returns it as a tuple. It requires
    that the image name be present.
    i    R   s/   image name components may not begin with a '-'.N(   R   R   R   R^   RX   t   popR   R   R	   R!   t   zipR   R   R   t   tuple(	   R   R   t   nodasht   pointsR3   R   R   R   t   p(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   parse_image_namep  s,    	

c         C  s\   |  j  |  j  g } x@ t rW |  j d  s1 Pn  |  j   } | sG Pn  | j |  q W| S(   s   
    This parses a comma-separated list of simple_expressions, and
    returns a list of strings. It requires at least one
    simple_expression be present.
    R   (   R   R   R^   RW   RX   (   R   R3   t   e(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   parse_simple_expression_list  s    	c   	      C  s  d } d } g  } d } g  } |  j d  s< |  j d  r` |  j |  j  } | j   f } n t |  t  } d } xit r|  j d  r | r |  j d  qx |  j |  j  } qx n  |  j d  r | r |  j d  qx t	 |   } qx n  |  j d  r/| r|  j d  qx |  j |  j  } qx n  |  j d	  rr| d k	 rZ|  j d
  qx |  j |  j  } qx n  |  j d  r| r|  j d  n  x< t r|  j |  j  } | j
 |  |  j d  sPqqWqx n  Pqx W| | | | | | | f S(   s)   
    This parses an image specifier.
    R{   R   R   s(   multiple onlayer clauses are prohibited.Rx   s#   multiple at clauses are prohibited.Rw   s#   multiple as clauses are prohibited.R   s'   multiple zorder clauses are prohibited.Ry   s'   multiple behind clauses are prohibited.R   N(   R	   R   R   R   R   R   R^   R   R   R   RX   RW   (	   R   t   tagt   layert   at_listR   Ry   R{   t
   image_namet   bhtag(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   parse_image_specifier  sT    		c         C  sY   |  j    } |  j d  s | S|  j |  j  } t j | d |  | t j | |  g S(   s   
    Tries to parse the with clause associated with this statement. If
    one exists, then the node is wrapped in a list with the
    appropriate pair of With nodes. Otherwise, just returns the
    statement by itself.
    R   R	   (   R   R   R   R   R   t   With(   R   t   nodeRg   t   expr(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt
   parse_with  s    c         C  s%  |  j    } t } t } t } d  } d  } d  } d  }	 g  }
 | j   xo| j s| j d  r | j | j  } | j   | j	 d  | j   qI n  | j d  r | j | j  } | j   | j	 d  | j   qI n  | j
   } | j   } | j   } | d  k	 r| d  k	 r| j   | j	 d  | rK| j d  n  | ra| j d  n  t } | } | }	 | j   qI n  | j |  | j   } | d  k r| j d  n  | j   r.| j r| j d	  n  | r| r| j d
  n  | rt } n  |
 j | d d  f  | j   qI n  t } d } | j d  r^| j | j  } n  | j d  | j   | j d  t | j     } |
 j | | | f  | j   qI W| s|  j d  n  g  } | r| j t j | | |	 d  d t  n  | j t j | |
 | |   | S(   NR   s   with clauseR   s   set menuitems   say menuitems:   Say menuitems and captions may not exist in the same menu.s)   Only one say menuitem may exist per menu.s   expected menuitemsl   Line is followed by a block, despite not being a menu choice. Did you forget a colon at the end of the line?s:   Captions and say menuitems may not exist in the same menu.R^   R}   R   s   choice menuitems"   Menu does not contain any choices.t   interact(   R   R   R	   R   R   R   R   R   R   R   R   R   R   R^   R   R   R   RX   R   R   t   parse_blockR   t   Sayt   Menu(   t   stmtlRg   R   t
   has_choicet   has_sayt   has_captiont   with_R   t   say_whot   say_whatt   itemsR   t   whot   whatR   t	   conditionRs   R3   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt
   parse_menu  s    






		

(c   	      C  s  g  } g  } d  } d  } t } t   } |  j d  s: d  Sxt r|  j d  rV Pn  |  j d  r | d  k	 r |  j d  n  |  j |  j  } | | k r |  j d |  n  | j |  n|  j d  r9| s |  j d  n  t } |  j   } | d  k	 r| | k r&|  j d |  n  | j |  qn |  j |  j  } | | k rk|  j d |  n  | j |  |  j d  r|  j	   |  j
 d	  } n d  } | j | | f  | r| j |  n  |  j d  rPn  |  j d
  q= Wt j j | | | |  S(   Ns   \(s   \)s   \*\*s&   a label may have only one ** parameters   parameter %s appears twice.s   \*s%   a label may have only one * parametert   =s   ),R   (   R	   R^   R   RW   R   R   R   t   addR   R   R   RX   R7   R   t   ParameterInfo(	   R   t
   parameterst
   positionalt   extrapost   extrakwt   add_positionalt   namesR   t   default(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   parse_parameters  sT    		
c         C  s^  g  } d
 } d
 } |  j d  s% d
 Sx t rG|  j d  rA Pn  |  j d  r~ | d
 k	 rl |  j d  n  |  j d  } n |  j d  r | d
 k	 r |  j d  n  |  j d  } ni |  j   } |  j   } | o |  j d  s |  j |  d
 } n  |  j   | j	 | |  j d  f  |  j d  r7Pn  |  j
 d	  q( Wt j j | | |  S(   s7   
    Parse a list of arguments, if one is present.
    s   \(s   \)s   \*\*s$   a call may have only one ** arguments   ),s   \*s#   a call may have only one * argumentR
  R   N(   R	   RW   R^   R   R   R   R   R   R   RX   R   R7   R   t   ArgumentInfo(   R   t	   argumentsR  R  R   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   parse_arguments  s6    		
t	   ParseTriec           B  s)   e  Z d  Z d   Z d   Z d   Z RS(   sI   
    This is a trie of words, that's used to pick a parser function.
    c         C  s   d  |  _ i  |  _ d  S(   N(   R	   R  t   words(   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyR     s    	c         C  sd   | s | |  _  d  S| d } | d } | |  j k rI t   |  j | <n  |  j | j | |  d  S(   Ni    i   (   R  R  R  R  (   R   R   t   functionR   Rl   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyR    s    	

c         C  sW   | j  } | j   p! | j d  } | |  j k rC | | _  |  j S|  j | j |  S(   Ns   \$(   R   Rk   RW   R  R  t   parse(   R   R   R   Rk   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyR    s    		(   R   R   R   R   R  R  (    (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyR    s   		c           s     j        f d   } | S(   s   
    A function decorator used to declare a statement. Keywords is a string
    giving the keywords that precede the statement.
    c           s   t  j   |   |  S(   N(   t
   statementsR  (   Rc   (   t   keywords(    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   wrap1  s    (   R   (   R  R  (    (   R  s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt	   statement)  s    c         C  s[  g  } |  j  |  j  } |  j  d  |  j   |  j d  t |  j    } | j | | f  |  j   xx |  j d  r |  j  |  j  } |  j  d  |  j   |  j d  t |  j    } | j | | f  |  j   qn W|  j d  rK|  j  d  |  j   |  j d  t |  j    } | j d | f  |  j   n  t	 j
 | |  S(   NR   s   if statementt   elifs   elif clauset   elses   else clauseR^   (   R   R   R   R   R   R   RX   R   R   R   t   If(   R   Rg   t   entriesR  Rs   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   if_statement;  s0    



c         C  se   |  j  |  j  } |  j  d  |  j   |  j d  t |  j    } |  j   t j | | |  S(   NR   s   while statement(	   R   R   R   R   R   R   R   R   t   While(   R   Rg   R  Rs   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   while_statementf  s    

t   passc         C  s.   |  j  d  |  j   |  j   t j |  S(   Ns   pass statement(   R   R   R   R   t   Pass(   R   Rg   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   pass_statementr  s    

c         C  s   |  j  d  |  j   } |  j |  |  j d  |  j   t |  |  } |  j   g  } | r | j t j	 | | g  d    n  | j |  | S(   Ns   menu statementR   (   R   R   R   R   R   R	  R   RX   R   t   LabelR	   t   extend(   R   Rg   R   R   R3   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   menu_statement{  s    

"c         C  sL   |  j  d  |  j   } | s( d  } n  |  j   |  j   t j | |  S(   Ns   return statement(   R   Rl   R	   R   R   R   t   Return(   R   Rg   Rl   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   return_statement  s    	

c         C  sv   |  j  d  |  j d  r7 t } |  j |  j  } n t } |  j |  j  } |  j   |  j   t	 j
 | | |  S(   Ns   jump statementR{   (   R   R   R^   R   R   R   R   R   R   R   t   Jump(   R   Rg   R{   t   target(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   jump_statement  s    

c         C  sq  |  j  d  |  j d  r7 t } |  j |  j  } n t } |  j |  j  } |  j d  t |   } t j	 | | | |  g } |  j d  r |  j |  j
  } |  j |  | j t j | | g  d    np t j j rC| t j j k rC| rt j j d t t j j | j  qCt j j | t t j j | j  n  | j t j |   |  j   |  j   | S(   Ns   call statmentR{   R'  t   from(   R   R   R^   R   R   R   R   R  R   t   CallR   R   RX   R*  R	   R7   RU   R   t   add_fromt   report_missingRM   RZ   R(  R   R   (   R   Rg   R{   R0  R  R3   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   call_statement  s*    "&&

c         C  s   |  j  d  r$ |  j |  j  } n d } |  j   rS |  j   t j | d  |  St |   } t j | | | d  } t	 |  |  } |  j
 d  r t j j |  j    | _ n |  j d  |  j   |  j   | S(   NR   t   masteri   R   s   scene statement(   R   R   R   R   R   R   t   SceneR	   R   R   RW   R7   t   atlt	   parse_atlR   R   R   (   R   Rg   R   t   imspecR   R3   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   scene_statement  s    


c         C  s   t  |   } t j | |  } t |  |  } |  j d  rZ t j j |  j    | _ n |  j	 d  |  j
   |  j   | S(   NR   s   show statement(   R   R   t   ShowR   RW   R7   R9  R:  R   R   R   R   (   R   Rg   R;  R   R3   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   show_statement  s    

s
   show layerc         C  s   |  j  |  j  } |  j d  r0 t |   } n g  } |  j d  r` t j j |  j    } n d  } |  j
 d  |  j   |  j   t j | | | |  } | S(   NRx   R   s   show layer statement(   R   R   R   R   RW   R7   R9  R:  R   R	   R   R   R   R   t	   ShowLayer(   R   Rg   R   R   R9  R3   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   show_layer_statement  s    

c         C  sL   t  |   } t |  t j | |   } |  j   |  j d  |  j   | S(   Ns   hide statement(   R   R   R   t   HideR   R   R   (   R   Rg   R;  R3   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   hide_statement  s    

c         C  sC   |  j  |  j  } |  j   |  j d  |  j   t j | |  S(   Ns   with statement(   R   R   R   R   R   R   R   (   R   Rg   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   with_statement'  s
    

c         C  s   t  |  d t } |  j d  rL |  j   d  } t j j |  j    } nB |  j	 d  |  j
   } | s{ |  j d  n  d  } |  j d  t j | | | |  } |  j s t j | | g d |  j  } n  |  j   | S(   NR   R   R
  s   expected expressions   image statementi  (   R   R^   RW   R   R	   R7   R9  R:  R   R   Rl   R   R   R   t   ImageR   t   InitR   R   (   R   Rg   R   R   R9  R3   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   image_statement1  s     
	"
t   definec         C  s  |  j    } | r! t |  } n d } d } |  j |  j  } x3 |  j d  rt | d | } |  j |  j  } qB W|  j d  |  j   } | s |  j d  n  |  j d  t j	 | | | |  } |  j
 s t j | | g | |  j  } n  |  j   | S(   Ni    t   stores   \.R   R
  s   expected expressions   define statement(   R   R   R   Rk   RW   Rl   R   R   R   t   DefineR   RE  R   R   (   R   Rg   t   priorityRH  R   R   R3   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   define_statementN  s&    	"
R  c         C  s  |  j    } | r! t |  } n d } d } |  j |  j  } x3 |  j d  rt | d | } |  j |  j  } qB W|  j d  |  j   } | s |  j d  n  |  j d  t j	 | | | |  } |  j
 s t j | | g | |  j  } n  |  j   | S(   Ni    RH  s   \.R   R
  s   expected expressions   default statement(   R   R   R   Rk   RW   Rl   R   R   R   t   DefaultR   RE  R   R   (   R   Rg   RJ  RH  R   R   R3   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   default_statementp  s&    	"
c         C  s   |  j    } | r! t |  } n d } |  j |  j  } t |   } | rm | j s] | j rm |  j d  n  |  j d  |  j   t	 j
 j |  j    } t j | | | |  } |  j s t j | | g | |  j  } n  |  j   | S(   Ni    sA   transform statement does not take a variable number of parametersR   (   R   R   R   R   R  R  R  R   R   R7   R9  R:  R   R   t	   TransformR   RE  R   R   (   R   Rg   RJ  R   R  R9  R3   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   transform_statement  s     
	"
c         C  sO   |  j    } | s" |  j d  n  |  j d  |  j   t j | | d d S(   Ns   expected python codes   one-line python statementRH  (   Rl   R   R   R   R   t   Python(   R   Rg   t   python_code(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   one_line_python  s    
c         C  s   t  } t  } d } |  j d  r* t } n  |  j d  rB t } n  |  j d  rj d |  j |  j  } n  |  j d  |  j d  |  j   } |  j   | r t j	 | | | d | St j
 | | | d | Sd  S(   NRH  t   earlyR|   R~   s   store.R   s   python block(   R   R   R^   R   R   R   R   R   R   t   EarlyPythonRP  (   R   Rg   R|   RS  RH  RQ  (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   python_statement  s     		
R   c         C  s   |  j  |  j  } |  j |  t |   } |  j d  rC t } n t } |  j  d  |  j   t |  j	 |   } |  j
   t j | | | | d | S(   NR|   R   (   R   R   R   R  R   R^   R   R   R   R   R   R   R*  (   R   Rg   R   R   R  R|   Rs   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   label_statement  s    	

s   init offsetc         C  sS   |  j  d  |  j  |  j  } |  j   |  j d  |  j   t |  |  _ g  S(   NR
  s   init offset statement(   R   R   R   R   R   R   R   (   R   Rg   t   offset(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   init_offset_statement  s    

s
   init labelc         C  s   t  |  | d t S(   NR   (   RV  R^   (   R   Rg   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   init_label_statement  s    c         C  s   |  j    } | r! t |  } n d } |  j d  ro |  j   |  j d  t |  j t   } |  j   n2 z% |  j	 } t |  _	 t
 |   g } Wd  | |  _	 Xt j | | | |  j  S(   Ni    R   s   init statement(   R   R   RW   R   R   R   R   R^   R   R   t   parse_statementR   RE  R   (   R   Rg   R   RJ  Rs   t   old_init(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   init_statement  s    
		
c         C  sg   t  j j |   } |  j   | s& g  St j | |  } |  j sc t j | | g d |  j  } n  | S(   Ni(	   R7   t
   screenlangt   parse_screenR   R   t   ScreenR   RE  R   (   R   Rg   t   screenR3   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   screen1_statement$  s    
	"c         C  sc   t  j j j |  |  } |  j   t j | |  } |  j s_ t j | | g d |  j	  } n  | S(   Ni(
   R7   t   sl2t   slparserR^  R   R   R_  R   RE  R   (   R   Rg   R`  R3   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   screen2_statement7  s    
	"t   RENPY_SCREEN_LANGUAGEt   2R`  c         C  sp   t  } |  j   } | d  k	 r- t |  } n  | d k rF t |  |  S| d k r_ t |  |  S|  j d  d  S(   Ni   i   s   Bad screen language version.(   t   default_screen_languageR   R	   R   Ra  Rd  R   (   R   Rg   t   screen_languaget   slver(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   screen_statementJ  s    t   testcasec         C  s   |  j  |  j  } |  j  d  |  j   |  j d  t j j j |  j   |  } |  j	   t
 j | | |  } |  j s t
 j | | g d |  j  } n  | S(   NR   s   testcase statementi  (   R   R   R   R   R7   t   testt
   testparserR   R   R   R   t   TestcaseR   RE  R   (   R   Rg   R   Rl  R3   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   testcase_statement[  s    

	"c   	        s  | j  d  | j   | j d  | j     g  } d  } d  }   f d   } x   j   rE  j d  r | d  k	 r   j d  n    j   } |   j	    } qT   j d  r5| d  k r   j d  n    j   } |   j	    } | j
 t j j | | | | |   d  } d  } d  } d  } qT   j d  qT W| r\  j d	  n  | j   | j rs| St j |  | | j  S(
   NR   s   translate strings statementc           s?   |  j    }  d |  }  y t |   SWn   j d  n Xd  S(   NR   s   could not parse string(   R   t   evalR   (   R   (   R   (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   parse_stringz  s    
t   olds(   previous string is missing a translationt   news   no string to translates   unknown statements%   final string is missing a translation(   R   R   R   R   R	   R   R   R   R   Rl   RX   R7   R   t   TranslateStringR   RE  R   (	   t   init_loct   languageR   Rs   Rr  Rg   Rq  t   newlocRs  (    (   R   s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   translate_stringsn  s>    
	%	
	t	   translatec         C  sn  |  j  |  j  } | d k r' d  } n  |  j  |  j  } | d k rU t | | |   S| d k r z> |  j } t |  _ t |  |  g } t j	 | | |  g SWd  | |  _ XnZ | d k r	z> |  j } t |  _ t
 |  |  g } t j | | |  g SWd  | |  _ Xn  |  j  d  |  j   |  j d  t |  j    } |  j   t j | | | |  t j |  g S(   NR	   t   stringsR   t   styleR   s   translate statement(   R   R   R	   R   Rx  R   R^   RU  R   t   TranslateEarlyBlockt   style_statementt   TranslateBlockR   R   R   R   R   t	   Translatet   EndTranslate(   R   Rg   Rv  t
   identifierR[  Rs   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   translate_statement  s4    					

R{  c           s   |  j  |  j  } d    t j | |      f d   } x | |   rN q? W|  j d  sx |  j d  |  j   nS |  j d  |  j   |  j	   } x- | j
   r x | |  r q W| j   q W|  j s t j |  g |  j   n  |  j
    S(   Nc           s  |  j  d  rD   d  k	 r+ |  j d  n  |  j |  j   _ t S|  j  d  r` t  _ t S|  j  d  r  j d  k	 r |  j d  n  |  j |  j	   _ t S|  j  d  r|  j |  j	  } | t
 j j k r |  j d |  n   j j |  t S|  j  d  rI j d  k	 r0|  j d	  n  |  j |  j   _ t S|  j	   } | d  k	 r| d
 k r| t
 j j k r|  j d |  n  |  j k r|  j d |  n  |  j |  j   j | <t St S(   Nt   iss   parent clause appears twice.t   cleart   takes   take clause appears twice.t   dels   style property %s is not known.t   variants   variant clause appears twice.t
   propertiess    style property %s appears twice.(   R   R	   R   R   Rk   t   parentR^   R  R  R   R7   R{  t   prefixed_all_propertiest   delattrRX   R  R   R  R   (   R   t   propname(   R  R3   (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   parse_clause  sB    	R   s   style statement(   R   Rk   R	   R   t   StyleRW   R   R   R   R   R   R   RE  R   (   R   Rg   R   R  R   (    (   R  R3   s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyR}    s(    4
	
c   
   	   C  s  |  j    } |  j   } |  j d  r< |  j |  j  } n d  } | d  k	 r |  j   r |  j d  |  j   t	 j
 | d  | |  S|  j |  |  j   } g  } xU t r |  j d  } | s d } n  |  j   } | d  k r Pn  | j | |  q W| rt |  } n d  } |  j   } |  j d  r=t }	 n t }	 |  j d  rg|  j |  j  } n d  } | r| d  k	 r|  j   |  j d  |  j   t	 j
 | | | | d | d |	 S|  j d  d  S(	   NR   s   say statementR   RC   t
   nointeractt
   attributesR   s   expected statement.(   R   R   R   R   R   R	   R   R   R   R   R   R   R^   RW   R   RX   R   R   R   R   (
   R   Rg   R   R  R  R  R  Rd   t	   componentR   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   say_statement1	  sH    
			

"c         C  sD   |  j    } t j |   } | d k r7 |  j d  n  | |  |  S(   sR  
    This parses a Ren'Py statement. l is expected to be a Ren'Py lexer
    that has been advanced to a logical line. This function will
    advance l beyond the last logical line making up the current
    statement, and will return an AST object representing this
    statement, or a list of AST objects representing this statement.
    s   expected statement.N(   R   R  R  R	   R   (   R   Rg   t   pf(    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyRZ  t	  s
    
c         C  s   |  j    g  } xy |  j s y< t |   } t | t  rJ | j |  n | j |  Wq t k
 r } t j | j	  |  j    q Xq W| S(   s   
    This parses a block of Ren'Py statements. It returns a list of the
    statements contained within the block. l is a new Lexer object, for
    this block.
    (
   R   R   RZ  R    t   listR+  RX   R   t   parse_errorsR
   (   R   R3   R   R   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyR   	  s    
c         C  s   d |  d t  j _ y" t |  | |  } t |  } Wn$ t k
 r\ } t j | j  d SXt
 |  } t |  } t r d S| r | j t j | d j | d j f d   n  | S(   sK  
    Parses a Ren'Py script contained within the file `fn`.

    Returns a list of AST objects representing the statements that were found
    at the top level of the file.

    If `filedata` is given, it should be a unicode string giving the file
    contents.

    If `linenumber` is given, the parse starts at `linenumber`.
    s   While parsing R   iN(   R7   RR   t   exception_infoRm   Ru   R   R  RX   R
   R	   R   R   R   R-  R   Ra   (   R#   R`   Ra   R   t   nestedR   R   R3   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyR  	  s    0c          C  s   t  }  g  a  |  S(   N(   R  (   R3   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   get_parse_errors	  s    c          C  sa  t  s
 t Sd }  t j j d d  \ } } | j t j  t d d | t d d | t d |  xm t  D]e } |  | 7}  |  d 7}  y | j	 d  } Wn n Xt   t d |  t |  t | d | qo Wt d |  t d	 t j
 d | | j   t j j j |  |  y8 t j j j d
 k rRt j j | g d d d n  Wn n Xt S(   NRC   s
   errors.txtt   wsF   I'm sorry, but errors were detected in your script. Please correct thet   files#   errors listed below, and try again.s   

s   utf-8s   Ren'Py Version:t   runi   t	   transient(   R  R   R7   R   t   open_error_filet   writeRN   t   BOM_UTF8t   printt   encodet   versionRQ   t   displayt   report_parse_errorsRR   t   argst   commandt   exportst   launch_editorR^   (   R]   Rc   t   error_fnR   (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyR  	  s:    



#(X   t
   __future__R    RN   R1   R,   t   renpy.displayR7   t
   renpy.testt	   renpy.astR   t	   renpy.sl2R  R   R   t   objectR   R   R   t   SR_   R4   R=   RB   RM   R	   Rm   Ru   R   R   t	   OPERATORSt   ESCAPED_OPERATORSR>   R   Rj   R   R   R   R   R   R   R   R   R   R	  R  R  R  R  R  R$  R&  R)  R,  R.  R1  R6  R<  R>  R@  RB  RC  RF  RK  RM  RO  RR  RU  RV  RX  RY  R\  Ra  Rd  R   t   environt   getRg  Rj  Ro  Rx  R  R}  R  RZ  R   R  R  R  (    (    (    s[   Z:\home\souce\.local\share\Steam\steamapps\common\Doki Doki Literature Club\renpy\parser.pyt   <module>   s   4						F		/  )		I		u	K	5$		+	'
""	!			<-ZC		#	