Permalink
Please
sign in to comment.
Browse files
bpo-30455: Generate all token related code and docs from Grammar/Toke…
…ns. (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.
- Loading branch information...
Showing
with
940 additions
and 462 deletions.
- +4 −0 .gitattributes
- +206 −0 Doc/library/token-list.inc
- +1 −58 Doc/library/token.rst
- +62 −0 Grammar/Tokens
- +3 −8 Include/token.h
- +6 −14 Lib/symbol.py
- +4 −1 Lib/test/test_symbol.py
- +2 −0 Lib/test/test_tokenize.py
- +52 −82 Lib/token.py
- +6 −60 Lib/tokenize.py
- +34 −2 Makefile.pre.in
- +2 −0 Misc/NEWS.d/next/Core and Builtins/2018-04-14-11-02-57.bpo-30455.ANRwjo.rst
- +1 −0 PCbuild/pythoncore.vcxproj
- +3 −0 PCbuild/pythoncore.vcxproj.filters
- +233 −0 Parser/token.c
- +0 −237 Parser/tokenizer.c
- +53 −0 Tools/scripts/generate_symbol_py.py
- +268 −0 Tools/scripts/generate_token.py
| @@ -0,0 +1,62 @@ | |||
| ENDMARKER | |||
| NAME | |||
| NUMBER | |||
| STRING | |||
| NEWLINE | |||
| INDENT | |||
| DEDENT | |||
|
|
|||
| LPAR '(' | |||
| RPAR ')' | |||
| LSQB '[' | |||
| RSQB ']' | |||
| COLON ':' | |||
| COMMA ',' | |||
| SEMI ';' | |||
| PLUS '+' | |||
| MINUS '-' | |||
| STAR '*' | |||
| SLASH '/' | |||
| VBAR '|' | |||
| AMPER '&' | |||
| LESS '<' | |||
| GREATER '>' | |||
| EQUAL '=' | |||
| DOT '.' | |||
| PERCENT '%' | |||
| LBRACE '{' | |||
| RBRACE '}' | |||
| EQEQUAL '==' | |||
| NOTEQUAL '!=' | |||
| LESSEQUAL '<=' | |||
| GREATEREQUAL '>=' | |||
| TILDE '~' | |||
| CIRCUMFLEX '^' | |||
| LEFTSHIFT '<<' | |||
| RIGHTSHIFT '>>' | |||
| DOUBLESTAR '**' | |||
| PLUSEQUAL '+=' | |||
| MINEQUAL '-=' | |||
| STAREQUAL '*=' | |||
| SLASHEQUAL '/=' | |||
| PERCENTEQUAL '%=' | |||
| AMPEREQUAL '&=' | |||
| VBAREQUAL '|=' | |||
| CIRCUMFLEXEQUAL '^=' | |||
| LEFTSHIFTEQUAL '<<=' | |||
| RIGHTSHIFTEQUAL '>>=' | |||
| DOUBLESTAREQUAL '**=' | |||
| DOUBLESLASH '//' | |||
| DOUBLESLASHEQUAL '//=' | |||
| AT '@' | |||
| ATEQUAL '@=' | |||
| RARROW '->' | |||
| ELLIPSIS '...' | |||
|
|
|||
| OP | |||
| ERRORTOKEN | |||
|
|
|||
| # These aren't used by the C tokenizer but are needed for tokenize.py | |||
| COMMENT | |||
| NL | |||
| ENCODING | |||
Oops, something went wrong.
0 comments on commit
8ac6581