UNPKG

parjs

Version:

Library for building parsers using combinators.

23 lines 1.15 kB
import type { ImplicitParjser, ParjsCombinator } from "../../index"; import type { CombinatorInput } from "../combinated"; export type ArrayWithSeparators<Normal, Separator> = Normal[] & { separators: Separator[]; }; export declare function getArrayWithSeparators<T, S>(things: T[], separators: S[]): ArrayWithSeparators<T, S>; export interface ManySepByOptions<Sep> { delimeter: CombinatorInput<Sep>; max?: number; } /** * Applies the source parser repeatedly until it fails softly, with each pair of applications * separated by applying `delimeter`. Also terminates if `delimeter` fails softly. Yields all the * results of the source parser in an array. * * @template E The type of the source parser. * @template Sep The type of the delimeter (separator) parser. * @param delimeter Parser that separates two applications of the source. * @param max Optionally, then maximum number of times to apply the source parser. Defaults to * `Infinity`. */ export declare function manySepBy<E, Sep>(delimeter: ImplicitParjser<Sep>, max?: number): ParjsCombinator<E, ArrayWithSeparators<E, Sep>>; //# sourceMappingURL=many-sep-by.d.ts.map