rest25/library/tokenize.rst => rest262/library/tokenize.rst
8.. sectionauthor:: Fred L. Drake, Jr. <fdrake@acm.org>
9
10
11The :mod:`tokenize` module provides a lexical scanner for Python source code,
12implemented in Python.  The scanner in this module returns comments as tokens as
13well, making it useful for implementing "pretty-printers," including colorizers
14for on-screen displays.
15
n16-The primary entry point is a generator:
n16+The primary entry point is a :term:`generator`:
17- 
18
19.. function:: generate_tokens(readline)
20
n21-   The :func:`generate_tokens` generator requires one argment, *readline*, which
n20+   The :func:`generate_tokens` generator requires one argument, *readline*,
22-   must be a callable object which provides the same interface as the
21+   which must be a callable object which provides the same interface as the
23   :meth:`readline` method of built-in file objects (see section
n24-   :ref:`bltin-file-objects`).  Each call to the function should return one line of
n23+   :ref:`bltin-file-objects`).  Each call to the function should return one line
25-   input as a string.
24+   of input as a string.
26
27   The generator produces 5-tuples with these members: the token type; the token
t28-   string; a 2-tuple ``(srow, scol)`` of ints specifying the row and column where
t27+   string; a 2-tuple ``(srow, scol)`` of ints specifying the row and column
29-   the token begins in the source; a 2-tuple ``(erow, ecol)`` of ints specifying
28+   where the token begins in the source; a 2-tuple ``(erow, ecol)`` of ints
30-   the row and column where the token ends in the source; and the line on which the
29+   specifying the row and column where the token ends in the source; and the
31-   token was found. The line passed is the *logical* line; continuation lines are
30+   line on which the token was found.  The line passed (the last tuple item) is
32-   included.
31+   the *logical* line; continuation lines are included.
33
34   .. versionadded:: 2.2
35
36An older entry point is retained for backward compatibility:
37
38
39.. function:: tokenize(readline[, tokeneater])
40
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op