Replace ParseNode<*> with a more accurate AnyParseNode and fix flow errors. (#1387)

* Replace ParseNode<*> with a more accurate AnyParseNode and fix flow errors.

* Allow "array" environment type spec to use any all symbol type.

Before this commit, it was constrained to use "mathord" and "textord", but a
recent change in HEAD resulted in a "rel" node being used in the spec for, e.g.
\begin{array}{|l||c:r::}\end{array}

* Address reviewer comments: rename `lastRow` to `row` in array.js.
This commit is contained in:
Ashish Myles
2018-06-04 10:56:51 -04:00
committed by Kevin Barabash
parent 4492eedb68
commit 19d2aa63c3
20 changed files with 284 additions and 171 deletions

View File

@@ -1,7 +1,8 @@
// @flow
import ParseNode from "./ParseNode";
import {Token} from "./Token";
import type {AnyParseNode} from "./ParseNode";
/**
* This is the ParseError class, which is the main error thrown by KaTeX
* functions when something has gone wrong. This is used to distinguish internal
@@ -15,8 +16,8 @@ class ParseError {
// Error position based on passed-in Token or ParseNode.
constructor(
message: string, // The error message
token?: Token | ParseNode<*>, // An object providing position information
message: string, // The error message
token?: ?Token | AnyParseNode, // An object providing position information
) {
let error = "KaTeX parse error: " + message;
let start;