Skip to content

Add nullable optional reference parsers - #180

Closed
Sinkleberg wants to merge 1 commit into
datalust:devfrom
Sinkleberg:codex/nullable-optional-parsers
Closed

Sinkleberg wants to merge 1 commit into
datalust:devfrom
Sinkleberg:codex/nullable-optional-parsers

Conversation

@Sinkleberg

Copy link
Copy Markdown

Adds OptionalOrNull() for text and token parsers returning reference types, so nullable-enabled projects can represent an absent match without a manual fallback. Existing Optional() continues to handle value types. Partial-consumption failures still propagate; Try() retains its existing backtracking behavior.

Closes #150.

Validation: nine new tests cover nullable results, unmatched input, partial failures, backtracking, null arguments and existing value-type behavior. The identical fixture fails to compile on the base because the API is absent. All 284 tests pass on both .NET 8 and .NET 10; the complete solution builds without warnings, and Release packages build for all three library targets. Windows only; other CI platforms and package publication were not run.

@nblumhardt

Copy link
Copy Markdown
Member

Appreciate the thought, but no bandwidth to review generated PRs at this point in time. Thanks though!

@nblumhardt nblumhardt closed this Oct 12, 2026
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.

OptionalOrNull()

2 participants