Skip to content

Latest commit

 

History

History
25 lines (15 loc) · 949 Bytes

prsc.or.md

File metadata and controls

25 lines (15 loc) · 949 Bytes

Home > prsc > or

or() function

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>;

Parameters

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>