#include "support/convert.h"
#include "support/debug.h"
#include "support/docstream.h"
-#include "support/unique_ptr.h"
#include <sstream>
* \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,
+bool addRow(InsetMathGrid & grid, row_type & cellrow,
docstring const & vskip, bool allow_newpage = true)
{
++cellrow;
* \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)
+bool addCol(InsetMathGrid & grid, col_type & cellcol)
{
++cellcol;
if (cellcol == grid.ncols()) {
*/
void delEmptyLastRow(InsetMathGrid & grid)
{
- InsetMathGrid::row_type const row = grid.nrows() - 1;
- for (InsetMathGrid::col_type col = 0; col < grid.ncols(); ++col) {
- InsetMathGrid::idx_type const idx = grid.index(row, col);
+ row_type const row = grid.nrows() - 1;
+ for (col_type col = 0; col < grid.ncols(); ++col) {
+ idx_type const idx = grid.index(row, col);
if (!grid.cell(idx).empty() ||
grid.cellinfo(idx).multi != InsetMathGrid::CELL_NORMAL)
return;
os << '\\' << to_utf8(cs);
}
else if (t.cat() == catLetter)
- os << t.character();
+ os << static_cast<uint32_t>(t.character());
else
- os << '[' << t.character() << ',' << t.cat() << ']';
+ os << '[' << static_cast<uint32_t>(t.character()) << ',' << t.cat() << ']';
return os;
}
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;
+ row_type cellrow = 0;
+ col_type cellcol = 0;
MathData * cell = &grid.cell(grid.index(cellrow, cellcol));
Buffer * buf = buffer_;
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())
else if (t.cs() == "ref" || t.cs() == "eqref" || t.cs() == "prettyref"
|| t.cs() == "nameref" || t.cs() == "pageref"
- || t.cs() == "vpageref" || t.cs() == "vref") {
+ || t.cs() == "vpageref" || t.cs() == "vref"
+ || t.cs() == "formatted" || t.cs() == "labelonly") {
cell->push_back(MathAtom(new InsetMathRef(buf, t.cs())));
docstring const opt = parse_verbatim_option();
docstring const ref = parse_verbatim_item();
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)));
else {
MathAtom at = createInsetMath(t.cs(), buf);
- for (InsetMath::idx_type i = 0; i < at->nargs(); ++i)
+ for (idx_type i = 0; i < at->nargs(); ++i)
parse(at.nucleus()->cell(i),
FLAG_ITEM, asMode(mode, l->extra));
cell->push_back(at);
if (at->currentMode() != InsetMath::UNDECIDED_MODE)
m = at->currentMode();
//lyxerr << "default creation: m2: " << m << endl;
- InsetMath::idx_type start = 0;
+ idx_type start = 0;
// this fails on \bigg[...\bigg]
//MathData opt;
//parse(opt, FLAG_OPTION, InsetMath::VERBATIM_MODE);
// start = 1;
// at.nucleus()->cell(0) = opt;
//}
- for (InsetMath::idx_type i = start; i < at->nargs(); ++i) {
+ for (idx_type i = start; i < at->nargs(); ++i) {
parse(at.nucleus()->cell(i), FLAG_ITEM, m);
if (mode == InsetMath::MATH_MODE)
skipSpaces();