- parse<TToken, TOptions, TValue>(parser: Parser<TToken, TOptions, TValue>, tokens: TToken[], options: TOptions, formatToken?: ((t: TToken) => string)): TValue
-
Parameters
-
parser: Parser<TToken, TOptions, TValue>
-
tokens: TToken[]
-
options: TOptions
-
formatToken: ((t: TToken) => string) = JSON.stringify
-
- (t: TToken): string
-
Returns string
Returns TValue
Utility function that provides a bit cleaner interface for running a parser.
This one throws an error in case parser didn't match OR the match is incomplete (some part of tokens array left unparsed).
Returns
A matched value.