Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
marihachi committed Jul 18, 2022
2 parents 9dc3ec0 + e56bdfb commit e3a710d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ Generates a new parser that consumes the input string using the specified regula

## P.alt(parsers: Parser[]): Parser

## P.option(parser: Parser): Parser
Generates a new parser that returns null even if the match fails.

## P.notMatch(parser: Parser): Parser
Generates a new parser to continue if the match fails.
The generated parser does not consume input.
Expand All @@ -26,6 +23,8 @@ The generated parser does not consume input.

## P.lf

## P.newline


# Parser APIs

Expand All @@ -35,7 +34,10 @@ The generated parser does not consume input.

## parser.many(min: number): Parser

## parser.sep1(separator: Parser): Parser
## parser.sep(separator: Parser, min: number): Parser

## parser.option(): Parser
Generates a new parser that returns null even if the match fails.


# Other APIs
Expand Down
2 changes: 1 addition & 1 deletion examples/json/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"typescript": "4.7.4"
},
"dependencies": {
"terrario": "0.2.0"
"terrario": "0.3.0"
}
}
4 changes: 2 additions & 2 deletions examples/json/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const lang = P.createLanguage({
return P.seq([
P.str('{'),
spaces,
P.option(entry.sep1(separator)),
entry.sep(separator, 1).option(),
spaces,
P.str('}'),
], 2).map((value: { key: string, value: unknown }[] | null) => {
Expand All @@ -79,7 +79,7 @@ const lang = P.createLanguage({
return P.seq([
P.str('['),
spaces,
P.option(r.value.sep1(separator)),
r.value.sep(separator, 1).option(),
spaces,
P.str(']'),
], 2).map((value: unknown[] | null) => {
Expand Down

0 comments on commit e3a710d

Please sign in to comment.