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

interface Matcher {
    getInput(): string;
    match(optStartRule?): MatchResult;
    replaceInputRange(startIdx, endIdx, str): Matcher;
    setInput(str): void;
    trace(optStartRule?): Object;
}

Methods

  • Return the current input string.

    Returns string

  • Like Grammar#match, but operates incrementally.

    Parameters

    • Optional optStartRule: string

    Returns MatchResult

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

    Parameters

    • startIdx: number
    • endIdx: number
    • str: string

    Returns Matcher

  • Set the input string to str.

    Parameters

    • str: string

    Returns void

  • Like Grammar#trace, but operates incrementally.

    Parameters

    • Optional optStartRule: string

    Returns Object

Generated using TypeDoc