Skip to content

Fix skip inside terminal producing empty tokens - #91

Merged
SeanTAllen merged 1 commit into
mainfrom
fix-skip-in-terminal
Aug 24, 2026
Merged

Fix skip inside terminal producing empty tokens#91
SeanTAllen merged 1 commit into
mainfrom
fix-skip-in-terminal

Conversation

@SeanTAllen

Copy link
Copy Markdown
Member

When a skip operator appeared inside a terminal, the skipped bytes were not accumulated into the token's span. Sequence._parse_token and Many._parse_token both grouped Skipped with NotPresent in a match arm constrained to zero advance, so a skip that consumed bytes fell through to the failure path. Terminal.parse had no Skipped arm at all, so a Skipped result reaching it through Choice also failed.

All three sites now handle Skipped with nonzero advance: Sequence and Many accumulate it into the token length, and Terminal treats it the same as Lex.

Closes #20

When a skip operator appeared inside a terminal, the skipped bytes were
not accumulated into the token's span. Sequence and Many both dropped
Skipped results with nonzero advance in their token-mode parsing, and
Terminal itself did not handle Skipped results reaching it through
Choice.

Closes #20
@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
@SeanTAllen
SeanTAllen merged commit 754fe28 into main Aug 24, 2026
9 checks passed
@SeanTAllen
SeanTAllen deleted the fix-skip-in-terminal branch August 24, 2026 18:18
@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.

Terminals cannot be constructed from sequences with skip nodes

2 participants