import { DefaultErrorStrategy, Parser, RecognitionException, Token} from "antlr4ts";
import {Recovermark} from "../recovermark";
import {Interval, IntervalSet} from "antlr4ts/misc";
import {ErrorMark} from "../../api/vo/errorMark";
import {StrategyUtil} from "../strategyUtil";

export class MySqlErrorStrategy  extends DefaultErrorStrategy{
    inErrorRecoveryMode(recognizer: Parser): boolean {
        return super.inErrorRecoveryMode(recognizer);
    }

    recover(recognizer: Parser, e: RecognitionException): void {

        StrategyUtil.generateErrorMark(e);

        if (!Recovermark.isRecover){
            Recovermark.isRecover = true;

            StrategyUtil.repair(recognizer,e)
        }

        return super.recover(recognizer, e);
    }



    recoverInline(recognizer: Parser): Token {
        return super.recoverInline(recognizer);
    }

    reportError(recognizer: Parser, e: RecognitionException): void {
        return super.reportError(recognizer, e);
    }

    reportMatch(recognizer: Parser): void {
        return super.reportMatch(recognizer);
    }

    reset(recognizer: Parser): void {
        return super.reset(recognizer);
    }

    sync(recognizer: Parser): void {
        return super.sync(recognizer);
    }






    /**
     *
     * @param sourceText
     * @param targetText
     */


}