Always throw real ParseErrors
Also sneak in a colon. Auditors: emily
This commit is contained in:
parent
3b69354fd6
commit
cab5af40b6
2
Lexer.js
2
Lexer.js
|
@ -17,7 +17,7 @@ var normals = [
|
||||||
[/^[/|@."`0-9]/, "textord"],
|
[/^[/|@."`0-9]/, "textord"],
|
||||||
[/^[a-zA-Z]/, "mathord"],
|
[/^[a-zA-Z]/, "mathord"],
|
||||||
[/^[*+-]/, "bin"],
|
[/^[*+-]/, "bin"],
|
||||||
[/^[=<>]/, "rel"],
|
[/^[=<>:]/, "rel"],
|
||||||
[/^[,;]/, "punct"],
|
[/^[,;]/, "punct"],
|
||||||
[/^'/, "'"],
|
[/^'/, "'"],
|
||||||
[/^\^/, "^"],
|
[/^\^/, "^"],
|
||||||
|
|
|
@ -130,7 +130,7 @@ Parser.prototype.parseAtom = function(pos) {
|
||||||
var node;
|
var node;
|
||||||
if ((node = this.parseSuperscript(nextPos))) {
|
if ((node = this.parseSuperscript(nextPos))) {
|
||||||
if (sup) {
|
if (sup) {
|
||||||
throw "Parse error: Double superscript";
|
throw new ParseError("Parse error: Double superscript");
|
||||||
}
|
}
|
||||||
nextPos = node.position;
|
nextPos = node.position;
|
||||||
sup = node.result;
|
sup = node.result;
|
||||||
|
@ -138,7 +138,7 @@ Parser.prototype.parseAtom = function(pos) {
|
||||||
}
|
}
|
||||||
if ((node = this.parseSubscript(nextPos))) {
|
if ((node = this.parseSubscript(nextPos))) {
|
||||||
if (sub) {
|
if (sub) {
|
||||||
throw "Parse error: Double subscript";
|
throw new ParseError("Parse error: Double subscript");
|
||||||
}
|
}
|
||||||
nextPos = node.position;
|
nextPos = node.position;
|
||||||
sub = node.result;
|
sub = node.result;
|
||||||
|
|
3
katex.js
3
katex.js
|
@ -152,7 +152,8 @@ var buildGroup = function(style, color, group, prev) {
|
||||||
} else if (group.type === "namedfn") {
|
} else if (group.type === "namedfn") {
|
||||||
return makeSpan("mop" + color, [textit(group.value.slice(1))]);
|
return makeSpan("mop" + color, [textit(group.value.slice(1))]);
|
||||||
} else {
|
} else {
|
||||||
throw "Lex error: Got group of unknown type: '" + group.type + "'";
|
throw new ParseError(
|
||||||
|
"Lex error: Got group of unknown type: '" + group.type + "'");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user