Skip to main content
Module

x/pazza/mod.ts>between

Parser combinators library designed for Deno, but also works on browsers and Node.js.
Go to Latest
function between
import { between } from "https://deno.land/x/pazza@v0.3.0/mod.ts";

Execute the embedded parser with a specified prefix and suffix.

If the prefix parser or suffix parser fails, the whole parser will fail.

const parser = between(char("["), char("]"), digit());
parser("[5]").output === "5";
parser("(5]").ok === false;
parser("[a]").ok === false;
parser("[5)").ok === false;

Type Parameters

T
EL
ER
ET
I extends Input
CtxIn
CtxOut

Parameters

start: IParser<unknown, EL, I, CtxIn, CtxOut>

Parser to parse the prefix.

end: IParser<unknown, ER, I, CtxIn, CtxOut>

Parser to parse the suffix.

parser: IParser<T, ET, I, CtxIn, CtxOut>

Embedded parser.