"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Or = void 0;
const Production_js_1 = require("../core/Production.js");
const Evaluator_js_1 = require("../Evaluator.js");
const Rule_js_1 = require("./Rule.js");
class Or extends Rule_js_1.Rule {
    constructor(tgt, ...children) {
        super("or", tgt, ...children);
        this.setEvaluator(Evaluator_js_1.Evaluator.FIRST_CHILD_EVALUATOR);
    }
    createBNF(grammar) {
        for (let io = 0; io < this.children.length; io++) {
            const fio = io;
            const option = this.children[io];
            const p = Rule_js_1.Rule.addProduction(grammar, this, this.tgt, option);
            const that = this;
            p.onExtension((_parent, ...children) => {
                let c0 = children[0];
                c0.setNthEntryInParent(fio);
                c0.setName(that.getNameForChild(fio));
            });
            p.setAstBuilder(Production_js_1.AstBuilder.DEFAULT);
        }
    }
}
exports.Or = Or;
//# sourceMappingURL=Or.js.map