Skip to main content
Module

x/pazza/mod.ts

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

Functions

Parse an alphabet character.

Parse any single byte.

Parse any single character.

Execute the embedded parser with a specified prefix and suffix.

Parse a specified byte.

Parse a specified character.

Attempt to run each parser of a list of parsers. Once a parser succeeds, return its result. If no parsers succeed, return last result.

Parse a single "carriage return" character.

Parse paired "carriage return - line feed" characters.

Parse a digit.

Expect input is empty, otherwise it produces a parsing error.

Parse escaped characters by calling a provided transformer function to allow to customize escaping logic.

Parse escaped characters and convert values according to provided "entries".

Parse a hexadecimal character.

Construct a parser only when it's needed. This is useful when building a recursive parser.

Parse a single "line feed" character.

Parse linebreak, which can be "\n" or "\r\n".

Parse a lowercase alphabet character.

Repeat them embedded parser with "min" times at minimum and "max" times at maximum.

Repeat them embedded parser any times, at least 0.

Repeat them embedded parser at least once.

Repeat the embedded parser until the "end" parser succeeded.

Execute the embedded parser. If it succeeds, apply provided function on the output.

Execute the embedded parser. If it fails, apply provided function on the error.

Parse any character but not in provided characters.

Parse an octal digit.

Parse one of provided characters.

Execute the embedded parser. If it succeeds, return its value. If it fails, return null with a successful result.

Attempt to run "left" parser at first. If it succeeds, return its result. If it fails, run "right" parser.

Retrieve current position, stored as parser output.

Execute the "prefix" parse first. If it succeeds, discard its result and execute the following normal parser.

Pick next character from input and pass it to provided predicate. If the predicate passes, return a successful parsing result with that character. If not, return a parsing error.

Execute the embedded parser in specified times, with another parser as separator, then produce a list of values.

Execute the embedded parser at least once with another parser as separator, then produce a list of values.

Execute the embedded parser in specified times, with another parser as separator, then produce a list of values. Separator can be trailing.

Execute the embedded parser at least once with another parser as separator, then produce a list of values. Separator can be trailing.

Execute a series of parsers and follow its order. Once a parser fails, the whole parser will fail and return last parsing error.

Parse a specified slice of bytes.

Parse a single "space" character.

Execute the embedded parser, while remembering the start position and end postion.

Parse a specified string.

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

Parse a single "tab" character.

Trim heading whitespace characters by calling String.prototype.trim, then pass the trimmed input to embedded parser.

Parse an uppercase alphabet character.

Parse a Unicode Whitespace character.

Execute the embedded parser with a new "position context". This parser is required if you're going to use position parser or spanned parser.

Type Aliases

Cursor position information.

Span contains the parsed value, together with the start position and end position.