import { AstBuilder } from "../core/Production.js";
import { Rule } from "./Rule.js";
export class Sequence extends Rule {
    constructor(tgt, ...children) {
        super("sequence", tgt, ...children);
    }
    createBNF(grammar) {
        const p = Rule.addProduction(grammar, this, this.tgt, ...this.children);
        const that = this;
        p.onExtension((_parent, ...children) => {
            for (let c = 0; c < children.length; c++) {
                let ch = children[c];
                ch.setNthEntryInParent(c);
                ch.setName(that.getNameForChild(c));
            }
        });
        p.setAstBuilder(AstBuilder.DEFAULT);
    }
}
//# sourceMappingURL=Sequence.js.map