Fix some minor things
Summary: Fix llap/rlap again, fix lexing errors Auditors: alpert
This commit is contained in:
parent
09311de814
commit
975234e813
2
Lexer.js
2
Lexer.js
|
@ -62,7 +62,7 @@ Lexer.prototype.lex = function(pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// We didn't match any of the tokens, so throw an error.
|
// We didn't match any of the tokens, so throw an error.
|
||||||
throw "Unexpected character: '" + input[0] + "' at position " + this._pos;
|
throw "Unexpected character: '" + input[0] + "' at position " + pos;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = Lexer;
|
module.exports = Lexer;
|
||||||
|
|
|
@ -337,7 +337,7 @@ Parser.prototype.parseNucleus = function(pos) {
|
||||||
var group = this.parseGroup(nucleus.position);
|
var group = this.parseGroup(nucleus.position);
|
||||||
if (group) {
|
if (group) {
|
||||||
return new ParseResult(
|
return new ParseResult(
|
||||||
new ParseNode(nucleus.type.slice(1), nucleus.text),
|
new ParseNode(nucleus.type.slice(1), group.result),
|
||||||
group.position);
|
group.position);
|
||||||
} else {
|
} else {
|
||||||
throw "Parse error: Expected group after '" + nucleus.text + "'";
|
throw "Parse error: Expected group after '" + nucleus.text + "'";
|
||||||
|
|
4
katex.js
4
katex.js
|
@ -129,10 +129,10 @@ var buildGroup = function(style, color, group, prev) {
|
||||||
return makeSpan("mord mspace " + spacingClassMap[group.value]);
|
return makeSpan("mord mspace " + spacingClassMap[group.value]);
|
||||||
}
|
}
|
||||||
} else if (group.type === "llap") {
|
} else if (group.type === "llap") {
|
||||||
var inner = makeSpan("", buildExpression(style, color, group.value));
|
var inner = makeSpan("", [buildGroup(style, color, group.value)]);
|
||||||
return makeSpan("llap " + style.cls(), [inner]);
|
return makeSpan("llap " + style.cls(), [inner]);
|
||||||
} else if (group.type === "rlap") {
|
} else if (group.type === "rlap") {
|
||||||
var inner = makeSpan("", buildExpression(style, color, group.value));
|
var inner = makeSpan("", [buildGroup(style, color, group.value)]);
|
||||||
return makeSpan("rlap " + style.cls(), [inner]);
|
return makeSpan("rlap " + style.cls(), [inner]);
|
||||||
} else if (group.type === "punct") {
|
} else if (group.type === "punct") {
|
||||||
return makeSpan("mpunct" + color, [textit(group.value)]);
|
return makeSpan("mpunct" + color, [textit(group.value)]);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user