import { RDParser } from "../core/RDParser.js";
import { EBNFParsedNodeFactory } from "./EBNFParsedNodeFactory.js";
class EBNFParser extends RDParser {
    constructor(grammar, lexer) {
        super(grammar, lexer, 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();
    }
}
export { EBNFParser };
//# sourceMappingURL=EBNFParser.js.map