UNPKG

cm-tarnation

Version:

An alternative parser for CodeMirror 6

35 lines (34 loc) 1.3 kB
import type { Matcher, VariableTable } from "../../types"; /** Matcher that takes a string pattern, and matches that against an input. */ export declare class StringMatcher implements Matcher { /** Internal codepoint representation of the pattern. */ private points; /** The original length of the pattern. */ private length; /** If true, the pattern has to check for casing when matching. */ private cased; /** * @param str - The source string. * @param ignoreCase - If `true`, matches will be case-insensitive. * @param variables - A variable table to use when expanding variables. */ constructor(str: string, ignoreCase?: boolean, variables?: VariableTable); /** * Tests to see if this pattern matches the given string. * * @param str - The string to match. * @param pos - The position to start matching at. */ test(str: string, pos: number): boolean; /** * Returns the results of attempting to match a string against this pattern. * * @param str - The string to match. * @param pos - The position to start matching at. */ match(str: string, pos: number): { total: string; captures: null; length: number; } | null; }