#include "support/convert.h"
#include "support/debug.h"
#include "support/docstream.h"
-#include "support/unique_ptr.h"
#include <sstream>
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);
if (ar[i].size() == 1)
script[i] = ar[i][0].nucleus()->asScriptInset();
}
- bool const hasscript[2] = {script[0] ? true : false, script[1] ? true : false};
+ bool const hasscript[2] = {script[0] != nullptr, script[1] != nullptr};
cell->push_back(MathAtom(new InsetMathSideset(buf, hasscript[0], hasscript[1])));
if (hasscript[0]) {
if (script[0]->hasDown())
bool const prot = nextToken().character() == '*';
if (prot)
getToken();
- docstring const name = t.cs();
+ docstring const & name = t.cs();
docstring const arg = parse_verbatim_item();
Length length;
if (prot && arg == "\\fill")
cmd = Encodings::fromLaTeXCommand(cmd,
Encodings::MATH_CMD | Encodings::TEXT_CMD,
termination, rem);
- for (size_t i = 0; i < cmd.size(); ++i)
- cell->push_back(MathAtom(new InsetMathChar(cmd[i])));
+ for (char_type c : cmd)
+ cell->push_back(MathAtom(new InsetMathChar(c)));
if (!rem.empty()) {
char_type c = rem[0];
cell->push_back(MathAtom(new InsetMathChar(c)));