import { isRecognitionException as l } from "../../exceptions_public.js";
import { DEFAULT_RULE_CONFIG as a, ParserDefinitionErrorType as u } from "../parser.js";
import { defaultGrammarValidatorErrorProvider as h } from "../../errors_public.js";
import { validateRuleIsOverridden as o } from "../../grammar/checks.js";
import { serializeGrammar as I } from "../../../../../../../../@chevrotain_gast@11.0.3/node_modules/@chevrotain/gast/lib/src/model.js";
import E from "../../../../../../../../lodash-es@4.17.21/node_modules/lodash-es/includes.js";
import O from "../../../../../../../../lodash-es@4.17.21/node_modules/lodash-es/values.js";
class c {
  ACTION(t) {
    return t.call(this);
  }
  consume(t, n, r) {
    return this.consumeInternal(n, t, r);
  }
  subrule(t, n, r) {
    return this.subruleInternal(n, t, r);
  }
  option(t, n) {
    return this.optionInternal(n, t);
  }
  or(t, n) {
    return this.orInternal(n, t);
  }
  many(t, n) {
    return this.manyInternal(t, n);
  }
  atLeastOne(t, n) {
    return this.atLeastOneInternal(t, n);
  }
  CONSUME(t, n) {
    return this.consumeInternal(t, 0, n);
  }
  CONSUME1(t, n) {
    return this.consumeInternal(t, 1, n);
  }
  CONSUME2(t, n) {
    return this.consumeInternal(t, 2, n);
  }
  CONSUME3(t, n) {
    return this.consumeInternal(t, 3, n);
  }
  CONSUME4(t, n) {
    return this.consumeInternal(t, 4, n);
  }
  CONSUME5(t, n) {
    return this.consumeInternal(t, 5, n);
  }
  CONSUME6(t, n) {
    return this.consumeInternal(t, 6, n);
  }
  CONSUME7(t, n) {
    return this.consumeInternal(t, 7, n);
  }
  CONSUME8(t, n) {
    return this.consumeInternal(t, 8, n);
  }
  CONSUME9(t, n) {
    return this.consumeInternal(t, 9, n);
  }
  SUBRULE(t, n) {
    return this.subruleInternal(t, 0, n);
  }
  SUBRULE1(t, n) {
    return this.subruleInternal(t, 1, n);
  }
  SUBRULE2(t, n) {
    return this.subruleInternal(t, 2, n);
  }
  SUBRULE3(t, n) {
    return this.subruleInternal(t, 3, n);
  }
  SUBRULE4(t, n) {
    return this.subruleInternal(t, 4, n);
  }
  SUBRULE5(t, n) {
    return this.subruleInternal(t, 5, n);
  }
  SUBRULE6(t, n) {
    return this.subruleInternal(t, 6, n);
  }
  SUBRULE7(t, n) {
    return this.subruleInternal(t, 7, n);
  }
  SUBRULE8(t, n) {
    return this.subruleInternal(t, 8, n);
  }
  SUBRULE9(t, n) {
    return this.subruleInternal(t, 9, n);
  }
  OPTION(t) {
    return this.optionInternal(t, 0);
  }
  OPTION1(t) {
    return this.optionInternal(t, 1);
  }
  OPTION2(t) {
    return this.optionInternal(t, 2);
  }
  OPTION3(t) {
    return this.optionInternal(t, 3);
  }
  OPTION4(t) {
    return this.optionInternal(t, 4);
  }
  OPTION5(t) {
    return this.optionInternal(t, 5);
  }
  OPTION6(t) {
    return this.optionInternal(t, 6);
  }
  OPTION7(t) {
    return this.optionInternal(t, 7);
  }
  OPTION8(t) {
    return this.optionInternal(t, 8);
  }
  OPTION9(t) {
    return this.optionInternal(t, 9);
  }
  OR(t) {
    return this.orInternal(t, 0);
  }
  OR1(t) {
    return this.orInternal(t, 1);
  }
  OR2(t) {
    return this.orInternal(t, 2);
  }
  OR3(t) {
    return this.orInternal(t, 3);
  }
  OR4(t) {
    return this.orInternal(t, 4);
  }
  OR5(t) {
    return this.orInternal(t, 5);
  }
  OR6(t) {
    return this.orInternal(t, 6);
  }
  OR7(t) {
    return this.orInternal(t, 7);
  }
  OR8(t) {
    return this.orInternal(t, 8);
  }
  OR9(t) {
    return this.orInternal(t, 9);
  }
  MANY(t) {
    this.manyInternal(0, t);
  }
  MANY1(t) {
    this.manyInternal(1, t);
  }
  MANY2(t) {
    this.manyInternal(2, t);
  }
  MANY3(t) {
    this.manyInternal(3, t);
  }
  MANY4(t) {
    this.manyInternal(4, t);
  }
  MANY5(t) {
    this.manyInternal(5, t);
  }
  MANY6(t) {
    this.manyInternal(6, t);
  }
  MANY7(t) {
    this.manyInternal(7, t);
  }
  MANY8(t) {
    this.manyInternal(8, t);
  }
  MANY9(t) {
    this.manyInternal(9, t);
  }
  MANY_SEP(t) {
    this.manySepFirstInternal(0, t);
  }
  MANY_SEP1(t) {
    this.manySepFirstInternal(1, t);
  }
  MANY_SEP2(t) {
    this.manySepFirstInternal(2, t);
  }
  MANY_SEP3(t) {
    this.manySepFirstInternal(3, t);
  }
  MANY_SEP4(t) {
    this.manySepFirstInternal(4, t);
  }
  MANY_SEP5(t) {
    this.manySepFirstInternal(5, t);
  }
  MANY_SEP6(t) {
    this.manySepFirstInternal(6, t);
  }
  MANY_SEP7(t) {
    this.manySepFirstInternal(7, t);
  }
  MANY_SEP8(t) {
    this.manySepFirstInternal(8, t);
  }
  MANY_SEP9(t) {
    this.manySepFirstInternal(9, t);
  }
  AT_LEAST_ONE(t) {
    this.atLeastOneInternal(0, t);
  }
  AT_LEAST_ONE1(t) {
    return this.atLeastOneInternal(1, t);
  }
  AT_LEAST_ONE2(t) {
    this.atLeastOneInternal(2, t);
  }
  AT_LEAST_ONE3(t) {
    this.atLeastOneInternal(3, t);
  }
  AT_LEAST_ONE4(t) {
    this.atLeastOneInternal(4, t);
  }
  AT_LEAST_ONE5(t) {
    this.atLeastOneInternal(5, t);
  }
  AT_LEAST_ONE6(t) {
    this.atLeastOneInternal(6, t);
  }
  AT_LEAST_ONE7(t) {
    this.atLeastOneInternal(7, t);
  }
  AT_LEAST_ONE8(t) {
    this.atLeastOneInternal(8, t);
  }
  AT_LEAST_ONE9(t) {
    this.atLeastOneInternal(9, t);
  }
  AT_LEAST_ONE_SEP(t) {
    this.atLeastOneSepFirstInternal(0, t);
  }
  AT_LEAST_ONE_SEP1(t) {
    this.atLeastOneSepFirstInternal(1, t);
  }
  AT_LEAST_ONE_SEP2(t) {
    this.atLeastOneSepFirstInternal(2, t);
  }
  AT_LEAST_ONE_SEP3(t) {
    this.atLeastOneSepFirstInternal(3, t);
  }
  AT_LEAST_ONE_SEP4(t) {
    this.atLeastOneSepFirstInternal(4, t);
  }
  AT_LEAST_ONE_SEP5(t) {
    this.atLeastOneSepFirstInternal(5, t);
  }
  AT_LEAST_ONE_SEP6(t) {
    this.atLeastOneSepFirstInternal(6, t);
  }
  AT_LEAST_ONE_SEP7(t) {
    this.atLeastOneSepFirstInternal(7, t);
  }
  AT_LEAST_ONE_SEP8(t) {
    this.atLeastOneSepFirstInternal(8, t);
  }
  AT_LEAST_ONE_SEP9(t) {
    this.atLeastOneSepFirstInternal(9, t);
  }
  RULE(t, n, r = a) {
    if (E(this.definedRulesNames, t)) {
      const i = {
        message: h.buildDuplicateRuleNameError({
          topLevelRule: t,
          grammarName: this.className
        }),
        type: u.DUPLICATE_RULE_NAME,
        ruleName: t
      };
      this.definitionErrors.push(i);
    }
    this.definedRulesNames.push(t);
    const e = this.defineRule(t, n, r);
    return this[t] = e, e;
  }
  OVERRIDE_RULE(t, n, r = a) {
    const e = o(t, this.definedRulesNames, this.className);
    this.definitionErrors = this.definitionErrors.concat(e);
    const s = this.defineRule(t, n, r);
    return this[t] = s, s;
  }
  BACKTRACK(t, n) {
    return function() {
      this.isBackTrackingStack.push(1);
      const r = this.saveRecogState();
      try {
        return t.apply(this, n), !0;
      } catch (e) {
        if (l(e))
          return !1;
        throw e;
      } finally {
        this.reloadRecogState(r), this.isBackTrackingStack.pop();
      }
    };
  }
  // GAST export APIs
  getGAstProductions() {
    return this.gastProductionsCache;
  }
  getSerializedGastProductions() {
    return I(O(this.gastProductionsCache));
  }
}
export {
  c as RecognizerApi
};
