;
"Ic               @   sW  d  Z  d Z d Z d d l Z d d l Z d d l Z d d l Td d l m Z d d l	 m
 Z
 m Z e j d  Z d d l Z d	   e e  D d
 d d d d d g Z [ e Z d
 e e <e d Z d e e <e d Z d e e <e d 7Z d   Z d   Z d   Z d Z d Z e e d e  e e  Z d Z d Z d Z d Z d Z e e e e e  Z  d Z! e d d   e e!  Z" d! e! Z# e e" e#  Z$ e d" e$ d#  Z% e e% e$ e   Z& d$ Z' d% Z( d& Z) d' Z* e d( d)  Z+ e d* d+  Z, e d, d- d. d/ d0 d1 d2 d3  Z- d4 Z. e d5 d6 d7  Z/ e e- e. e/  Z0 e e& e0 e, e  Z1 e e1 Z2 e d8 e d9 d  d: e d; d   Z3 e d e e+  Z4 e e e4 e& e0 e3 e  Z5 e6 e j e2 e5 e) e* f  \ Z7 Z8 Z9 Z: i e j e'  d9 6e j e(  d; 6e9 d< 6e: d= 6e9 d> 6e: d? 6e9 d@ 6e: dA 6e9 dB 6e: dC 6e9 dD 6e: dE 6e9 dF 6e: dG 6e9 dH 6e: dI 6e9 dJ 6e: dK 6e9 dL 6e: dM 6d dN 6d dO 6d dP 6d dQ 6Z< i  Z= x dn D] Z> e> e= e> <qWi  Z? x do D] Z> e> e? e> <qWdb Z@ Gdc   dd eA  ZB Gde   df eA  ZC Gdg   dh  ZD di   ZE dj   ZF dk   ZG dl   ZH dm   ZI d S(p   uk  Tokenization help for Python programs.

tokenize(readline) is a generator that breaks a stream of
bytes into Python tokens. It decodes the bytes according to
PEP-0263 for determining source file encoding.

It accepts a readline-like method which is called
repeatedly to get the next line of input (or b"" for EOF).  It generates
5-tuples with these members:

    the token type (see token.py)
    the token (a string)
    the starting (row, column) indices of the token (a 2-tuple of ints)
    the ending (row, column) indices of the token (a 2-tuple of ints)
    the original line (string)

It is designed to match the working of the Python tokenizer exactly, except
that it produces COMMENT tokens for comments and gives type OP for all
operators. Aditionally, all token lists start with an ENCODING token
which tells you which encoding was used to decode the bytes stream.u   Ka-Ping Yee <ping@lfw.org>up   GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip Montanaro, Raymond Hettinger, Trent Nelson, Michael Foordi    N(   u   *(   u   lookup(   u   chainu   repeatu   coding[:=]\s*([-\w.]+)c             C   s0   g  } |  ]" } | d  d k o | | q
 q
 S(   i    u   _(    (   u   .0u   _[1]u   x(    (    u%   /mit/python/lib/python3.0/tokenize.pyu
   <listcomp>"   s    u   COMMENTu   tokenizeu   detect_encodingu   NLu
   untokenizeu   ENCODINGi   i   i   c              G   s   d d j  |   d S(   Nu   (u   |u   )(   u   join(   u   choices(    (    u%   /mit/python/lib/python3.0/tokenize.pyu   group.   s    c              G   s   t  |    d S(   Nu   *(   u   group(   u   choices(    (    u%   /mit/python/lib/python3.0/tokenize.pyu   any/   s    c              G   s   t  |    d S(   Nu   ?(   u   group(   u   choices(    (    u%   /mit/python/lib/python3.0/tokenize.pyu   maybe0   s    u   [ \f\t]*u	   #[^\r\n]*u   \\\r?\nu   [a-zA-Z_]\w*u   0[xX][0-9a-fA-F]+u
   0[bB][01]+u   0[oO][0-7]+u   (?:0+|[1-9][0-9]*)u   [eE][-+]?[0-9]+u   [0-9]+\.[0-9]*u   \.[0-9]+u   [0-9]+u
   [0-9]+[jJ]u   [jJ]u   [^'\\]*(?:\\.[^'\\]*)*'u   [^"\\]*(?:\\.[^"\\]*)*"u%   [^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''u%   [^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""u   [bB]?[rR]?'''u   [bB]?[rR]?"""u&   [bB]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*'u&   [bB]?[rR]?"[^\n"\\]*(?:\\.[^\n"\\]*)*"u   \*\*=?u   >>=?u   <<=?u   !=u   //=?u   ->u   [+\-*/%&|^=<>]=?u   ~u   [][(){}]u   \r?\nu   \.\.\.u   [:;.,@]u%   [bB]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*u   'u%   [bB]?[rR]?"[^\n"\\]*(?:\\.[^\n"\\]*)*u   "u   '''u   """u   r'''u   r"""u   b'''u   b"""u   br'''u   br"""u   R'''u   R"""u   B'''u   B"""u   bR'''u   bR"""u   Br'''u   Br"""u   BR'''u   BR"""u   ru   Ru   bu   Bu   r'u   r"u   R'u   R"u   b'u   b"u   B'u   B"u   br'u   br"u   Br'u   Br"u   bR'u   bR"u   BR'u   BR"i   c             B   s   |  Ee  Z d  S(   N(   u   __name__u
   __module__(   u
   __locals__(    (    u%   /mit/python/lib/python3.0/tokenize.pyu
   TokenError   s   
 u
   TokenErrorc             B   s   |  Ee  Z d  S(   N(   u   __name__u
   __module__(   u
   __locals__(    (    u%   /mit/python/lib/python3.0/tokenize.pyu   StopTokenizing   s   
 u   StopTokenizingc             B   s2   |  Ee  Z d    Z d   Z d   Z d   Z d S(   c             C   s(   g  |  _  d |  _ d |  _ d  |  _ d  S(   Ni   i    (   u   tokensu   prev_rowu   prev_colu   Noneu   encoding(   u   self(    (    u%   /mit/python/lib/python3.0/tokenize.pyu   __init__   s    			c             C   s<   | \ } } | |  j  } | o |  j j d |  n d  S(   Nu    (   u   prev_colu   tokensu   append(   u   selfu   startu   rowu   colu
   col_offset(    (    u%   /mit/python/lib/python3.0/tokenize.pyu   add_whitespace   s    c             C   s   x | D] } t  |  d k o |  j | |  Pn | \ } } } } } | t k o | |  _ q n |  j |  |  j j |  | \ |  _ |  _ | t	 t
 f k o |  j d 7_ d |  _ q q Wd j |  j  S(   Ni   i   i    u    (   u   lenu   compatu   ENCODINGu   encodingu   add_whitespaceu   tokensu   appendu   prev_rowu   prev_colu   NEWLINEu   NLu   join(   u   selfu   iterableu   tu   tok_typeu   tokenu   startu   endu   line(    (    u%   /mit/python/lib/python3.0/tokenize.pyu
   untokenize   s      	c       
      C   s  d } g  } |  j j } | \ } } | t t f k o | d 7} n | t t f k o
 d } n d } x | D]}	 |	 d  d  \ } } | t k o | |  _	 qo n | t t f k o | d 7} n | t
 k o | o d | } n d } n d } | t k o | j |  qo nb | t k o | j   qo nD | t t f k o
 d } n' | o | o | | d  d } n | |  qo Wd  S(   Nu    i   iFT(   u   Falseu   tokensu   appendu   NAMEu   NUMBERu   NEWLINEu   NLu   Trueu   ENCODINGu   encodingu   STRINGu   INDENTu   DEDENTu   pop(
   u   selfu   tokenu   iterableu	   startlineu   indentsu   toks_appendu   toknumu   tokvalu
   prevstringu   tok(    (    u%   /mit/python/lib/python3.0/tokenize.pyu   compat   sD    
 	



N(   u   __name__u
   __module__u   __init__u   add_whitespaceu
   untokenizeu   compat(   u
   __locals__(    (    u%   /mit/python/lib/python3.0/tokenize.pyu   Untokenizer   s   
			u   Untokenizerc             C   sB   t    } | j |   } | j d k	 o | j | j  } n | S(   u  Transform tokens back into Python source code.
    It returns a bytes object, encoded using the ENCODING
    token, which is the first token sequence output by tokenize.

    Each element returned by the iterable must be a token sequence
    with at least two elements, a token number and token value.  If
    only two tokens are passed, the resulting output is poor.

    Round-trip invariant for full input:
        Untokenized source will match input source exactly

    Round-trip invariant for limited intput:
        # Output bytes will tokenize the back to the input
        t1 = [tok[:2] for tok in tokenize(f.readline)]
        newcode = untokenize(t1)
        readline = BytesIO(newcode).readline
        t2 = [tok[:2] for tok in tokenize(readline)]
        assert t1 == t2
    N(   u   Untokenizeru
   untokenizeu   encodingu   Noneu   encode(   u   iterableu   utu   out(    (    u%   /mit/python/lib/python3.0/tokenize.pyu
   untokenize   s
    	c                s   d } d   d }  f d   }   f d   } |   } | j |  o d   | d d  } n | p d g  f S| |  } | o | | g f S|   } | p d | g f S| |  } | o | | | g f Sd | | g f S(	   u  
    The detect_encoding() function is used to detect the encoding that should
    be used to decode a Python source file. It requires one argment, readline,
    in the same way as the tokenize() generator.

    It will call readline a maximum of twice, and return the encoding used
    (as a string) and a list of any lines (left as bytes) it has read
    in.

    It detects the encoding from the presence of a utf-8 bom or an encoding
    cookie as specified in pep-0263. If both a bom and a cookie are present,
    but disagree, a SyntaxError will be raised.

    If no encoding is specified, then the default of 'utf-8' will be returned.
    s   ﻿c                  s*   y     SWn t  k
 o d SYn Xd  S(   Ns    (   u   StopIteration(    (   u   readline(    u%   /mit/python/lib/python3.0/tokenize.pyu   read_or_stop  s    c                s   y |  j  d  } Wn t k
 o YnT Xt j |  } | o< | d }   o& t |  j d k o t d   n | Sd  S(   Nu   asciii    u   utf-8u   encoding problem: utf-8(   u   decodeu   UnicodeDecodeErroru	   cookie_reu   findallu   lookupu   nameu   SyntaxError(   u   lineu   line_stringu   matchesu   encoding(   u	   bom_found(    u%   /mit/python/lib/python3.0/tokenize.pyu   find_cookie  s    
i   Nu   utf-8FT(   u   Falseu   Noneu
   startswithu   True(   u   readlineu   utf8_bomu   encodingu   read_or_stopu   find_cookieu   firstu   second(    (   u	   bom_foundu   readlineu%   /mit/python/lib/python3.0/tokenize.pyu   detect_encoding   s*    		c                sC   t     \ } }   f d   } t | |    } t | j |  S(   u  
    The tokenize() generator requires one argment, readline, which
    must be a callable object which provides the same interface as the
    readline() method of built-in file objects. Each call to the function
    should return one line of input as bytes.  Alternately, readline
    can be a callable function terminating with StopIteration:
        readline = open(myfile, 'rb').__next__  # Example of alternate readline

    The generator produces 5-tuples with these members: the token type; the
    token string; a 2-tuple (srow, scol) of ints specifying the row and
    column where the token begins in the source; a 2-tuple (erow, ecol) of
    ints specifying the row and column where the token ends in the source;
    and the line on which the token was found. The line passed is the
    logical line; continuation lines are included.

    The first token sequence will always be an ENCODING token
    which tells you which encoding was used to decode the bytes stream.
    c               3   s1   x* y     VWq t  k
 o d  SYq Xq d  S(   N(   u   StopIteration(    (   u   readline(    u%   /mit/python/lib/python3.0/tokenize.pyu   readline_generatorC  s
    (   u   detect_encodingu   chainu	   _tokenizeu   __next__(   u   readlineu   encodingu   consumedu   readline_generatoru   chained(    (   u   readlineu%   /mit/python/lib/python3.0/tokenize.pyu   tokenize/  s    c             c   s  d } } } t  j d d } } d \ } } d  }	 d g }
 | d  k	 o t | d d  d f Vn xHy |    } Wn t k
 o d } Yn X| d  k	 o | j |  } n | d } d t |  } } | o| p t d |   n | j |  } | oU | j	 d  } } t
 | | d  |  | | | f |	 | f Vd! \ } } d  }	 qx| oe | d d   d	 k oN | d
 d   d k o7 t | | | | t |  f |	 f Vd } d  }	 qe qx| | } |	 | }	 qe n| d k of| o^| p Pn d } x~ | | k  op | | d k o | d } nD | | d k o | t d t } n | | d k o
 d } n P| d } q	W| | k o Pn | | d k o | | d k o | | d   j d  } | t |  } t | | | f | | t |  f | f Vt | | d   | | f | t |  f | f Vqe t t f | | d k | | d   | | f | t |  f | f Vqe n | |
 d k o; |
 j |  t | d  |  | d f | | f | f Vn x | |
 d k  o` | |
 k o t d d | | | f   n |
 d  d  }
 t d | | f | | f | f VqWn' | p t d | d f   n d } x/| | k  o!t j | |  } | o| j d  \ } } | | f | | f | } } } | | |  | | } } | | k p' | d k o2 | d k o% | d k o t | | | | f Vq| d k o, | d k o t n t | | | | f Vq| d k o t | | | | f Vq| t k o t | } | j | |  } | o= | j	 d  } | | |  } t
 | | | | f | f Vqo| | f } | | d   } | }	 Pq| t k p. | d  d  t k p | d  d  t k o | d d k oV | | f } t | p t | d p t | d } | | d   d } } | }	 Pqot
 | | | | f Vq| | k o t | | | | f Vq| d k o
 d } q| d k o | d } n | d k o | d } n t | | | | f Vq{t | | | | f | | d f | f V| d } q{Wqe x8 |
 d d   D]& } t d | d f | d f d f VqWt d | d f | d f d f Vd  S("   Ni    u   _u
   0123456789u    s    i   u   EOF in multi-line stringiu   \
iu   \
u    u   	u   u   #
u   #u   
iu3   unindent does not match any outer indentation levelu
   <tokenize>u   EOF in multi-line statementu   .u   ...i   i   u   
u   \u   ([{u   )]}(   u    i    (   i    i    (   i    i    (   u    i    (   u   stringu   ascii_lettersu   Noneu   ENCODINGu   StopIterationu   decodeu   lenu
   TokenErroru   matchu   endu   STRINGu
   ERRORTOKENu   tabsizeu   rstripu   COMMENTu   NLu   appendu   INDENTu   IndentationErroru   DEDENTu
   pseudoprogu   spanu   NUMBERu   NEWLINEu   triple_quotedu   endprogsu   single_quotedu   NAMEu   OPu	   ENDMARKER(   u   readlineu   encodingu   lnumu   parenlevu	   continuedu	   namecharsu   numcharsu   contstru   needcontu   contlineu   indentsu   lineu   posu   maxu   strstartu   endprogu   endmatchu   endu   columnu   comment_tokenu   nl_posu   pseudomatchu   startu   sposu   eposu   tokenu   initialu   indent(    (    u%   /mit/python/lib/python3.0/tokenize.pyu	   _tokenizeM  s   	

5


     
 $$$ . )  '

  
 $c             C   s   t  |  d   S(   N(   u	   _tokenizeu   None(   u   readline(    (    u%   /mit/python/lib/python3.0/tokenize.pyu   generate_tokens  s    (   u   '''u   """u   r'''u   r"""u   R'''u   R"""u   b'''u   b"""u   B'''u   B"""u   br'''u   br"""u   Br'''u   Br"""u   bR'''u   bR"""u   BR'''u   BR"""(   u   'u   "u   r'u   r"u   R'u   R"u   b'u   b"u   B'u   B"u   br'u   br"u   Br'u   Br"u   bR'u   bR"u   BR'u   BR"(J   u   __doc__u
   __author__u   __credits__u   reu   stringu   sysu   tokenu   codecsu   lookupu	   itertoolsu   chainu   repeatu   compileu	   cookie_reu   diru   __all__u   N_TOKENSu   COMMENTu   tok_nameu   NLu   ENCODINGu   groupu   anyu   maybeu
   Whitespaceu   Commentu   Ignoreu   Nameu	   Hexnumberu	   Binnumberu	   Octnumberu	   Decnumberu	   Intnumberu   Exponentu
   Pointfloatu   Expfloatu   Floatnumberu
   Imagnumberu   Numberu   Singleu   Doubleu   Single3u   Double3u   Tripleu   Stringu   Operatoru   Bracketu   Specialu   Funnyu
   PlainTokenu   Tokenu   ContStru   PseudoExtrasu   PseudoTokenu   mapu	   tokenprogu
   pseudoprogu   single3progu   double3progu   Noneu   endprogsu   triple_quotedu   tu   single_quotedu   tabsizeu	   Exceptionu
   TokenErroru   StopTokenizingu   Untokenizeru
   untokenizeu   detect_encodingu   tokenizeu	   _tokenizeu   generate_tokens(    (    (    u%   /mit/python/lib/python3.0/tokenize.pyu   <module>   s   $






			
		
'#        J		=		