Creates a Parser that applies each of the given parsers in turn until one matches, then returns that parser's result. If no parser matches, an error is returned reflecting the furthest offset reached in the input string. If any parser returns a fatal error, no further branches are tried.
Signature:
export declare function or<T>(parsers: Parser<T>[], expected?: string[]): Parser<T>;
Parameter | Type | Description |
---|---|---|
parsers | Parser<T>[] | Parsers to attempt to apply |
expected | string[] | (Optional) Overrides the expected value used if none of the inner parsers match |
Returns:
Parser<T>