import type { Token } from "antlr4ng";
import { GrammarTreeVisitor } from "../tree/walkers/GrammarTreeVisitor.js";
import { Grammar } from "../tool/Grammar.js";
import { ActionAST } from "../tool/ast/ActionAST.js";
import { GrammarAST } from "../tool/ast/GrammarAST.js";
import { GrammarASTWithOptions } from "../tool/ast/GrammarASTWithOptions.js";
import { GrammarRootAST } from "../tool/ast/GrammarRootAST.js";
import { RuleAST } from "../tool/ast/RuleAST.js";
import { RuleRefAST } from "../tool/ast/RuleRefAST.js";
import { TerminalAST } from "../tool/ast/TerminalAST.js";
import { RuleCollector } from "./RuleCollector.js";
/**
 * No side-effects except for setting options into the appropriate node.
 *
 * Invokes check rules for these:
 *
 * FILE_AND_GRAMMAR_NAME_DIFFER
 * LEXER_RULES_NOT_ALLOWED
 * PARSER_RULES_NOT_ALLOWED
 * ILLEGAL_OPTION
 * NO_RULES
 * INVALID_IMPORT
 * IMPORT_NAME_CLASH
 * REPEATED_PREQUEL
 * TOKEN_NAMES_MUST_START_UPPER
 */
export declare class BasicSemanticChecks extends GrammarTreeVisitor {
    /**
     * Set of valid imports. Maps delegate to set of delegator grammar types. `validDelegations.get(LEXER)` gives
     * list of the kinds of delegators that can import lexers.
     */
    static readonly validImportTypes: Map<number, number[]>;
    g: Grammar;
    ruleCollector: RuleCollector;
    /**
     * When this is `true`, the semantic checks will report {@link IssueCode.UnrecognizedAsscoOption} where
     * appropriate. This may be set to `false` to disable this specific check.
     *
     * The default value is `true`.
     */
    checkAssocElementOption: boolean;
    /** This field is used for reporting the {@link IssueCode.ModeWithoutRules} error when necessary. */
    protected nonFragmentRuleCount: number;
    /**
     * This is `true` from the time {@link discoverLexerRule} is called for a lexer rule with the `fragment` modifier
     * until {@link exitLexerRule} is called.
     */
    private inFragmentRule;
    /** Value of caseInsensitive option (false if not defined) */
    private grammarCaseInsensitive;
    constructor(g: Grammar, ruleCollector: RuleCollector);
    process(): void;
    discoverGrammar(root: GrammarRootAST, id: GrammarAST): void;
    finishPrequels(firstPrequel: GrammarAST | null): void;
    importGrammar(label: GrammarAST, id: GrammarAST): void;
    discoverRules(rules: GrammarAST): void;
    modeDef(m: GrammarAST, id: GrammarAST): void;
    discoverRule(rule: RuleAST, id: GrammarAST): void;
    discoverLexerRule(rule: RuleAST, id: GrammarAST, modifiers: GrammarAST[]): void;
    ruleRef(ref: GrammarAST): void;
    grammarOption(id: GrammarAST, valueAST: GrammarAST): void;
    ruleOption(id: GrammarAST, valueAST: GrammarAST): void;
    blockOption(id: GrammarAST, valueAST: GrammarAST): void;
    defineToken(id: GrammarAST): void;
    defineChannel(id: GrammarAST): void;
    elementOption(t: GrammarASTWithOptions, id: GrammarAST, valueAST: GrammarAST): void;
    finishRule(rule: RuleAST): void;
    actionInAlt(action: ActionAST): void;
    label(op: GrammarAST, id: GrammarAST, element: GrammarAST): void;
    protected enterMode(tree: GrammarAST): void;
    protected exitMode(tree: GrammarAST): void;
    protected exitLexerRule(tree: GrammarAST): void;
    protected enterChannelsSpec(tree: GrammarAST): void;
    protected checkGrammarName(nameToken: Token): void;
    protected checkNumRules(rulesNode: GrammarAST): void;
    protected checkNumPrequels(options: GrammarAST[], imports: GrammarAST[], tokens: GrammarAST[]): void;
    protected checkInvalidRuleDef(ruleID: Token): void;
    protected checkInvalidRuleRef(ruleID: Token): void;
    protected checkTokenDefinition(tokenID: Token): void;
    protected checkChannelDefinition(tokenID: Token): void;
    protected enterLexerElement(tree: GrammarAST): void;
    protected enterLexerCommand(tree: GrammarAST): void;
    /**
     * Make sure that action is the last element in an outer alt. Here action, a2, z, and zz are bad, but a3 is ok:
     * ```
     * (RULE A (BLOCK (ALT {action} 'a')))
     * (RULE B (BLOCK (ALT (BLOCK (ALT {a2} 'x') (ALT 'y')) {a3})))
     * (RULE C (BLOCK (ALT 'd' {z}) (ALT 'e' {zz})))
     * ```
     *
     * @param tree The action node to check.
     */
    protected checkElementIsOuterMostInSingleAlt(tree: GrammarAST): void;
    protected enterTerminal(tree: GrammarAST): void;
    /**
     * Checks that an option is appropriate for grammar, rule, subrule.
     *
     * @param parent The parent node of the option.
     * @param optionID The ID of the option.
     * @param valueAST The value of the option.
     */
    protected checkOptions(parent: GrammarAST, optionID: Token, valueAST: GrammarAST): void;
    /**
     * Checks that an option is appropriate for elem. Parent of ID is ELEMENT_OPTIONS.
     *
     * @param elem The element to check.
     * @param id The ID of the option.
     * @param valueAST The value of the option.
     *
     * @returns `true` if the option is valid for the element, `false` otherwise.
     */
    protected checkElementOptions(elem: GrammarASTWithOptions, id: GrammarAST, valueAST: GrammarAST | null): boolean;
    protected checkRuleRefOptions(elem: RuleRefAST, id: GrammarAST, valueAST: GrammarAST | null): boolean;
    protected checkTokenOptions(elem: TerminalAST, id: GrammarAST, valueAST: GrammarAST | null): boolean;
    protected checkImport(importID: Token): void;
    private checkCaseInsensitiveOption;
}
