Expose SourceLocation in ParseError object
This commit is contained in:
parent
97f6beb1a8
commit
c6aa02bb06
|
|
@ -1,7 +1,9 @@
|
||||||
import { SourceLocation } from "./tokenizer";
|
import { SourceLocation } from "./tokenizer";
|
||||||
|
|
||||||
export class ParseError extends Error {
|
export class ParseError extends Error {
|
||||||
constructor(msg: string, { row, col }: SourceLocation) {
|
public loc: SourceLocation;
|
||||||
super(`${msg} at line ${row + 1} char ${col + 1}`);
|
constructor(msg: string, loc: SourceLocation) {
|
||||||
|
super(`${msg} at line ${loc.row + 1} char ${loc.col + 1}`);
|
||||||
|
this.loc = loc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue