
\c           @  s   d  d l  m Z m Z d  d l Z d  d l Z d  d l Z d  d l Z d Z d3 d4 d5 d6 d7 g Z	 d8 d9 d: d; d< d= d> d? d@ dA dB dC dD dE g Z
 d, e f d-     YZ d.   Z d/   Z d0 d1 e d2  Z d S(F   i(   t   print_functiont   unicode_literalsNu   (?x)
\b_[_p]?\s*\(\s*[uU]?(
\"\"\"(?:\\.|\\\n|\"{1,2}|[^\\"])*?\"\"\"
|'''(?:\\.|\\\n|\'{1,2}|[^\\'])*?'''
|"(?:\\.|[^\\"])*"
|'(?:\\.|[^\\'])*'
)\s*\)
u
   script.rpyi   u   options.rpyi
   u   gui.rpyi   u   screens.rpyi   u    id   u   launcher.rpyu   _compat/i  u   obsolete.rpyu   _layout/i  u   00layout.rpyi  u   00console.rpyi@  u   developer.rpyu   _developer/i6  u   _errorhandling.rpymi   u	   error.rpyu   00gamepad.rpyi   u   00gltest.rpyi   u   00gallery.rpyi   u
   common.rpyu   00compat.rpyu   00updater.rpyi   i   u	   00iap.rpyi   i2   t   Stringc           B  s    e  Z d  Z d   Z d   Z RS(   uH   
    This stores information about a translation string or comment.
    c   	      C  s   | |  _  | |  _ | |  _ | |  _ t j j j |  j   \ |  _ |  _	 |  j	 rZ t
 } n t } x- | D]% \ } } } |  j j |  rg Pqg qg W| |  _ | |  j  |  j f |  _ | |  _ d  S(   N(   t   filenamet   linet   textt   commentt   renpyt   translationt
   generationt   shorten_filenamet   elidedt   commont   COMMON_PRIORITIESt   REGULAR_PRIORITIESt
   startswitht   priorityt   sort_keyt   launcher_file(	   t   selfR   R   R   R   t   plt   prefixR   R   (    (    sv   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\translation\scanstrings.pyt   __init__L   s    				$			c         C  s   d j  d |   S(   Nu2   <String {self.filename}:{self.line} {self.text!r}>R   (   t   format(   R   (    (    sv   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\translation\scanstrings.pyt   __repr__l   s    (   t   __name__t
   __module__t   __doc__R   R   (    (    (    sv   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\translation\scanstrings.pyR   G   s   	 c         C  s4  g  } x@ t  j j j j |  D]( \ } } | j t |  | | t   q Wx t  j j	 |   D] \ } } } x t
 j t |  D] } | j d  } | j d d  } | d k	 r~ | j   } d | } t |  } | j d  j d  r t  j j |  } n  | r(| j t |  | | t   q(q~ q~ Wq\ W| S(   u   
    Scans `filename`, a file containing Ren'Py script, for translatable
    strings.

    Returns a list of TranslationString objects.
    i   u   \
u    u   ui    u   _pN(   R   t   gamet   scriptt
   translatort   additional_stringst   appendR   t   Falset   parsert   list_logical_linest   ret   finditert	   STRING_REt   groupt   replacet   Nonet   stript   evalR   t   minstoret   _p(   R   t   rvR   t   st	   _filenamet   linenoR   t   m(    (    sv   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\translation\scanstrings.pyt   scan_stringsp   s     # "
*c         C  s_  g  } |  t  j j k r | Sg  } d } t j |  d d  A } g  | j   j d d  j d  D] } | j   ^ qb } Wd  QXx t	 |  D] \ } } | s | d } n  t
 j d |  } | r | j d  }	 | r |	 j   }	 n  | j |	  q | r d	 d
 j |  }
 |
 j d  r2|
 j d  }
 n  g  } | j t |  | |
 t   q q W| S(   Ni    u   ru   utf-8u   ﻿u    u   
i   u
   \s*## (.*)u   ## u    u   #u   # (   R   t   configt   translate_commentst   codecst   opent   readR(   t   splitt   rstript	   enumerateR$   t   matchR'   R*   R    t   joint   endswithR   t   True(   R   R.   R   t   startt   ft   it   linest   lR2   t   cR/   (    (    sv   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\translation\scanstrings.pyt   scan_comments   s.    @#i    i+  c   	      C  s"  t  j j j   } g  } x^ | D]V } t j j |  } t j j |  sO q n  | j t	 |   | j t
 |   q W| j d d    g  } t   } x | D]x } | j |  k  r q n  | j | k r q n  | r | j r q n  | j | k r q n  | j | j  | j |  q W| S(   uf   
    Scans all files for translatable strings and comments. Returns a list
    of String objects.
    t   keyc         S  s   |  j  S(   N(   R   (   R/   (    (    sv   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\translation\scanstrings.pyt   <lambda>   s    (   R   R   R	   t   translate_list_filest   ost   patht   normpatht   existst   extendR3   RF   t   sortt   setR   R   R   t   addR    (	   t   min_priorityt   max_priorityt   common_onlyt	   filenamest   stringsR   R.   t   seenR/   (    (    sv   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\translation\scanstrings.pyt   scan   s.    	(   u
   script.rpyi   u
   script.rpy(   u   options.rpyi
   u   options.rpy(   u   gui.rpyi   u   gui.rpy(   u   screens.rpyi   u   screens.rpy(   u    id   u   launcher.rpy(   u   _compat/i  u   obsolete.rpy(   u   _layout/i  u   obsolete.rpy(   u   00layout.rpyi  u   obsolete.rpy(   u   00console.rpyi@  u   developer.rpy(   u   _developer/i6  u   developer.rpy(   u   _errorhandling.rpymi   u	   error.rpy(   u   00gamepad.rpyi   u	   error.rpy(   u   00gltest.rpyi   u	   error.rpy(   u   00gallery.rpyi   u
   common.rpy(   u   00compat.rpyi   u
   common.rpy(   u   00updater.rpyi   u
   common.rpy(   u   00gamepad.rpyi   u
   common.rpy(   u	   00iap.rpyi   u
   common.rpy(   u    i2   u
   common.rpy(   t
   __future__R    R   RJ   R$   R6   t   renpy.translationR   R&   R   R   t   objectR   R3   RF   R!   RX   (    (    (    sv   C:\Users\romet\Desktop\TwistedScarlett Patreon Pack #13\FriendshipwithBenefits-0.1-pc\renpy\translation\scanstrings.pyt   <module>   s8   		)	"	)