diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-12-22 09:18:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-22 09:18:40 (GMT) |
commit | 8ac658114dec4964479baecfbc439fceb40eaa79 (patch) | |
tree | e66c4c3beda293a6fdf01763306697d15d0af157 /Include/token.h | |
parent | c1b4b0f6160e1919394586f44b12538505fed300 (diff) | |
download | cpython-8ac658114dec4964479baecfbc439fceb40eaa79.zip cpython-8ac658114dec4964479baecfbc439fceb40eaa79.tar.gz cpython-8ac658114dec4964479baecfbc439fceb40eaa79.tar.bz2 |
bpo-30455: Generate all token related code and docs from Grammar/Tokens. (GH-10370)
"Include/token.h", "Lib/token.py" (containing now some data moved from
"Lib/tokenize.py") and new files "Parser/token.c" (containing the code
moved from "Parser/tokenizer.c") and "Doc/library/token-list.inc" (included
in "Doc/library/token.rst") are now generated from "Grammar/Tokens" by
"Tools/scripts/generate_token.py". The script overwrites files only if
needed and can be used on the read-only sources tree.
"Lib/symbol.py" is now generated by "Tools/scripts/generate_symbol_py.py"
instead of been executable itself.
Added new make targets "regen-token" and "regen-symbol" which are now
dependencies of "regen-all".
The documentation contains now strings for operators and punctuation tokens.
Diffstat (limited to 'Include/token.h')
-rw-r--r-- | Include/token.h | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/Include/token.h b/Include/token.h index cd1cd00..2d491e6 100644 --- a/Include/token.h +++ b/Include/token.h @@ -1,3 +1,4 @@ +/* Auto-generated by Tools/scripts/generate_token.py */ /* Token types */ #ifndef Py_LIMITED_API @@ -62,25 +63,19 @@ extern "C" { #define ATEQUAL 50 #define RARROW 51 #define ELLIPSIS 52 -/* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */ #define OP 53 #define ERRORTOKEN 54 -/* These aren't used by the C tokenizer but are needed for tokenize.py */ -#define COMMENT 55 -#define NL 56 -#define ENCODING 57 #define N_TOKENS 58 +#define NT_OFFSET 256 /* Special definitions for cooperation with parser */ -#define NT_OFFSET 256 - #define ISTERMINAL(x) ((x) < NT_OFFSET) #define ISNONTERMINAL(x) ((x) >= NT_OFFSET) #define ISEOF(x) ((x) == ENDMARKER) -PyAPI_DATA(const char *) _PyParser_TokenNames[]; /* Token names */ +PyAPI_DATA(const char * const) _PyParser_TokenNames[]; /* Token names */ PyAPI_FUNC(int) PyToken_OneChar(int); PyAPI_FUNC(int) PyToken_TwoChars(int, int); PyAPI_FUNC(int) PyToken_ThreeChars(int, int, int); |