Skip to main content
Module

x/pazza/mod.ts>suffix

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

Execute the normal parser first. If it succeeds, execute the following "suffix" parser and discard the output of the "suffix" parser if succeeds.

If any of both parsers fails, the whole parser will fail.

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

Type Parameters

T
ET
ES
I extends Input
CtxIn
CtxOut

Parameters

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

parser to parse normal stuff

suffix: IParser<unknown, ES, I, CtxIn, CtxOut>

parser to parse suffix