mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
bugfix: in some cases the parser created unecessary extra braces
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3499 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a64a948cea
commit
e5e39c1884
@ -20,6 +20,8 @@ public:
|
||||
///
|
||||
MathInset * clone() const;
|
||||
///
|
||||
MathBraceInset * asBraceInset() { return this; }
|
||||
///
|
||||
void draw(Painter &, int x, int y) const;
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
|
@ -47,6 +47,7 @@ inclusion in the "real LyX insets" FormulaInset and FormulaMacroInset.
|
||||
|
||||
|
||||
class MathArrayInset;
|
||||
class MathBraceInset;
|
||||
class MathBoxInset;
|
||||
class MathCharInset;
|
||||
class MathDelimInset;
|
||||
@ -176,6 +177,7 @@ public:
|
||||
|
||||
/// identifies certain types of insets
|
||||
virtual MathArrayInset * asArrayInset() { return 0; }
|
||||
virtual MathBraceInset * asBraceInset() { return 0; }
|
||||
virtual MathBoxInset * asBoxInset() { return 0; }
|
||||
virtual MathBoxInset const * asBoxInset() const { return 0; }
|
||||
virtual MathCharInset const * asCharInset() const { return 0; }
|
||||
|
@ -256,6 +256,8 @@ public:
|
||||
void putback();
|
||||
|
||||
private:
|
||||
///
|
||||
void parse_into1(MathArray & array, unsigned flags, MathTextCodes);
|
||||
///
|
||||
string getArg(char lf, char rf);
|
||||
///
|
||||
@ -521,6 +523,7 @@ void Parser::error(string const & msg)
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Parser::parse_lines(MathAtom & t, bool numbered, bool outmost)
|
||||
{
|
||||
MathGridInset * p = t->asGridInset();
|
||||
@ -545,7 +548,11 @@ bool Parser::parse_lines(MathAtom & t, bool numbered, bool outmost)
|
||||
for (MathInset::col_type col = 0; col < p->ncols(); ++col) {
|
||||
//lyxerr << "reading cell " << row << " " << col << "\n";
|
||||
|
||||
parse_into(p->cell(col + row * p->ncols()), FLAG_BLOCK);
|
||||
MathArray & ar = p->cell(col + row * p->ncols());
|
||||
parse_into(ar, FLAG_BLOCK);
|
||||
// remove 'unnecessary' braces:
|
||||
if (ar.size() == 1 && ar.back()->asBraceInset())
|
||||
ar = ar.back()->asBraceInset()->cell(0);
|
||||
|
||||
// break if cell is not followed by an ampersand
|
||||
if (nextToken().cat() != catAlign) {
|
||||
@ -824,6 +831,15 @@ bool Parser::parse_normal(MathAtom & matrix)
|
||||
|
||||
|
||||
void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
|
||||
{
|
||||
parse_into1(array, flags, code);
|
||||
// remove 'unnecessary' braces:
|
||||
if (array.size() == 1 && array.back()->asBraceInset())
|
||||
array = array.back()->asBraceInset()->cell(0);
|
||||
}
|
||||
|
||||
|
||||
void Parser::parse_into1(MathArray & array, unsigned flags, MathTextCodes code)
|
||||
{
|
||||
bool panic = false;
|
||||
int limits = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user