/*!
* Add the row \p cellrow to \p grid.
- * \returns wether the row could be added. Adding a row can fail for
+ * \returns whether the row could be added. Adding a row can fail for
* environments like "equation" that have a fixed number of rows.
*/
bool addRow(InsetMathGrid & grid, InsetMathGrid::row_type & cellrow,
/*!
* Add the column \p cellcol to \p grid.
- * \returns wether the column could be added. Adding a column can fail for
+ * \returns whether the column could be added. Adding a column can fail for
* environments like "eqnarray" that have a fixed number of columns.
*/
bool addCol(InsetMathGrid & grid, InsetMathGrid::col_type & cellcol)
{
if (!t.cs().empty()) {
docstring const & cs = t.cs();
- // FIXME: For some strange reason, the stream operator instanciate
+ // FIXME: For some strange reason, the stream operator instantiate
// a new Token before outputting the contents of t.cs().
// Because of this the line
// os << '\\' << cs;
bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
const mode_type mode, const bool numbered)
{
- int limits = 0;
InsetMathGrid::row_type cellrow = 0;
InsetMathGrid::col_type cellcol = 0;
MathData * cell = &grid.cell(grid.index(cellrow, cellcol));
p->nuc().erase(0);
parse(p->cell(p->idxOfScript(up)), FLAG_ITEM, mode);
- if (limits) {
- p->limits(limits);
- limits = 0;
- }
}
else if (t.character() == ']' && (flags & FLAG_BRACK_LAST)) {
}
else if (t.cs() == "limits" || t.cs() == "nolimits") {
- CatCode const cat = nextToken().cat();
- if (cat == catSuper || cat == catSub)
- limits = t.cs() == "limits" ? 1 : -1;
+ if (!cell->empty())
+ cell->back()->limits(t.cs() == "limits" ? LIMITS : NO_LIMITS);
else {
MathAtom at = createInsetMath(t.cs(), buf);
cell->push_back(at);
Encodings::MATH_CMD | Encodings::TEXT_CMD,
is_combining, termination);
}
- if (c && buf->params().encoding().encodable(c)) {
+ if (c && buf && buf->params().encoding().encodable(c)) {
if (termination) {
if (nextToken().cat() == catBegin) {
getToken();
if (nextToken().cat() == catEnd) {
getToken();
- num_tokens += 2;
} else
putback();
} else {
while (nextToken().cat() == catSpace) {
getToken();
- ++num_tokens;
}
}
}
if (flags & FLAG_LEAVE) {
- flags &= ~FLAG_LEAVE;
break;
}
}