Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document NumberOptions #89

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Changes from all commits
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
10 changes: 6 additions & 4 deletions docs/parsers.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Result:

### Integer

Matches an integral numeric value.
Matches an integral numeric value. By default the plus `+` and `-` signs are not parsed unless the `NumberOptions.AllowSign` is specified.

```c#
Parser<long> Integer()
Expand All @@ -106,7 +106,7 @@ Usage:

```c#
var input = "-1234";
var parser = Terms.Integer();
var parser = Terms.Integer(NumberOptions.AllowSign);
```

Result:
Expand All @@ -117,7 +117,7 @@ Result:

### Decimal

Matches a numeric value with optional digits.
Matches a numeric value with optional digits. By default the plus `+` and `-` signs are not parsed unless the `NumberOptions.AllowSign` is specified.

```c#
Parser<decimal> Decimal()
Expand All @@ -127,7 +127,7 @@ Usage:

```c#
var input = "-1234.56";
var parser = Terms.Decimal();
var parser = Terms.Decimal(NumberOptions.AllowSign);
```

Result:
Expand All @@ -136,6 +136,8 @@ Result:
-1,234.56
```

The parsers `Float` and `Double` are identical to `Decimal` with the difference that they return `float` and `double` respectively.

### String

Matches a quoted string literal, optionally use single or double enclosing quotes.
Expand Down