Skip to content

gh-153568: Skip PEG alternatives that cannot match the next token - #160458

Open
lysnikolaou wants to merge 2 commits into
python:mainfrom
lysnikolaou:pegen-first-set-dispatch
Open

lysnikolaou wants to merge 2 commits into
python:mainfrom
lysnikolaou:pegen-first-set-dispatch

Conversation

@lysnikolaou

@lysnikolaou lysnikolaou commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Rules with several alternatives now switch on the next token's type and only try the alternatives that may start with it. Loops stop as soon as the next token cannot start another iteration. Both use FIRST sets from a new analysis, which also replaces the old first_sets.py calculator.

Rules with several alternatives now switch on the next token's type and
only try the alternatives that may start with it. Loops stop as soon as
the next token cannot start another iteration. Both use FIRST sets from
a new analysis, which also replaces the old first_sets.py calculator.

Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
@bedevere-app bedevere-app Bot added awaiting core review type-feature A feature request or enhancement labels Oct 23, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant