gh-153569: Add tokenizer source and cursor primitives#153587
Open
pablogsal wants to merge 3 commits into
Open
Conversation
pablogsal
marked this pull request as ready for review
July 11, 2026 19:26
pablogsal
requested review from
a team,
AA-Turner,
emmatyping,
ericsnowcurrently,
erlend-aasland,
itamaro and
lysnikolaou
as code owners
July 11, 2026 19:26
pablogsal
marked this pull request as draft
July 11, 2026 19:27
pablogsal
force-pushed
the
gh-153569-tokenizer-offset-api
branch
from
July 11, 2026 19:38
bce3caa to
2682fe5
Compare
pablogsal
marked this pull request as ready for review
July 11, 2026 20:37
pablogsal
force-pushed
the
gh-153569-tokenizer-offset-api
branch
from
July 11, 2026 21:15
2682fe5 to
1bf43aa
Compare
maurycy
reviewed
Jul 11, 2026
pablogsal
enabled auto-merge (squash)
July 18, 2026 12:55
pablogsal
disabled auto-merge
July 18, 2026 12:55
pablogsal
force-pushed
the
gh-153569-tokenizer-offset-api
branch
from
July 18, 2026 13:56
b19b995 to
0dea29d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds the decoded source store, offset spans, and an offset-only cursor as the foundation for moving tokenizer state away from buffer pointers.
For example:
This PR only adds these primitives and their direct tests. It does not migrate the existing readers, lexer and f-string state, pegen, or
_tokenize; those changes can be built on this API in separate PRs.