File: //usr/lib/python3.7/lib2to3/pgen2/__pycache__/tokenize.cpython-37.pyc
B
5aYR
@ s d Z dZdZddlZddlZddlmZmZ ddlT ddl m
Z
d d
ee
D ddd
g Z[
ye
W n ek
r~ eZ
Y nX dd Zdd Zdd Zdd ZdZdZeede ee ZdZdZdZdZeddZeeeeeZdZed d!ee Zd"e ZeeeZ ed#e d$ Z!ee!e eZ"d%Z#d&Z$d'Z%d(Z&d)Z'ee'd* e'd+ Z(ee'd, e'd- Z)ed.d/d0d1d2d3d4d5d6 Z*d7Z+ed8d9Z,ee*e+e,Z-ee"e-e)eZ.ee. Z/ee'd: ed;d e'd< ed=d Z0edee(Z1eee1e"e-e0e Z2e3ej4e/e2e%e&f\Z5Z6Z7Z8ed>d?d@dAed>d?dBdCB dDdEdFdGdHdIhB Z9e4e#e4e$e7e8dJdKdL e9D dMdL e9D dNdL e9D Z:d*d+hdOdP e9D B dQdP e9D B Z;d;d=hdRdP e9D B dSdP e9D B Z<dTZ=G dUdV dVe>Z?G dWdX dXe>Z@dYdZ ZAeAfd[dZBd\d] ZCG d^d_ d_ZDe4d`ejEZFe4daejEZGdbdc ZHddde ZIdfd
ZJdgd ZKeLdhkrddlMZMeNeMjOdkreBePeMjOd jQ neBeMjRjQ dS )ia 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_UTF8lookup)* )tokenc C s g | ]}|d dkr|qS )r _ ).0xr r ,/usr/lib/python3.7/lib2to3/pgen2/tokenize.py
<listcomp>% s r tokenizegenerate_tokens
untokenizec G s dd | d S )N(|))join)choicesr r r group0 r c G s t | d S )Nr )r )r r r r any1 r r c G s t | d S )N?)r )r r r r maybe2 r r c s t fdd D S )Nc 3 s4 | ],} d D ]}| | kr|| V qqdS )) N)casefold)r r
y)lr r <genexpr>5 s z _combinations.<locals>.<genexpr>)set)r r )r r
_combinations3 s r z[ \f\t]*z #[^\r\n]*z\\\r?\nz\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][fFbB]|[fFbBuU][rR])?z'''z"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"z\*\*=?z>>=?z<<=?z<>z!=z//=?z->z[+\-*/%&@|^=<>]=?~z[][(){}]z\r?\nz[:;.,`@]z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"rRfFbBuUZurZuRZUrZUR)r"