UNPKG

parjs

Version:

Library for building parsers using combinators.

18 lines 803 B
import type { ParjsCombinator } from "../parjser"; import type { FailureInfo } from "../result"; /** * Applies the source parser, modifying the failure reason to the given message if it fails Softly. * Useful for providing the user with a more meaningful error message than was is provided by * default. * * @param message The new message. */ export declare function reason<T>(message: string): ParjsCombinator<T, T>; /** * Applies the source parser. If it fails, calls `onFailure` with the failure info and uses the * returned string as the new failure reason. * * @param onFailure A function that takes the failure info and returns the new reason. */ export declare function reason<T>(onFailure: (failure: FailureInfo) => string): ParjsCombinator<T, T>; //# sourceMappingURL=reason.d.ts.map