mò
­fIc           @   s“  d  k  Z  d  k Z e d ƒ \ Z Z Z Z e  i d e  i e  i	 Bƒ i
 Z e  i d e  i ƒ i Z e  i d e  i e  i Bƒ i Z e  i d e  i ƒ i Z e  i d e  i ƒ i Z e  i d e  i ƒ i Z d g d	 Z x d
 D] Z d e e e ƒ <qÜ Wx d D] Z d e e e ƒ <qý Wx d D] Z e e e e ƒ <qWd i e ƒ Z [ y e e d ƒ ƒ Z Wn e j
 o d  Z n Xd f  d „  ƒ  YZ d  S(   Ni   sû   
    ^
    [ \t]*
    (?: if
    |   for
    |   while
    |   else
    |   def
    |   return
    |   assert
    |   break
    |   class
    |   continue
    |   elif
    |   try
    |   except
    |   raise
    |   import
    |   yield
    )
    \b
s'   
    [ \t]*
    (?: \# \S .* )?
    \n
sK  
    \""" [^"\\]* (?:
                     (?: \\. | "(?!"") )
                     [^"\\]*
                 )*
    (?: \""" )?

|   " [^"\\\n]* (?: \\. [^"\\\n]* )* "?

|   ''' [^'\\]* (?:
                   (?: \\. | '(?!'') )
                   [^'\\]*
                )*
    (?: ''' )?

|   ' [^'\\\n]* (?: \\. [^'\\\n]* )* '?
sM   
    [ \t]*
    [^\s#\\]    # if we match, m.end()-1 is the interesting char
s_   
    \s*
    (?: return
    |   break
    |   continue
    |   raise
    |   pass
    )
    \b
s   
    [^[\](){}#'"\\]+
t   xi   s   ({[t   (s   )}]t   )s   "'\
#t    t   Parserc           B   s’   t  Z d „  Z d „  Z d  e d „ Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d  Z d „  Z RS(   Nc         C   s   | |  _  | |  _ d  S(   N(   t   indentwidtht   selft   tabwidth(   R   R   R   (    (    t,   /mit/python/lib/python2.4/idlelib/PyParse.pyt   __init__s   s    	c         C   s   t  | ƒ t j of | } g  } | i } x; t t | ƒ D]* } | | d j  o t	 | ƒ p d ƒ q8 Wd i
 | ƒ } n | |  _ d |  _ d  S(   Ni   R    R   i    (   t   typet   strt   UnicodeTypet	   uniphooeyt   appendt   pusht   mapt   ordt   rawt   chrt   joinR   t   study_level(   R   R   R   R   R   (    (    R   t   set_strw   s     	 (	c         C   sÕ  |  i d  }
 } | ob d t i } |
 i | ƒ } | d j o1 | t	 | ƒ } |
 | d  d |
 | |  _ n | Sn | p d  Sn t	 |
 ƒ }	 x˜ t d ƒ D]Š } |
 i d d |	 ƒ } | d j  o Pn |
 i d d | ƒ d } | |
 | |	 ƒ } | o% | | i ƒ  ƒ o | i ƒ  } Pn | }	 q¡ W| d  j o? | |
 ƒ } | o$ | | i ƒ  ƒ o | i ƒ  } n | Sn | d } xI | |
 | ƒ } | o- | i ƒ  \ } } | | ƒ p
 | } qÌqˆPqˆW| S(   Ns   
i    i   i   s   :
(   R   R   t   Nonet   post   use_ps1t   syst   ps1t   rfindt   it   lent   is_char_in_stringt   limitt   ranget   triest   _synchret   mt   startt   spant   s(   R   R   R   R#   R'   R$   R   R   R"   R    R   R   (    (    R   t   find_good_parse_startš   sJ    ! 
	
  c         C   s%   | d j o |  i | |  _ n d  S(   Ni    (   t   loR   R   (   R   R)   (    (    R   t   set_loÚ   s     c         C   s«  |  i d j o d  Sn d |  _ |  i }	 |	 i t ƒ }	 |	 i d d ƒ }	 |	 i d d ƒ }	 |	 i d d ƒ }	 |	 i d d ƒ }	 |	 i d d ƒ }	 t } d } } d g |  _
 } | i } d t |	 ƒ } } x‰| | j  o{|	 | } | d } | d j o qÒ n | d j o, | d } | d j o | | ƒ qÒ qÒ n | d	 j o | d } qÒ n | d
 j o | o | d } qÒ qÒ n | d j p | d j oK| }
 |	 | d | d !|
 d j o |
 d }
 n t |
 ƒ d } | | } xó | | j  oß |	 | } | d } | d j o qòn |	 | d | | !|
 j o | | } Pn | d j o> | d } | d j o  | d j o | | ƒ n Pqòqòn | d j o0 |	 | d j o | d } n | d } qòqòqòWt } qÒ n | d j o |	 i d | ƒ } qÒ n |	 | d j o) | d } | d | j o
 t } qLn | d } qÒ W| t j o | d j o
 t } n | |  _ | d | j o | | ƒ n d  S(   Ni   t   xxxxxxxxR    t   xxxxt   xxs   
xs   
i    R   R   t   "t   'i   i   s   \t   #iÿÿÿÿ(   R   R   R   t	   translatet   _trant   replacet   C_NONEt   continuationt   levelt   lnot	   goodlinesR   t	   push_goodR   R   t   nt   cht   quotet   wt   C_STRINGt   findt   C_BACKSLASHt	   C_BRACKET(   R   R;   R6   R   R5   R8   R:   R=   R7   R   R<   R9   (    (    R   t   _study1ã   s     		
	 



 
 



 
   

	 c         C   s   |  i ƒ  |  i S(   N(   R   RB   R5   (   R   (    (    R   t   get_continuation_type\  s    
c         C   sñ  |  i d j o d  Sn |  i ƒ  d |  _ |  i |  i }	 } t | ƒ d } t |	 ƒ } xt | ol | } x@ t	 | | d | | ƒ D]# }
 |	 i d d | d ƒ d } q† Wt |	 | ƒ o | d } q] Pq] W| d j o
 | } n | | |  _ |  _ d } g  } | i } x¹| | j  o«t |	 | | ƒ } | o} | i ƒ  } | d } x- | | j o |	 | d j o | d } qRW| | j o |	 | } n | } | | j o Pq¶n |	 | } | d j o! | | ƒ | } | d } qn | d j o) | o | d	 =n | } | d } qn | d
 j p | d j o% | } t |	 | | ƒ i ƒ  } qn | d j o  |	 i d | | ƒ d } qn | d } |	 | d j o | |	 | } n | d } qW| |  _ | o | d	 |  _ n d  S(   Ni   i   s   
i    R   s    	
s   ([{s   )]}iÿÿÿÿR.   R/   R0   (   R   R   RB   R   R8   R   R   t   pt   qR!   t   nothingR   t   _junkret
   stmt_startt   stmt_endt   lastcht   stackR   t
   push_stackt   _chew_ordinaryreR$   t   endt   newpR;   t   _match_stringreR?   t   lastopenbracketpos(   R   RL   RJ   R   R$   R8   RE   RD   R;   R   RF   RO   RK   (    (    R   t   _study2l  s†    
	   ! 
	 
 	



  
 	c         C   s  |  i ƒ  |  i } |  i } t | ƒ } | i d d | ƒ d } } | d } x“ | | j  oO t
 | | ƒ } | o | i ƒ  d } d } PqR | i d | ƒ d } } qR W| } } x  | | d j o | d } q¼ W|  i } t | | | !i |  i ƒ ƒ | S(   Ns   
i    i   s    	(   R   RR   RQ   t   jR   R   R:   R   t   origiR   t   _itemreR$   RN   t   extraR?   R   t
   expandtabsR   (   R   RV   R   RS   R$   R:   R   RT   (    (    R   t   compute_bracket_indentÑ  s*    
 		
 
 	c         C   s#   |  i ƒ  |  i } | d | d S(   Niÿÿÿÿiþÿÿÿ(   R   RB   R8   (   R   R8   (    (    R   t   get_num_lines_in_stmtð  s    
	c         C   s  |  i ƒ  |  i } |  i } x  | | d j o | d } q W| } | i d | ƒ d } d } } x| | j  o| | } | d j o | d } | d } qh | d j o# | o | d } n | d } qh | d j p | d j o t | | | ƒ i ƒ  } qh | d	 j o Pqh | d j oO | d
 j oB | d j p | | d d j o  | | d d
 j o d } Pqh | d } qh W| o- | d } t i d | | | !ƒ d  j } n | p- | } x$ | | d j o | d } qËWn t | |  i | !i |  i ƒ ƒ d S(   Ns    	i   s   
i    s   ([{s   )]}R.   R/   R0   t   =s   =<>!s   \s*\\s    	
(   R   RR   R   RH   R   t   startposR?   t   endpost   foundR6   R;   RP   RN   t   ret   matchR   R   RW   R   (   R   R;   R6   R   R\   R   R]   R[   (    (    R   t   compute_backslash_indentù  sJ    
 		 
 

Q
# c         C   sg   |  i ƒ  |  i |  i } } | } |  i } x- | | j  o | | d j o | d } q/ W| | | !S(   Ns    	i   (   R   RR   RH   RI   R   R:   RS   R   (   R   R   RS   R   R:   (    (    R   t   get_base_indent_string.  s    
	 c         C   s   |  i ƒ  |  i d j S(   Nt   :(   R   RR   RJ   (   R   (    (    R   t   is_block_opener9  s    
c         C   s#   |  i ƒ  t |  i |  i ƒ d  j	 S(   N(   R   RR   t   _closereR   RH   R   (   R   (    (    R   t   is_block_closer?  s    
c         C   s   |  i ƒ  |  i S(   N(   R   RR   RQ   (   R   (    (    R   t   get_last_open_bracket_posF  s    
(   t   __name__t
   __module__R	   R   R   R#   R(   R*   RB   RC   RR   RX   RY   R`   Ra   Rc   Re   RQ   Rf   (    (    (    R   R   q   s   		#@			y		e				5			(   R^   R   R!   R4   R@   R>   RA   t   compilet   VERBOSEt	   MULTILINEt   searchR#   R_   RG   t   DOTALLRP   RU   Rd   RM   R2   R;   R   R   R
   t   unicodeR   t	   NameErrorR   R   (   RM   RG   R;   RP   RA   R2   R4   R^   R   R@   R>   Rd   R   R   RU   R#   (    (    R   t   ?   s4   		 	   