mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
gh-105069: Add a readline-like callable to the tokenizer to consume input iteratively (#105070)
This commit is contained in:
parent
2ea34cfb3a
commit
9216e69a87
7 changed files with 276 additions and 98 deletions
|
|
@ -109,6 +109,7 @@ struct tok_state {
|
|||
expression (cf. issue 16806) */
|
||||
PyObject *decoding_readline; /* open(...).readline */
|
||||
PyObject *decoding_buffer;
|
||||
PyObject *readline; /* readline() function */
|
||||
const char* enc; /* Encoding for the current str. */
|
||||
char* str; /* Source string being tokenized (if tokenizing from a string)*/
|
||||
char* input; /* Tokenizer's newline translated copy of the string. */
|
||||
|
|
@ -137,6 +138,7 @@ struct tok_state {
|
|||
|
||||
extern struct tok_state *_PyTokenizer_FromString(const char *, int, int);
|
||||
extern struct tok_state *_PyTokenizer_FromUTF8(const char *, int, int);
|
||||
extern struct tok_state *_PyTokenizer_FromReadline(PyObject*, const char*, int, int);
|
||||
extern struct tok_state *_PyTokenizer_FromFile(FILE *, const char*,
|
||||
const char *, const char *);
|
||||
extern void _PyTokenizer_Free(struct tok_state *);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue