Skip to content

Fix Many looping forever when inner parser succeeds without advancing - #93

Merged
SeanTAllen merged 1 commit into
mainfrom
fix-many-infinite-loop
Aug 24, 2026
Merged

Fix Many looping forever when inner parser succeeds without advancing#93
SeanTAllen merged 1 commit into
mainfrom
fix-many-infinite-loop

Conversation

@SeanTAllen

Copy link
Copy Markdown
Member

Many's loop assumed the inner parser would either advance or fail. Not and Option both return zero-advance successes (Skipped and NotPresent respectively) when their inner parser doesn't match, which left the loop state identical on every iteration.

In tree mode, Option inside Many also caused unbounded memory growth: NotPresent is an ASTChild, so each iteration pushed it into the AST node.

Both loops now break when the inner parser succeeds without consuming any input.

Closes #92

@SeanTAllen SeanTAllen added the changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge label Aug 24, 2026
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Aug 24, 2026
Many's loop assumed the inner parser would either advance or fail.
Not and Option both return zero-advance successes (Skipped and
NotPresent respectively) when their inner parser doesn't match,
which left the loop state identical on every iteration.

In tree mode, Option inside Many also caused unbounded memory growth:
NotPresent is an ASTChild, so each iteration pushed it into the AST
node.

Both loops now break when the inner parser succeeds without consuming
any input.

Closes #92
@SeanTAllen
SeanTAllen force-pushed the fix-many-infinite-loop branch from 8030673 to 9a585ac Compare August 24, 2026 22:22
@SeanTAllen
SeanTAllen merged commit 534f86a into main Aug 24, 2026
6 checks passed
@SeanTAllen
SeanTAllen deleted the fix-many-infinite-loop branch August 24, 2026 23:04
@ponylang-main ponylang-main removed the discuss during sync Should be discussed during an upcoming sync label Aug 24, 2026
github-actions Bot pushed a commit that referenced this pull request Aug 24, 2026
github-actions Bot pushed a commit that referenced this pull request Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Many loops forever when inner parser succeeds without advancing

2 participants