Your IP : 3.135.208.236


Current Path : /opt/alt/python36/lib64/python3.6/lib2to3/pgen2/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/lib2to3/pgen2/__pycache__/tokenize.cpython-36.pyc

3

� fNX�=@s�dZdZdZddlZddlZddlmZmZddlTddl	m
Z
d	d
�ee
�D�ddd
gZ[
ye
Wnek
r~eZ
YnXdd�Zdd�Zdd�ZdZdZeede�ee�ZdZdZdZdZedd�Zeeeee�ZdZedd�ee�Zd eZeee�Zed!ed"�Z ee ee�Z!d#Z"d$Z#d%Z$d&Z%d'Z&ee&d(e&d)�Z'ee&d*e&d+�Z(ed,d-d.d/d0d1d2d3d4�	Z)d5Z*ed6d7�Z+ee)e*e+�Z,ee!e,e(e�Z-ee-Z.ee&d8ed9d�e&d:ed;d��Z/edee'�Z0eee0e!e,e/e�Z1e2e3ej4e.e1e$e%f��\Z5Z6Z7Z8ej4e"�ej4e#�e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8e7e8ddddddddd<�4Z9iZ:xd�D]Z;e;e:e;<�q�WiZ<xd�D]Z;e;e<e;<�q�Wd�Z=Gd�d��d�e>�Z?Gd�d��d�e>�Z@d�d��ZAeAfd�d�ZBd�d��ZCGd�d��d��ZDej4d�ejE�ZFej4d�ejE�ZGd�d��ZHd�d��ZId�d
�ZJd�d�ZKeLd�k�r�ddlMZMeNeMjO�dk�r|eBePeMjOd�jQ�neBeMjRjQ�dS)�a�Tokenization help for Python programs.

generate_tokens(readline) is a generator that breaks a stream of
text into Python tokens.  It accepts a readline-like method which is called
repeatedly to get the next line of input (or "" 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

Older entry points
    tokenize_loop(readline, tokeneater)
    tokenize(readline, tokeneater=printtoken)
are the same, except instead of generating tokens, tokeneater is a callback
function to which the 5 fields described above are passed as 5 arguments,
each time a new token is found.zKa-Ping Yee <ping@lfw.org>z@GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip Montanaro�N)�BOM_UTF8�lookup)�*�)�tokencCsg|]}|ddkr|�qS)r�_�)�.0�xrr�;/opt/alt/python36/lib64/python3.6/lib2to3/pgen2/tokenize.py�
<listcomp>%sr�tokenize�generate_tokens�
untokenizecGsddj|�dS)N�(�|�))�join)�choicesrrr�group0srcGst|�dS)Nr)r)rrrr�any1srcGst|�dS)N�?)r)rrrr�maybe2srz[ \f\t]*z	#[^\r\n]*z\\\r?\nz[a-zA-Z_]\w*z0[bB]_?[01]+(?:_[01]+)*z(0[xX]_?[\da-fA-F]+(?:_[\da-fA-F]+)*[lL]?z0[oO]?_?[0-7]+(?:_[0-7]+)*[lL]?z[1-9]\d*(?:_\d+)*[lL]?z0[lL]?z[eE][-+]?\d+(?:_\d+)*z\d+(?:_\d+)*\.(?:\d+(?:_\d+)*)?z\.\d+(?:_\d+)*z\d+(?:_\d+)*z\d+(?:_\d+)*[jJ]z[jJ]z[^'\\]*(?:\\.[^'\\]*)*'z[^"\\]*(?:\\.[^"\\]*)*"z%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''z%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""z#(?:[uUrRbBfF]|[rR][bB]|[bBuU][rR])?�'''�"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"z\*\*=?z>>=?z<<=?z<>z!=z//=?z->z[+\-*/%&@|^=<>]=?�~z[][(){}]z\r?\nz[:;.,`@]z'[^\n'\\]*(?:\\.[^\n'\\]*)*�'z"[^\n"\\]*(?:\\.[^\n"\\]*)*�")4rrz'''z"""zr'''zr"""zu'''zu"""zb'''zb"""zf'''zf"""zur'''zur"""zbr'''zbr"""zrb'''zrb"""zR'''zR"""zU'''zU"""zB'''zB"""zF'''zF"""zuR'''zuR"""zUr'''zUr"""zUR'''zUR"""zbR'''zbR"""zBr'''zBr"""zBR'''zBR"""zrB'''zrB"""zRb'''zRb"""zRB'''zRB"""�r�R�u�U�f�F�b�B�r'''�r"""�R'''�R"""�u'''�u"""�U'''�U"""�b'''�b"""�B'''�B"""�f'''�f"""�F'''�F"""�ur'''�ur"""�Ur'''�Ur"""�uR'''�uR"""�UR'''�UR"""�br'''�br"""�Br'''�Br"""�bR'''�bR"""�BR'''�BR"""�rb'''�rb"""�Rb'''�Rb"""�rB'''�rB"""�RB'''�RB"""�r'�r"�R'�R"�u'�u"�U'�U"�b'�b"�B'�B"�f'�f"�F'�F"�ur'�ur"�Ur'�Ur"�uR'�uR"�UR'�UR"�br'�br"�Br'�Br"�bR'�bR"�BR'�BR"�rb'�rb"�Rb'�Rb"�rB'�rB"�RB'�RB"�c@seZdZdS)�
TokenErrorN)�__name__�
__module__�__qualname__rrrrrw�srwc@seZdZdS)�StopTokenizingN)rxryrzrrrrr{�sr{c		Cs4|\}}|\}}td||||t|t|�f�dS)Nz%d,%d-%d,%d:	%s	%s)�print�tok_name�repr)	�typerZxxx_todo_changemeZxxx_todo_changeme1�lineZsrowZscolZerowZecolrrr�
printtoken�sr�cCs(yt||�Wntk
r"YnXdS)a:
    The tokenize() function accepts two parameters: one representing the
    input stream, and one providing an output mechanism for tokenize().

    The first parameter, readline, 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 a string.

    The second parameter, tokeneater, must also be a callable object. It is
    called once for each token, with five arguments, corresponding to the
    tuples generated by generate_tokens().
    N)�
tokenize_loopr{)�readline�
tokeneaterrrrr
�s
cCsxt|�D]}||�q
WdS)N)r)r�r�Z
token_inforrrr��sr�c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�UntokenizercCsg|_d|_d|_dS)Nrr)�tokens�prev_row�prev_col)�selfrrr�__init__�szUntokenizer.__init__cCs8|\}}||jkst�||j}|r4|jjd|�dS)N� )r��AssertionErrorr�r��append)r��start�row�col�
col_offsetrrr�add_whitespace�s

zUntokenizer.add_whitespacecCs�xv|D]n}t|�dkr$|j||�P|\}}}}}|j|�|jj|�|\|_|_|ttfkr|jd7_d|_qWdj	|j�S)N�rr�)
�len�compatr�r�r�r�r��NEWLINE�NLr)r��iterable�t�tok_typerr��endr�rrrr�s


zUntokenizer.untokenizec	Cs�d}g}|jj}|\}}|ttfkr,|d7}|ttfkr<d}x�|D]�}|dd�\}}|ttttfkrn|d7}|tkr�|j|�qBn>|t	kr�|j
�qBn*|ttfkr�d}n|r�|r�||d�d}||�qBWdS)NFr�Tr�r���)r�r��NAME�NUMBERr�r��ASYNC�AWAIT�INDENT�DEDENT�pop)	r�rr��	startline�indents�toks_append�toknum�tokval�tokrrrr��s0

zUntokenizer.compatN)rxryrzr�r�rr�rrrrr��sr�z&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)cCsH|dd�j�jdd�}|dks*|jd�r.dS|d
ks@|jd�rDdS|S)z(Imitates get_normal_name in tokenizer.c.N�r�-zutf-8zutf-8-�latin-1�
iso-8859-1�iso-latin-1�latin-1-�iso-8859-1-�iso-latin-1-)r�r�r�)r�r�r�)�lower�replace�
startswith)�orig_enc�encrrr�_get_normal_names
r�cs�d�d}d}�fdd�}�fdd�}|�}|jt�rHd�|d	d�}d
}|sT|gfS||�}|rj||gfStj|�s~||gfS|�}|s�||gfS||�}|r�|||gfS|||gfS)a
    The detect_encoding() function is used to detect the encoding that should
    be used to decode a Python source file. It requires one argument, 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 the encoding cookie is an invalid
    charset, raise a SyntaxError.  Note that if a utf-8 bom is found,
    'utf-8-sig' is returned.

    If no encoding is specified, then the default of 'utf-8' will be returned.
    FNzutf-8cs"y��Stk
rt�SXdS)N)�
StopIteration�bytesr)r�rr�read_or_stop sz%detect_encoding.<locals>.read_or_stopcs�y|jd�}Wntk
r"dSXtj|�}|s6dSt|jd��}yt|�}Wn tk
rptd|��YnX�r�|j	dkr�td��|d7}|S)N�asciirzunknown encoding: zutf-8zencoding problem: utf-8z-sig)
�decode�UnicodeDecodeError�	cookie_re�matchr�rr�LookupError�SyntaxError�name)r��line_stringr��encoding�codec)�	bom_foundrr�find_cookie&s"

z$detect_encoding.<locals>.find_cookieT�z	utf-8-sig)r�r�blank_rer�)r�r��defaultr�r��first�secondr)r�r�r�detect_encodings0




r�cCst�}|j|�S)a�Transform tokens back into Python source code.

    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 text will tokenize the back to the input
        t1 = [tok[:2] for tok in generate_tokens(f.readline)]
        newcode = untokenize(t1)
        readline = iter(newcode.splitlines(1)).next
        t2 = [tok[:2] for tokin generate_tokens(readline)]
        assert t1 == t2
    )r�r)r��utrrrrTsc!cs�d}}}tjdd}}d \}}d}dg}	d}
d}d}d}
�xy
|�}Wntk
rdd}YnX|d}dt|�}}|�rF|s�td|��|j|�}|r�|jd�}}t||d|�|||f||fVd!\}}d}nd|�r0|d"d�d
k�r0|d#d�dk�r0t||||t|�f|fVd}d}qBn||}||}qB�nF|dk�rt|�rt|�s`Pd}xf||k�r�||d
k�r�|d}n6||dk�r�|t	dt	}n||dk�r�d}nP|d}�qfW||k�r�P|
�r�|
Vd}
||dk�r�||dk�rh||d�j
d�}|t|�}t|||f||t|�f|fVt||d�||f|t|�f|fVqBttf||dk||d�||f|t|�f|fVqB||	d$k�r�|	j
|�t|d|�|df||f|fVxt||	d%k�rJ||	k�rtdd|||f��|	dd&�}	|�r.||	d'k�r.d}d}
d}td||f||f|fV�q�W|�r�|
�r�||	d(k�r�d}d}
d}n|�s�td|df��d}�x�||k�rJtj||�}|�r|jd�\}}||f||f|}}}|||�||}}||k�s|dk�r|dk�rt||||fV�qF|dk�rft}|dk�r8t}n
|�rBd}
|
�rR|
Vd}
|||||fV�qF|dk�r�|jd��s�t�|
�r�|
Vd}
t||||fV�qF|tk�r$t|}|j||�}|�r|jd�}|||�}|
�r�|
Vd}
t||||f|fVn||f}||d�}|}P�qF|tk�sR|dd	�tk�sR|dd�tk�r�|d)dk�r�||f}t|�p�t|d�p�t|d	}||d�d}}|}Pn |
�r�|
Vd}
t||||fV�qF||k�r�|d*k�r|�r|dk�r�tnt||||fV�q�t||||f}|dk�r.|
�r.|}
�q�|dk�r�|
�r�|
dtk�r�|
ddk�r�d}|	d+}t|
d|
d	|
d|
dfVd}
|
�r�|
Vd}
|Vnz|dk�r�|
�r�|
Vd}
t||||f|fVd}nF|dk�r�|d}n|dk�r�|d}|
�r|
Vd}
t||||fVn(t||||f||df|fV|d}�q�WqBW|
�r`|
Vd}
x.|	dd�D]} td|df|dfdfV�qnWtd|df|dfdfVdS),aT
    The generate_tokens() generator requires one argument, 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 a string.  Alternately, readline
    can be a callable function terminating with StopIteration:
        readline = open(myfile).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.
    rr�
0123456789r�NFrzEOF in multi-line stringr�z\
r�z\
r��	�z#
�#z
z3unindent does not match any outer indentation levelz
<tokenize>zEOF in multi-line statement�.T�
�async�await�def��\z([{z)]})r�r)r�r������r�r�r�r�r�r�)r�r�r�)�stringZ
ascii_lettersr�r�rwr�r��STRING�
ERRORTOKEN�tabsize�rstrip�COMMENTr�r�r��IndentationErrorr��
pseudoprog�spanr�r��endswithr��
triple_quoted�endprogs�
single_quotedr�r�r��OP�	ENDMARKER)!r��lnum�parenlev�	continuedZ	namechars�numchars�contstr�needcont�contliner��stashed�	async_def�async_def_indent�async_def_nlr��pos�max�strstart�endprog�endmatchr��column�
comment_token�nl_pos�pseudomatchr��spos�eposr�initial�newliner��indentrrrrisr



*


 














�__main__)*rrr&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLrM)*rrrNrOrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtru)S�__doc__�
__author__�__credits__r��re�codecsrrZlib2to3.pgen2.tokenr�r�dir�__all__r��	NameError�strrrr�
Whitespace�Comment�Ignore�Name�	Binnumber�	Hexnumber�	Octnumber�	Decnumber�	Intnumber�Exponent�
Pointfloat�Expfloat�Floatnumber�
Imagnumber�Number�Single�Double�Single3�Double3Z
_litprefix�Triple�String�Operator�Bracket�Special�Funny�
PlainToken�Token�ContStr�PseudoExtras�PseudoToken�list�map�compileZ	tokenprogr�Zsingle3progZdouble3progr�r�r�r�r��	Exceptionrwr{r�r
r�r��ASCIIr�r�r�r�rrrx�sysr��argv�openr��stdinrrrr�<module>s�







8Ic


?>