UNPKG

cm-tarnation

Version:

An alternative parser for CodeMirror 6

33 lines (32 loc) 1.29 kB
import type * as DF from "../definition"; import { Matched } from "../matched"; import type { Repository } from "../repository"; import type { GrammarState } from "../state"; import { Rule } from "./rule"; /** A {@link Rule} subclass that uses *other* {@link Rule}s to chain together matches. */ export declare class Chain extends Rule { /** The internal list of rules and their quantifier types. */ private chain; /** * A {@link RegExpMatcher} pattern that, if provided, will be used to skip * characters which are matched. This can be used to skip whitespace in a * chain without making sure every rule actually handles whitespace. */ private skip?; /** * Internal {@link ChainContext} used for keeping track of state when * checking if this rule matches. */ private context; /** * @param repo - The {@link Repository} to add this rule to. * @param rule - The rule definition. */ constructor(repo: Repository, rule: DF.Chain); /** * @param state - The current {@link GrammarState}. * @param str - The string to match. * @param pos - The position to start matching at. */ exec(str: string, pos: number, state: GrammarState): Matched | null; }