Skip to content

Commit

Permalink
Document NumberOptions (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienros authored Feb 26, 2024
1 parent 173464c commit 40ca2bb
Showing 1 changed file with 6 additions and 4 deletions.
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

0 comments on commit 40ca2bb

Please sign in to comment.