parse(): AnyParseNode[] {
        if (!this.settings.globalGroup) {
            // Create a group namespace for the math expression.
            // (LaTeX creates a new group for every $...$, $$...$$, \[...\].)
            this.gullet.beginGroup();
        }

        // Use old \color behavior (same as LaTeX's \textcolor) if requested.
        // We do this within the group for the math expression, so it doesn't
        // pollute settings.macros.
        if (this.settings.colorIsTextColor) {
            this.gullet.macros.set("\\color", "\\textcolor");
        }

        try {
            // Try to parse the input
            const parse = this.parseExpression(false);

            // If we succeeded, make sure there's an EOF at the end
            this.expect("EOF");

            // End the group namespace for the expression
            if (!this.settings.globalGroup) {
                this.gullet.endGroup();
            }

            return parse;

        // Close any leftover groups in case of a parse error.
        } finally {
            this.gullet.endGroups();
        }
    }
Main parsing function, which parses an entire input.