"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParserErrorCollector = void 0;
const error_1 = require("antlr4/error");
class ParserErrorCollector extends error_1.ErrorListener {
    constructor(error) {
        super();
        this._errors = error;
    }
    syntaxError(recognizer, offendingSymbol, line, charPositionInLine, msg, e) {
        let endCol = charPositionInLine + 1;
        if (offendingSymbol && offendingSymbol.text !== null) {
            endCol = charPositionInLine + offendingSymbol.text.length;
        }
        this._errors.push({
            startLine: line,
            endLine: line,
            startCol: charPositionInLine,
            endCol: endCol,
            message: msg,
        });
    }
}
exports.ParserErrorCollector = ParserErrorCollector;
class ParserErrorListener extends error_1.ErrorListener {
    constructor(errorListener) {
        super();
        this._errorHandler = errorListener;
    }
    syntaxError(recognizer, offendingSymbol, line, charPositionInLine, msg, e) {
        let endCol = charPositionInLine + 1;
        if (offendingSymbol && offendingSymbol.text !== null) {
            endCol = charPositionInLine + offendingSymbol.text.length;
        }
        if (this._errorHandler) {
            this._errorHandler({
                startLine: line,
                endLine: line,
                startCol: charPositionInLine,
                endCol: endCol,
                message: msg,
            }, {
                e,
                line,
                msg,
                recognizer,
                offendingSymbol,
                charPositionInLine,
            });
        }
    }
}
exports.default = ParserErrorListener;
//# sourceMappingURL=parserErrorListener.js.map