added position property to ParseError
This commit is contained in:
parent
d2f41a19a5
commit
afaec30d0a
|
@ -29,6 +29,8 @@ function ParseError(message, lexer, position) {
|
||||||
var self = new Error(error);
|
var self = new Error(error);
|
||||||
self.name = "ParseError";
|
self.name = "ParseError";
|
||||||
self.__proto__ = ParseError.prototype;
|
self.__proto__ = ParseError.prototype;
|
||||||
|
|
||||||
|
self.position = position;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1040,3 +1040,13 @@ describe("An accent builder", function() {
|
||||||
expect(getBuilt("\\vec )^2")[0].classes).not.toContain("mclose");
|
expect(getBuilt("\\vec )^2")[0].classes).not.toContain("mclose");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("A parser error", function () {
|
||||||
|
it("should report the position of an error", function () {
|
||||||
|
try {
|
||||||
|
parseTree("\\sqrt}");
|
||||||
|
} catch (e) {
|
||||||
|
expect(e.position).toEqual(5);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user