Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | /*
* This file is released under the MIT license.
* Copyright (c) 2020, 2022 Mike Lischke
*
* See LICENSE file for more info.
*/
import { ANTLRErrorListener, Recognizer, RecognitionException } from "antlr4ts";
import { Override } from "antlr4ts/Decorators";
import { IDiagnosticEntry, DiagnosticType } from "./types";
export class ContextLexerErrorListener implements ANTLRErrorListener<number> {
public constructor(private errorList: IDiagnosticEntry[]) {
}
@Override
// eslint-disable-next-line @typescript-eslint/no-explicit-any
public syntaxError<T extends number>(recognizer: Recognizer<T, any>, offendingSymbol: T | undefined, line: number,
charPositionInLine: number, msg: string, _e: RecognitionException | undefined): void {
const error: IDiagnosticEntry = {
type: DiagnosticType.Error,
message: msg,
range: {
start: {
column: charPositionInLine,
row: line,
},
end: {
column: charPositionInLine + 1,
row: line,
},
},
};
this.errorList.push(error);
}
}
|