import type { VariableTable } from "../types";
import type * as DF from "./definition";
import { Matched } from "./matched";
import { Node } from "./node";
import { Repository } from "./repository";
import type { Rule } from "./rules/rule";
import { State } from "./rules/state";
import { GrammarState } from "./state";
/** Grammar/dumb-tokenizer for a {@link TarnationLanguage}. */
export declare class Grammar {
    def: DF.Grammar;
    variables: VariableTable;
    /** Extra language data props, as parsed from the definition. */
    data: Record<string, any>;
    /** {@link Repository} of rules, states, and nodes used by this grammar. */
    repository: Repository;
    /** The root state/rules to begin tokenizing with. */
    root: (Rule | State)[];
    /** Fallback rules which are checked if nothing else did. */
    global?: (Rule | State)[];
    /** Default {@link Node} that is returned if nothing matched. */
    default?: Node;
    /**
     * @param def - The definition grammar to compile.
     * @param variables - {@link Variable}s to pass to the compiled grammar.
     */
    constructor(def: DF.Grammar, variables?: VariableTable);
    /** Returns a {@link GrammarState} setup for this grammar's default state. */
    startState(): GrammarState;
    /**
     * Runs a match against a string (starting from a given position).
     *
     * @param state - The {@link GrammarState} to run the match with.
     * @param str - The string to match.
     * @param pos - The position to start matching at.
     * @param offset - The offset to apply to the resulting {@link Matched}'s
     *   `from` position.
     */
    match(state: GrammarState, str: string, pos: number, offset?: number): Matched | null;
}
