Skip to content

gh-159672: Generate keyword typo hints in the parser - #159673

Draft
pablogsal wants to merge 7 commits into
python:mainfrom
pablogsal:keyword-typo-token-replay
Draft

pablogsal wants to merge 7 commits into
python:mainfrom
pablogsal:keyword-typo-token-replay

Conversation

@pablogsal

@pablogsal pablogsal commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Move keyword typo hints into the parser and attach the result to SyntaxError. Replay private token copies through the grammar, with one replacement per trial. Remove source recompilation and statement-location metadata from traceback.

Search the complete logical statement and count adjacent letter swaps as one edit. Preserve comma diagnostics and support typos that spell another keyword.

Limit the search to 256 KiB, 32,768 tokens, 32 candidates, and 5 million rule entries across all trials. Keep the normal parser's fast stack check.

Fixes #159672.

@pablogsal pablogsal added type-feature A feature request or enhancement interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Oct 18, 2026
@pablogsal
pablogsal force-pushed the keyword-typo-token-replay branch from 176b6b7 to f05a255 Compare October 18, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move keyword typo suggestions into the parser

1 participant