Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue30455

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:Generate all tokens related code and docs from Grammar/Tokens
Type:enhancementStage:resolved
Components:Interpreter Core, Library (Lib)Versions:Python 3.8
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To: serhiy.storchakaNosy List: Albert-Jan Nijburg, benjamin.peterson, matrixise, meador.inge, r.david.murray, serhiy.storchaka, vstinner
Priority:normalKeywords:patch

Created on2017-05-24 12:21 byserhiy.storchaka, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Pull Requests
URLStatusLinkedEdit
PR 1860closedserhiy.storchaka,2017-05-30 12:52
PR 9343emilyemorehouse,2018-09-17 14:46
PR 10370mergedserhiy.storchaka,2018-11-06 19:14
PR 10497emilyemorehouse,2018-11-20 19:28
Messages (12)
msg294350 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-05-24 12:21
CurrentlyLib/token.py is generated fromInclude/token.h. This contradicts common practice when the C code is generated from the Python code (see for example opcode.py and sre_constants.py). In additional the table inParser/tokenizer.c should be manually supported matchingInclude/token.h.GeneratingInclude/token.h andParser/tokenizer.c fromLib/token.py would be simpler and more reliable.
msg294356 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2017-05-24 14:29
I like the idea.
msg294361 -(view)Author: Stéphane Wirtel (matrixise)*(Python committer)Date: 2017-05-24 15:08
I can work on it
msg294363 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-05-24 15:20
I already write a patch.
msg294753 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-05-30 13:02
PR 1860 makes following files be generated from token.py:*Include/token.h*Parser/token.c. New file containing the array of token names _PyParser_TokenNames, and functions PyToken_OneChar(), PyToken_TwoChars(), PyToken_ThreeChars(), moved fromParser/tokenizer.c.*Doc/library/token-list.inc. New file containing the list of token.py constants, it is included inDoc/library/token.rst.New Makefile target regen-token regenerates these files.The dict EXACT_TOKEN_TYPES that maps operator strings to token names now is automatically generated and moved from tokenize.py to token.py. Tokens COMMENT, NL and ENCODING used only in tokenize.py now are added in token.py as inissue25324.
msg294754 -(view)Author: Albert-Jan Nijburg (Albert-Jan Nijburg)*Date: 2017-05-30 13:14
I think this covers all the changes from PR#1608. Looks a lot nicer too, building it every time from the make file. You may want to add to the docs that token.py is now the source of the tokens.
msg294833 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2017-05-31 11:10
The regular expression tokenize.Funny also can be generated. Information is not enough for distinguish between Operator, Bracket and Special, but seems this isn't needed.Some token names can be generated fromGrammar/Grammar. But needed an additional mapping for relations between token strings and names ('+' <-> PLUS, etc).
msg329375 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2018-11-06 19:18
AlternatePR 10370 generates all files from a single fileGrammar/Tokens using a single scriptTools/scripts/generate_token.py.In addition, the script doesn't write files when the content is not changed. Thus it can be used with read-only sources.
msg330053 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2018-11-18 17:25
Could anybody please make a review? There are two alternate PRs:PR 1860 andPR 10370. The difference between them is that the former one usesLib/token.py as a source, and the latter one usesGrammar/Tokens as a source and generatesLib/token.py too.
msg332195 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2018-12-20 07:54
If there are no objections I am going to mergePR 10370 in few days.
msg332205 -(view)Author: STINNER Victor (vstinner)*(Python committer)Date: 2018-12-20 09:57
> If there are no objections I am going to mergePR 10370 in few days.LGTM. I guess thatPR 9343 should be closed oncePR 10370 is merged.
msg332459 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2018-12-24 14:48
New changeset8ac658114dec4964479baecfbc439fceb40eaa79 by Serhiy Storchaka in branch 'master':bpo-30455: Generate all token related code and docs fromGrammar/Tokens. (GH-10370)https://github.com/python/cpython/commit/8ac658114dec4964479baecfbc439fceb40eaa79
History
DateUserActionArgs
2022-04-11 14:58:46adminsetgithub: 74640
2018-12-24 14:48:06serhiy.storchakasetmessages: +msg332459
2018-12-22 09:26:57serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-12-20 09:57:27vstinnersetmessages: +msg332205
2018-12-20 07:54:30serhiy.storchakasetmessages: +msg332195
2018-11-20 19:28:26emilyemorehousesetpull_requests: +pull_request9865
2018-11-18 17:25:34serhiy.storchakasetmessages: +msg330053
2018-11-06 19:27:01serhiy.storchakasettitle: Generate C code from token.py and not vice versa -> Generate all tokens related code and docs from Grammar/Tokens
versions: + Python 3.8, - Python 3.7
2018-11-06 19:18:30serhiy.storchakasetmessages: +msg329375
2018-11-06 19:14:43serhiy.storchakasetpull_requests: +pull_request9671
2018-09-17 14:46:12emilyemorehousesetpull_requests: +pull_request8783
2018-02-14 10:32:23serhiy.storchakasetpull_requests: -pull_request5479
2018-02-14 10:31:47zach.waresetkeywords: +patch
pull_requests: +pull_request5479
2017-05-31 11:10:44serhiy.storchakasetmessages: +msg294833
2017-05-30 13:14:53Albert-Jan Nijburgsetmessages: +msg294754
2017-05-30 13:02:08serhiy.storchakasetmessages: +msg294753
stage: patch review
2017-05-30 12:52:07serhiy.storchakasetpull_requests: +pull_request1943
2017-05-24 15:20:37serhiy.storchakasetassignee:serhiy.storchaka
messages: +msg294363
2017-05-24 15:08:17matrixisesetnosy: +matrixise
messages: +msg294361
2017-05-24 14:29:18vstinnersetmessages: +msg294356
2017-05-24 12:21:49serhiy.storchakacreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp