Skip to main content
Module

x/ohm_js/index.d.ts>Matcher

A library and language for building parsers, interpreters, compilers, etc.
Go to Latest
interface Matcher
import { type Matcher } from "https://deno.land/x/ohm_js@v17.0.3/index.d.ts";

Matcher objects are used to incrementally match a changing input against a Grammar, e.g. in an editor or IDE.

Methods

getInput(): string

Return the current input string.

setInput(str: string): void

Set the input string to str.

replaceInputRange(
startIdx: number,
endIdx: number,
str: string,
): Matcher

Edit the current input string, replacing the characters between startIdx and endIdx with str.

match(optStartRule?: string): MatchResult

Like Grammar#match, but operates incrementally.

trace(optStartRule?: string): Object

Like Grammar#trace, but operates incrementally.