Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update Optional() usage explanation
Clarify the behavior of the Optional() combinator in the documentation.
  • Loading branch information
sebastienros authored Nov 15, 2025
commit b7d1c389eb51aab6830a884ee29fa4e92a409fcd
2 changes: 1 addition & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ It is not necessary to wrap `Terms` parsers with `SkipWhitespace()` as they alre

### `Optional()` usage

Use the `Optional()` combinator to make a parser optional. Returns an instance of `Option<T>` regardless of whether the parser matches or not. Use `HasValue` to check if the parser was successful. Or use `OrSome()` to provide a default value when the parser does not match.
Use the `Optional()` combinator to make a parser optional. It will always return an instance of `Option<T>` regardless of whether the parser matches or not. Use `HasValue` to check if the parser was successful. Or use `OrSome()` to provide a default value when the parser does not match.

```c#
// Parse an integer or return -1 if not present
Expand Down