mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Better fix for bug #8679
Thanks to Enrico, who noticed that the previous fix did not take into account the case of nonempty length argument + the next line beginning with [. Now the parsing is exactly the inverse of InsetMathGrid::eolString().
This commit is contained in:
parent
8d6d21c6d9
commit
2c5c2a6683
@ -1334,39 +1334,36 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
||||
else if (t.cs() == "\\") {
|
||||
if (flags & FLAG_ALIGN)
|
||||
return success_;
|
||||
bool added = false;
|
||||
bool starred = false;
|
||||
docstring arg;
|
||||
if (nextToken().asInput() == "*") {
|
||||
getToken();
|
||||
added = addRow(grid, cellrow, docstring(), false);
|
||||
} else {
|
||||
// skip "{}" added in front of "[" (the
|
||||
// counterpart is in InsetMathGrid::eolString())
|
||||
// skip spaces because formula could come from tex2lyx
|
||||
bool skipBraces = false;
|
||||
pushPosition();
|
||||
skipSpaces();
|
||||
if (nextToken().cat() == catBegin) {
|
||||
starred = true;
|
||||
} else if (nextToken().asInput() == "[")
|
||||
arg = getArg('[', ']');
|
||||
else if (!good())
|
||||
error("missing token after \\\\");
|
||||
// skip "{}" added in front of "[" (the
|
||||
// counterpart is in InsetMathGrid::eolString())
|
||||
// skip spaces because formula could come from tex2lyx
|
||||
bool skipBraces = false;
|
||||
pushPosition();
|
||||
if (nextToken().cat() == catBegin) {
|
||||
getToken();
|
||||
if (nextToken().cat() == catEnd) {
|
||||
getToken();
|
||||
pushPosition();
|
||||
skipSpaces();
|
||||
if (nextToken().cat() == catEnd) {
|
||||
getToken();
|
||||
skipSpaces();
|
||||
if (nextToken().asInput() == "[")
|
||||
skipBraces = true;
|
||||
}
|
||||
}
|
||||
if (skipBraces)
|
||||
dropPosition();
|
||||
else
|
||||
if (nextToken().asInput() == "[")
|
||||
skipBraces = true;
|
||||
popPosition();
|
||||
if (good()) {
|
||||
docstring arg;
|
||||
if (!skipBraces)
|
||||
arg = getArg('[', ']');
|
||||
added = addRow(grid, cellrow, arg);
|
||||
} else
|
||||
error("missing token after \\\\");
|
||||
}
|
||||
}
|
||||
if (skipBraces)
|
||||
dropPosition();
|
||||
else
|
||||
popPosition();
|
||||
bool const added = addRow(grid, cellrow, arg, !starred);
|
||||
if (added) {
|
||||
cellcol = 0;
|
||||
if (grid.asHullInset())
|
||||
|
Loading…
Reference in New Issue
Block a user