From 0e0913d0307192b1095a174ef6907fb1d64089a8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Wed, 12 Sep 2001 09:58:25 +0000 Subject: [PATCH] another parser fix (nested {} and \left..\right and \atop) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2737 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/math_parser.C | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index 049de097b2..185120b5d7 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -653,7 +653,7 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code) } if (flags & FLAG_BLOCK) { - if (t.cat() == catAlign || t.cs() == "\\" || t.cs() == "right") + if (t.cat() == catAlign || t.cs() == "\\") return; if (t.cs() == "end") { getArg('{', '}'); @@ -845,14 +845,23 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code) if (array.at(pos)->nucleus()->getChar() == '{') break; if (pos >= 0) { - // found it -> use the part after '{' as "numerator", erase the '{' + // found it -> use the part after '{' as "numerator" p->cell(0) = MathArray(array, pos + 1, array.size()); + parse_into(p->cell(1), FLAG_BRACE_LAST); + // delete denominator and the '{' array.erase(pos, array.size()); + } else if (flags & FLAG_RIGHT) { + // we are inside a \left ... \right block + //lyxerr << "found '" << t.cs() << "' enclosed by \\left .. \\right\n"; + p->cell(0).swap(array); + parse_into(p->cell(1), FLAG_RIGHT); + // handle the right delimiter properly + putback(); } else { // not found -> use everything as "numerator" p->cell(0).swap(array); + parse_into(p->cell(1), FLAG_BLOCK); } - parse_into(p->cell(1), FLAG_BLOCK); array.push_back(p); } -- 2.39.2