UNPKG

parjs

Version:

Library for building parsers using combinators.

21 lines 1.41 kB
import type { ImplicitParjser, ParjsCombinator } from "../../index"; import type { UserState } from "../state"; /** * Tries to apply the source parser repeatedly until `till` succeeds. Yields the results of the * source parser in an array. * * @param till The parser that indicates iteration should stop. * @param pProject A projection to apply on the captured results. */ export declare function manyTill<TSource, TTill, TResult = TSource[]>(till: ImplicitParjser<TTill>, pProject: (source: TSource[], till: TTill, user: UserState) => TResult): ParjsCombinator<TSource, TResult>; export declare function manyTill<TSource, TTill>(till: ImplicitParjser<TTill>): ParjsCombinator<TSource, TSource[]>; /** * Applies `start` and then repeatedly applies the source parser until `pTill` succeeds. Similar to * a mix of `between` and `manyTill`. Yields the results of the source parser in an array. * * @param start The initial parser to apply. * @param pTill Optionally, the terminator. Defaults to `start`. * @param projection Optionally, a projection to apply on the captured results. */ export declare function manyBetween<TSource, TStart, TTill = TStart, TResult = TSource[]>(start: ImplicitParjser<TStart>, pTill?: ImplicitParjser<TTill>, projection?: (sources: TSource[], till: TTill | TStart, state: UserState) => TResult): ParjsCombinator<TSource, TResult>; //# sourceMappingURL=many-till.d.ts.map