"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EBNFParser = void 0;
const RDParser_js_1 = require("../core/RDParser.js");
const EBNFParsedNodeFactory_js_1 = require("./EBNFParsedNodeFactory.js");
class EBNFParser extends RDParser_js_1.RDParser {
    constructor(grammar, lexer) {
        super(grammar, lexer, EBNFParsedNodeFactory_js_1.EBNFParsedNodeFactory.INSTANCE);
        this.parseStartListeners = [];
    }
    createParsedTree(leafSequence, retLast) {
        this.fireParsingStarted();
        let root = super.createParsedTree(leafSequence, retLast);
        root.notifyListeners();
        return root;
    }
    addParseStartListener(l) {
        this.parseStartListeners.push(l);
    }
    removeParseStartListener(l) {
        let idx = this.parseStartListeners.indexOf(l);
        if (idx !== -1)
            this.parseStartListeners.splice(idx, 1);
    }
    fireParsingStarted() {
        for (let l of this.parseStartListeners)
            l();
    }
}
exports.EBNFParser = EBNFParser;
//# sourceMappingURL=EBNFParser.js.map