import {IParser, Unit} from "../masala-parser.js"; import type {SingleParser} from "./tuple-parser.js"; import type {VoidParser} from "./void-parser.js"; import type {parserBuilder, Predicate} from "../masala-parser.js"; export interface FlowBundle { parse>(parser: P): P; nop(): VoidParser; layer>(parser: P): P; try>(parser: P): P; any(): SingleParser; subStream(length: number): VoidParser; not>(parser: P): SingleParser; lazy>(builder: parserBuilder, args?: any[]): P; returns(value: T): SingleParser; error(): VoidParser; eos(): SingleParser; satisfy(predicate: Predicate): SingleParser; startWith(value: V): SingleParser; /** * moveUntil moves the offset until stop is found and returns the text found between. * The *stop* is **not** read except if include is set to true. * @param stop * @param include if true, the stop is included in the result */ moveUntil(stop: string, include?:boolean): SingleParser; moveUntil(stops: string[], include?:boolean): SingleParser; moveUntil(p: IParser, include?:boolean): SingleParser; /** * Move until the stop, stop **included**, and drops it. * @param s */ dropTo(s: string): VoidParser; dropTo(p: IParser): VoidParser; /** * It works only with a stream of string. Don't use it with a stream of tokens. * @param regex */ regex(regex: RegExp): SingleParser; tryAll(parsers: IParser[]): IParser; }