import type { ParjsCombinator } from "../../"; import type { FailureInfo, ResultKindFail, SuccessInfo } from "../result"; import type { UserState } from "../state"; /** Information about the failure. */ export interface ParserFailureState { /** The parser's user state at the moment of failure. */ readonly userState: UserState; /** The reason reported by the failure. */ readonly reason: string | object; /** The severity of the failure. */ readonly kind: ResultKindFail; } /** * Function used to recover from a failure. The `kind`, `reason`, and `value` fields of the result * are used to determine the new parser success state. You can return a falsy value to indicate * nothing should change. */ export type RecoveryFunction = (failure: ParserFailureState) => SuccessInfo | Partial | null; /** Reduces Hard failures to Soft ones and behaves in the same way on success. */ export declare function recover(recoverFunction: RecoveryFunction): ParjsCombinator; //# sourceMappingURL=recover.d.ts.map