]> git.lyx.org Git - features.git/commitdiff
another parser fix (nested {} and \left..\right and \atop)
authorAndré Pönitz <poenitz@gmx.net>
Wed, 12 Sep 2001 09:58:25 +0000 (09:58 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 12 Sep 2001 09:58:25 +0000 (09:58 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2737 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_parser.C

index 049de097b22b8ae17add88742db1a3e1b7172420..185120b5d7d21290dff9dfc5c3ae7a8295e72e41 100644 (file)
@@ -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);
                }