Skip to content

Include source positions in errors - #14

Merged
mkantor merged 1 commit into
mainfrom
track-offsets-in-errors
Jun 22, 2026
Merged

mkantor merged 1 commit into
mainfrom
track-offsets-in-errors

Conversation

@mkantor

@mkantor mkantor commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Parsers now use an offset rather than the remainingInput to keep track of what to parse next, which allows failures to say exactly where parsing got stuck.

Additionally, InvalidInputError can now contain a list of expected values, and oneOf returns the failure(s) that reached the furthest offset rather than the error from whichever parser was tried last.

This makes backwards-incompatible changes to parse results (offset replaces remainingInput), so the next release should have a major version bump.

Parsers now use an `offset` rather than the `remainingInput` to keep
track of what to parse next, which allows failures to say exactly where
parsing got stuck.

Additionally, `InvalidInputError` can now contain a list of expected
values, and `oneOf` returns the failure(s) that reached the furthest
offset rather than the error from whichever parser was tried last.

This makes backwards-incompatible changes to parse results (`offset`
replaces `remainingInput`), so the next release should have a major
version bump.
@mkantor
mkantor merged commit afe83d8 into main Jun 22, 2026
1 check passed
@mkantor
mkantor deleted the track-offsets-in-errors branch June 22, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant