Skip to content

gh-153569: hide tokenizer state behind token and source operations - #156654

Draft
pablogsal wants to merge 4 commits into
python:mainfrom
pablogsal:gh-153569-tokenizer-source-ftstring-clean
Draft

gh-153569: hide tokenizer state behind token and source operations#156654
pablogsal wants to merge 4 commits into
python:mainfrom
pablogsal:gh-153569-tokenizer-source-ftstring-clean

Conversation

@pablogsal

@pablogsal pablogsal commented Aug 30, 2026

Copy link
Copy Markdown
Member

Make pegen and _tokenize consume tokenizer operations instead of accessing the tokenizer layout. Return token kind, span, location, and raw-string context together, so parser actions use the context of the cached token.

Represent persistent scanner positions as offsets and remove pointer save/restore bookkeeping when input storage grows.

Part of gh-153569.

Previous: #156484. Next: #157055.

Please do not review until #156484 lands.

@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-source-ftstring-clean branch 4 times, most recently from b2bc8d1 to d9b2b16 Compare August 30, 2026 13:16
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-source-ftstring-clean branch 4 times, most recently from 9ce1fd9 to afd9d72 Compare September 5, 2026 17:46
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-source-ftstring-clean branch from afd9d72 to f72cb2b Compare September 5, 2026 19:17
@pablogsal pablogsal changed the title gh-153569: simplify tokenizer source and formatted-string state gh-153569: finish tokenizer offsets, diagnostics, and opaque API Sep 5, 2026
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-source-ftstring-clean branch 3 times, most recently from 7e5d82c to 9240806 Compare September 6, 2026 20:57
@pablogsal pablogsal changed the title gh-153569: finish tokenizer offsets, diagnostics, and opaque API gh-153569: finish tokenizer offsets and the opaque API cutover Sep 6, 2026
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-source-ftstring-clean branch 4 times, most recently from 0eb2ce0 to 6f220e4 Compare September 6, 2026 23:35
@pablogsal pablogsal closed this Sep 6, 2026
@pablogsal pablogsal reopened this Sep 6, 2026
@pablogsal
pablogsal force-pushed the gh-153569-tokenizer-source-ftstring-clean branch from 6f220e4 to bbc061f Compare September 7, 2026 00:03
@pablogsal pablogsal changed the title gh-153569: finish tokenizer offsets and the opaque API cutover gh-153569: hide tokenizer state behind token and source operations Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant