Kaydet (Commit) ebd662d6 authored tarafından Georg Brandl's avatar Georg Brandl

#3028: tokenize passes the physical line.

üst 2fe3ef87
...@@ -15,21 +15,20 @@ for on-screen displays. ...@@ -15,21 +15,20 @@ for on-screen displays.
The primary entry point is a :term:`generator`: The primary entry point is a :term:`generator`:
.. function:: generate_tokens(readline) .. function:: generate_tokens(readline)
The :func:`generate_tokens` generator requires one argument, *readline*, which The :func:`generate_tokens` generator requires one argument, *readline*,
must be a callable object which provides the same interface as the which must be a callable object which provides the same interface as the
:meth:`readline` method of built-in file objects (see section :meth:`readline` method of built-in file objects (see section
:ref:`bltin-file-objects`). Each call to the function should return one line of :ref:`bltin-file-objects`). Each call to the function should return one line
input as a string. of input as a string.
The generator produces 5-tuples with these members: the token type; the token 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 string; a 2-tuple ``(srow, scol)`` of ints specifying the row and column
the token begins in the source; a 2-tuple ``(erow, ecol)`` of ints specifying where the token begins in the source; a 2-tuple ``(erow, ecol)`` of ints
the row and column where the token ends in the source; and the line on which the specifying the row and column where the token ends in the source; and the
token was found. The line passed is the *logical* line; continuation lines are line on which the token was found. The line passed is the *physical* line,
included. that is, continuation lines are not handled specially.
.. versionadded:: 2.2 .. versionadded:: 2.2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment