-í
¯¦T<c       s†     d  Z    d k Z  d k Z  d k l Z l Z  d k l Z  d f  d „  ƒ  YZ † d „  Z  d f  d „  ƒ  YZ	 d S(	   sæ  ParenMatch -- An IDLE extension for parenthesis matching.

When you hit a right paren, the cursor should move briefly to the left
paren.  Paren here is used generically; the matching applies to
parentheses, square brackets, and curly braces.

WARNING: This extension will fight with the CallTips extension,
because they both are interested in the KeyRelease-parenright event.
We'll have to fix IDLE to do something reasonable when two or more
extensions what to capture the same event.
N(   s
   AutoIndents
   index2line(   s   idleconfs
   ParenMatchc      s.   d  Z  - / g  Z 1 h  d d d f d <d f d <Z 8 h  Z 9 h  Z ; e i d ƒ Z < e i d d	 ƒ Z	 = e i
 d
 ƒ Z > e i d ƒ Z ? e i d ƒ Z @ [ B d „  Z J d „  Z S d „  Z \ e d „ Z a d „  Z e d „  Z l d „  Z q d „  Z y d „  Z } d „  Z RS(   sÌ  Highlight matching parentheses

    There are three supported style of paren matching, based loosely
    on the Emacs options.  The style is select based on the
    HILITE_STYLE attribute; it can be changed used the set_style
    method.

    The supported styles are:

    default -- When a right paren is typed, highlight the matching
        left paren for 1/2 sec.

    expression -- When a right paren is typed, highlight the entire
        expression from the left paren to the right paren.

    TODO:
        - fix interaction with CallTips
        - extend IDLE with configuration dialog to change options
        - implement rest of Emacs highlight styles (see below)
        - print mismatch warning in IDLE status window

    Note: In Emacs, there are several styles of highlight where the
    matching paren is highlighted whenever the cursor is immediately
    to the right of a right paren.  I don't know how to do that in Tk,
    so I haven't bothered.
    s   <KeyRelease-parenright>s   <KeyRelease-bracketright>s   <KeyRelease-braceright>s   <<flash-open-paren>>s
   <KeyPress>s   <<check-restore>>s
   ParenMatchs   styles   defaults   flash-delays   hilites   bellc    s_   B C | |  _  D | i |  _ E t | ƒ |  _ F d |  _ G t |  _ H |  i |  i	 ƒ d  S(   Ni    (
   s   editwins   selfs   texts   LastOpenBracketFinders   finders   counters   Nones   _restores	   set_styles   STYLE(   s   selfs   editwin(    (    s'   /mit/python/share/idlelib/ParenMatch.pys   __init__B s   c    sw   J K | |  _ L | d j o" M |  i |  _ N |  i |  _ n3 O | d j o" P |  i |  _ Q |  i |  _ n d  S(   Ns   defaults
   expression(	   s   styles   selfs   STYLEs   create_tag_defaults
   create_tags   set_timeout_lasts   set_timeouts   create_tag_expressions   set_timeout_none(   s   selfs   style(    (    s'   /mit/python/share/idlelib/ParenMatch.pys	   set_styleJ s   c    sv   S T |  i i t | i ƒ ƒ } U | t j o V |  i ƒ  W d  Sn X d |  _	 Y |  i
 | ƒ Z |  i ƒ  d  S(   Ni   (   s   selfs   finders   finds   keysym_types   events   keysyms   indexs   Nones   warn_mismatcheds   _restores
   create_tags   set_timeout(   s   selfs   events   index(    (    s'   /mit/python/share/idlelib/ParenMatch.pys   flash_open_paren_eventS s   c    s7   \ ] |  i o# ^ |  i i d ƒ _ t |  _ n d  S(   Ns   paren(   s   selfs   _restores   texts
   tag_deletes   None(   s   selfs   event(    (    s'   /mit/python/share/idlelib/ParenMatch.pys   check_restore_event\ s   c    s/   a b | d |  i j o c |  i ƒ  n d  S(   Ni   (   s   timer_counts   selfs   counters   check_restore_event(   s   selfs   timer_count(    (    s'   /mit/python/share/idlelib/ParenMatch.pys   handle_restore_timera s   c    s(   e f |  i o g |  i i ƒ  n d  S(   N(   s   selfs   BELLs   texts   bell(   s   self(    (    s'   /mit/python/share/idlelib/ParenMatch.pys   warn_mismatchede s   c    s9   l m n |  i i d | ƒ o |  i i d |  i ƒ d S(   s'   Highlight the single paren that matchess   parenN(   s   selfs   texts   tag_adds   indexs
   tag_configs   HILITE_CONFIG(   s   selfs   index(    (    s'   /mit/python/share/idlelib/ParenMatch.pys   create_tag_defaultl s   c    s<   q r s |  i i d | d ƒ t |  i i d |  i ƒ d S(   s   Highlight the entire expressions   parens   insertN(   s   selfs   texts   tag_adds   indexs
   tag_configs   HILITE_CONFIG(   s   selfs   index(    (    s'   /mit/python/share/idlelib/ParenMatch.pys   create_tag_expressionq s   c    s   y z { d S(   s3   Highlight will remain until user input turns it offN(    (   s   self(    (    s'   /mit/python/share/idlelib/ParenMatch.pys   set_timeout_noney s   c    sH   } ~  |  i i i |  i ‚ |  |  i d „ ƒ „ |  i d |  _ d S(   s7   The last highlight created will be removed after .5 secc    s   ‚ |  i | ƒ S(   N(   s   selfs   handle_restore_timers   c(   s   selfs   c(    (    s'   /mit/python/share/idlelib/ParenMatch.pys   <lambda>‚ s    i   N(   s   selfs   editwins
   text_frames   afters   FLASH_DELAYs   counter(   s   self(    (    s'   /mit/python/share/idlelib/ParenMatch.pys   set_timeout_last} s   (   s   __doc__s   menudefss   keydefss   windows_keydefss   unix_keydefss   idleconfs
   getsections   iconfs   getdefs   STYLEs   getints   FLASH_DELAYs   getcolors   HILITE_CONFIGs
   getbooleans   BELLs   __init__s	   set_styles   flash_open_paren_events   Nones   check_restore_events   handle_restore_timers   warn_mismatcheds   create_tag_defaults   create_tag_expressions   set_timeout_nones   set_timeout_last(    (    (    s'   /mit/python/share/idlelib/ParenMatch.pys
   ParenMatch s*   		'				c    s   † ‰ |  d j p
 |  d j o Š d Sn ‹ |  d j p
 |  d j o Œ d Sn  |  d j p
 |  d j o Ž d	 Sn d  S(
   Ns
   parenrights   (s   parens   bracketrights   [s   brackets
   bracerights   {s   brace(   s   ks(   s   ks(    (    s'   /mit/python/share/idlelib/ParenMatch.pys   keysym_type† s   s   LastOpenBracketFinderc      se    ‘ e  i Z ’ e  i Z “ e  i Z ” e  i Z – d „  Z š d „  Z ­ d „  Z » d „  Z RS(   Nc    s"   – — | |  _  ˜ | i |  _ d  S(   N(   s   editwins   selfs   text(   s   selfs   editwin(    (    s'   /mit/python/share/idlelib/ParenMatch.pys   __init__– s   c 	   s  š › t  i |  i |  i ƒ } œ x± |  i Dœ ]£ }  t | | d ƒ } ž | d } ¢ |  i i | d ƒ d  d } £ | i | ƒ ¤ | i |  i ¦ |  i | ƒ ƒ } § | t j	 p
 | d j o ¨ Pn q+ W© | i | p d ƒ ª | i ƒ  } « | | i f Sd  S(   Ni   s   .0s   insertiÿÿÿÿs   
i    (   s   PyParses   Parsers   selfs   indentwidths   tabwidths   ys   num_context_liness   contexts   maxs   lnos   startats   startatindexs   texts   gets   rawtexts   set_strs   find_good_parse_starts   context_use_ps1s   _build_char_in_string_funcs   bods   Nones   set_los   get_last_open_bracket_poss   is   str(	   s   selfs   lnos   rawtexts   startats   is   contexts   ys   startatindexs   bod(    (    s'   /mit/python/share/idlelib/ParenMatch.pys   _find_offset_in_bufš s    	 c 	   sÔ   ­ ® ¯ t  |  i i d ƒ ƒ } ° |  i | ƒ \ } } ± | t j p t	 | | ƒ | j o ³ t Sn ´ t i | | d ƒ d } ¶ | |  } · t i | d ƒ d } ¸ | | } ¹ d | | | f Sd S(   s*   Return the location of the last open parens   inserts   
i   s   %d.%dN(   s
   index2lines   selfs   texts   indexs   lnos   _find_offset_in_bufs   is   bufs   Nones   keysym_types   right_keysym_types   strings   counts
   lines_backs	   upto_opens   rfinds   js   offset(	   s   selfs   right_keysym_types
   lines_backs   is   js   lnos   offsets   bufs	   upto_open(    (    s'   /mit/python/share/idlelib/ParenMatch.pys   find­ s   'c    s&   » ¼ | |  i i d „ } ¿ | Sd  S(   Nc    s   ¼ ¾ | | d |  ƒ Sd  S(   Ns   %dc(   s   iciss
   startindexs   offset(   s   offsets
   startindexs   icis(    (    s'   /mit/python/share/idlelib/ParenMatch.pys   inner¼ s   (   s
   startindexs   selfs   editwins   is_char_in_strings   inner(   s   selfs
   startindexs   inner(    (    s'   /mit/python/share/idlelib/ParenMatch.pys   _build_char_in_string_func» s   (	   s
   AutoIndents   num_context_liness   indentwidths   tabwidths   context_use_ps1s   __init__s   _find_offset_in_bufs   finds   _build_char_in_string_func(    (    (    s'   /mit/python/share/idlelib/ParenMatch.pys   LastOpenBracketFinder s   (
   s   __doc__s   strings   PyParses
   AutoIndents
   index2lines   IdleConfs   idleconfs
   ParenMatchs   keysym_types   LastOpenBracketFinder(   s   idleconfs   LastOpenBracketFinders
   index2lines
   ParenMatchs
   AutoIndents   keysym_types   PyParses   string(    (    s'   /mit/python/share/idlelib/ParenMatch.pys   ? s   s
