³ò
bO¼Nc           @   sE  d  d k  Z  d  d k Z d  d k Z d  d k Z d  d k Z d a d a d a d „  Z	 h  Z
 d „  Z d d „ Z d „  Z d „  Z h  Z d „  Z d „  Z d	 „  Z d
 „  Z g  a d „  Z d „  Z d „  Z d „  Z e  i i i Z d „  Z d „  Z d „  Z d „  Z d „  Z  d „  Z! d „  Z" d „  Z# d „  Z$ d „  Z% d S(   iÿÿÿÿNc         G   sT   t  o& d t i i t  i ƒ t  i f } n d } | |  | 7} H| i d ƒ GHd  S(   Nu   %s:%d t    s   utf-8(   t   report_nodet   renpyt   parsert   unicode_filenamet   filenamet
   linenumbert   encode(   t   msgt   argst   out(    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt   report/   s    &c         C   s3   |  t  j o" t t  |  <t |  ƒ i d ƒ GHn d  S(   Ns   utf-8(   t   addedt   Truet   unicodeR   (   R   (    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt   add=   s    
c         C   sG   y t  i i | ƒ Wn, t d | |  ƒ | o t | ƒ qC n Xd  S(   Ns   Could not evaluate '%s', in %s.(   R   t   pythont   py_evalR   R   (   t   wheret   exprt
   additional(    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt   try_evalD   s    c         C   s2   y t  i i | ƒ Wn t d | |  ƒ n Xd  S(   Ns6   '%s' could not be compiled as a python expression, %s.(   R   R   t   py_compile_eval_bytecodeR   (   R   R   (    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt   try_compileO   s    c         C   s   | p |  d } t  t | <| o d  Sn t |  ƒ }  d i |  ƒ } x7 |  o/ t |  ƒ t i i j o d  Sn |  i ƒ  qH Wt	 d | ƒ d  S(   Ni    t    s&   The image named '%s' was not declared.(
   R   t   image_prefixest   listt   joint   tupleR   t   exportst   imagest   popR   (   t   namet
   expressiont   tagt   names(    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt   image_existsY   s    

c      	   C   s%  t  i | d  ƒ } | t j o d  Sn | t j o t d |  i ƒ  | ƒ d  Sn t i i	 | ƒ p( t d |  i ƒ  | ƒ t t  | <d  Sn t t  | <y t i i
 | ƒ Wn d  Sn Xt i i
 | ƒ oU | i ƒ  t j oB | t | i ƒ  j o+ t d |  | t | i ƒ  ƒ t d ƒ n d  S(   Ns)   %s uses file '%s', which is not loadable.sW   Filename case mismatch for %s. '%s' was used in the script, but '%s' was found on disk.s£   Case mismatches can lead to problems on Mac, Linux/Unix, and when archiving images. To fix them, either rename the file on disk, or the filename use in the script.(   t   check_file_cachet   gett   NoneR   t   FalseR   t
   capitalizeR   t   loadert   loadablet   transfnt   lowert	   filenamesR   (   t   whatt   fnt   present(    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt
   check_filep   s(    

c            sD   g  ‰  ‡  f d †  } | i  | ƒ x ˆ  D] } t |  | ƒ q) Wd  S(   Nc            s   ˆ  i  |  i ƒ  ƒ d  S(   N(   t   extendt   predict_files(   t   img(   t   files(    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt   files_callback   s    (   t   predictR2   (   R/   t   dR7   R0   (    (   R6   s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt   check_displayableŒ   s     c         C   s4   d i  |  i ƒ } t d | t i i |  i ƒ d  S(   NR   s   image %s(   R   t   imgnameR:   R   R   R   (   t   nodeR    (    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt   check_imageš   s    c         C   s‰   t  |  ƒ d j o& |  d d  d  |  d |  d d f Sn t  |  ƒ d j o5 |  d |  d |  d |  d |  d |  d d  f Sn |  Sd  S(   Ni   i    i   i   i   i   i   (   t   lenR'   (   t   t(    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt   imspec    s
    &5c   	      C   sÇ   |  i  p d  Sn t  |  i  ƒ \ } } } } } } } | t i i j o$ | t i i j o t d | ƒ n t | | | ƒ | t j o | o t i | ƒ n x | D] } t	 d | d ƒ q© Wd  S(   Ns/   Uses layer '%s', which is not in config.layers.s'   the at list of a scene or show statments9   Perhaps you forgot to declare, or misspelled, a position?(
   R@   R   t   configt   layerst
   top_layersR   R$   t   used_imagest   appendR   (	   R<   R    R!   R"   t   at_listt   layert   zordert   behindt   i(    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt
   check_show«   s    
$& c         C   sŽ   t  |  i  ƒ \ } } } } } } } | p | d } | t i i j o$ | t i i j o t d | ƒ n | t j o t d | ƒ n d  S(   Ni    s/   Uses layer '%s', which is not in config.layers.sy   The image tag '%s' is not the prefix of a declared image, nor was it used in a show statement before this hide statement.(   R@   R   RA   RB   RC   R   R   (   R<   R    R!   R"   RF   RG   RH   RI   (    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt
   check_hideÁ   s    $&c         C   s   t  d |  i d ƒ d  S(   Ns   a with statement or clauses;   Perhaps you forgot to declare, or misspelled, a transition?(   R   R   (   R<   (    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt
   check_withÐ   s    c         C   sa   d „  } t  i i | ƒ z |  i d ƒ Wd  t  i i ƒ  Xy |  i ƒ  Wn t d ƒ n Xd  S(   Nc         S   s   t  d |  ƒ d  S(   Ns   %s(   R   (   R   (    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt   errorÕ   s    t   lints9   Didn't properly report what the next statement should be.(   R   R   t   push_error_handlert   callt   pop_error_handlert   get_nextR   (   R<   RN   (    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt
   check_userÓ   s    	c         C   s›  t  i i i |  ƒ } | o t d | t |  ƒ d ƒ n d |  j oPd } d } d } x| t |  ƒ j  oø |  | } | d 7} | d j o! | d j o d } d } qcq\ | d j os | | 7} | d j o
 d } qc| d j o
 d } qc| d	 j o
 d } qct d
 | t |  ƒ d ƒ d } q\ | d j o% | | 7} | d j o
 d } qcq\ q\ W| d j o t d | t |  ƒ d ƒ q—n d  S(   Ns
   %s (in %s)i   t   %i    R    t   (i   s   #0123456780- +hlLs   diouxXeEfFgGcrs%s'   Unknown string format code '%s' (in %s)t   )s,   Unterminated string format code '%s' (in %s)(   R   t   displayt   textt   check_text_tagsR   t   reprR>   (   t   sR   t   statet   post   fmtt   c(    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt   text_checkså   s<    







c         C   sS   |  i  o t d |  i  d ƒ n |  i o t d |  i d ƒ n t |  i ƒ d  S(   Ns   the who part of a say statements*   Perhaps you forgot to declare a character?s"   the with clause of a say statements;   Perhaps you forgot to declare, or misspelled, a transition?(   t   whoR   t   with_Ra   R/   (   R<   (    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt	   check_say  s
    

c         C   s´   |  i  o t d |  i  d ƒ n g  } |  i D]* \ } } } | o | | | | f q/ q/ ~ p t d ƒ n x< |  i D]1 \ } } } | o t d | ƒ n t | ƒ q{ Wd  S(   Ns#   the with clause of a menu statements;   Perhaps you forgot to declare, or misspelled, a transition?s1   The menu does not contain any selectable choices.s   in the if clause of a menuitem(   Rc   R   t   itemsR   R   Ra   (   R<   t   _[1]t   lR`   t   b(    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt
   check_menu  s    
B
 c         C   sC   |  i  o d  Sn t i i i |  i ƒ p t d |  i ƒ n d  S(   Ns&   The jump is to nonexistent label '%s'.(   R!   R   t   gamet   scriptt	   has_labelt   targetR   (   R<   (    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt
   check_jump'  s    
c         C   sC   |  i  o d  Sn t i i i |  i ƒ p t d |  i ƒ n d  S(   Ns&   The call is to nonexistent label '%s'.(   R!   R   Rj   Rk   Rl   t   labelR   (   R<   (    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt
   check_call/  s    
c         C   s   t  d |  i ƒ d  S(   Ns'   in the condition of the while statement(   R   t	   condition(   R<   (    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt   check_while<  s    c         C   s+   x$ |  i  D] \ } } t d | ƒ q
 Wd  S(   Ns"   in a condition of the if statement(   t   entriesR   (   R<   Rq   t   block(    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt   check_if?  s    
 c      	   C   s  | i  o7 x4 | i  D]% } t |  d |  f | i  | ƒ q Wn xÉ | i D]¾ } xµ | i ƒ  D]§ \ } } |  d | } | i d ƒ o t |  | ƒ n t i i | } x/ | D]' \ } }	 }
 |
 o |
 | ƒ } n Pq° Wt	 | t i
 i i ƒ o t | | ƒ q^ q^ WqK Wd  S(   Ns   [%r]t   .t   font(   t   indexedt   check_stylet
   propertiest	   iteritemst   endswithR2   R   t   stylet
   expansionst
   isinstanceRX   t   coret   DisplayableR:   (   R    R\   RJ   t   pt   kt   vt   knamet   et   priot   propnt   func(    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyRy   D  s&    

 '
   c          C   s8   x1 t  i i i ƒ  D] \ }  } t d |  | ƒ q Wd  S(   Ns   Style property style.(   R   R}   t	   style_mapR{   Ry   (   R    R\   (    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyt   check_styles_  s     c          C   s´  t  t i _ t i GHt t i d t i	 ƒ  ƒ i
 d ƒ GHh  a xS t i i D]E }  x< t i t i i t i i |  ƒ ƒ D] } | t | i ƒ  <qw WqL Wh  a x" t i i D] } t  t | d <q¨ Wg  } t i i i D] } | | i | i | f qÔ ~ } | i ƒ  d } d } d } xú| D]ò\ } }	 }
 |
 a t |
 t i i ƒ o t  |
 ƒ qt |
 t i i! ƒ o t" |
 ƒ qt |
 t i i# ƒ o t" |
 ƒ qt |
 t i i$ ƒ o t% |
 ƒ qt |
 t i i& ƒ o t' |
 ƒ qt |
 t i i( ƒ o1 t) |
 ƒ | d 7} | t* |
 i+ i, ƒ  ƒ 7} qt |
 t i i- ƒ o t. |
 ƒ | d 7} qt |
 t i i/ ƒ o t0 |
 ƒ qt |
 t i i1 ƒ o t2 |
 ƒ qt |
 t i i3 ƒ o t4 |
 ƒ qt |
 t i i5 ƒ o t6 |
 ƒ qt |
 t i i7 ƒ o t8 |
 ƒ qqWd a t: ƒ  x t i i; D] } | ƒ  q,WHHd GHHd G| Gd GHd G| Gd	 GH| d j o d
 d | | GHn d G| Gd GHHt i i< o
 d GHHn d GHd GHd S(   s_   
    The master lint function, that's responsible for staging all of the
    other checks.
    s    lint report, generated at: s   utf-8i    i   s   Statistics:s   The game containss   screens of dialogue.s    These screens contain a total ofs   words,s(   for an average of %.1f words per screen.g      ð?s   menus.s;   Remember to set config.developer to False before releasing.sH   Lint is not a substitute for thorough testing. Remember to update Ren'PysB   before releasing. New releases fix bugs and improve compatibility.N(=   R   R   Rj   RO   t   codecst   BOM_UTF8R   t   versiont   timet   ctimeR   R.   RA   t
   searchpatht   ost   listdirt   pathR   t   basedirR-   R   R   R   Rk   t	   all_stmtsR   R   t   sortR   R   t   astt   ImageR=   t   ShowRK   t   Scenet   HideRL   t   WithRM   t   SayRd   R>   R/   t   splitt   MenuRi   t   JumpRn   t   CallRp   t   WhileRr   t   IfRu   t   UserStatementRT   R'   R‹   t
   lint_hookst	   developer(   R9   R0   Rƒ   Rf   RJ   R–   t	   say_wordst	   say_countt
   menu_countt   lnR<   t   f(    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pyRO   c  sˆ    % %  9
 


 (&   R   RŒ   R’   t   os.pathR   R'   R   R.   R   R   R   R   R   R   R$   R%   R2   R:   R=   R@   RD   RK   RL   RM   RT   RX   RY   RZ   Ra   Rd   Ri   Rn   Rp   Rr   Ru   Ry   R‹   RO   (    (    (    s2   D:\Version 1-0-7\Games\Katawa Shoujo\renpy\lint.pys   <module>   sD   	
		
					
					*	
							