]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_parser.C
further code uglification to make Jean-Marc's compiler happy
[lyx.git] / src / mathed / math_parser.C
index 049de097b22b8ae17add88742db1a3e1b7172420..18766700e37c3bd16dd972b404597f445f137837 100644 (file)
@@ -218,8 +218,6 @@ private:
        void error(string const & msg);
        ///
        void parse_lines(MathGridInset * p, bool numbered, bool outmost);
-       ///
-       latexkeys const * read_delim();
 
 private:
        ///
@@ -607,14 +605,6 @@ MathMatrixInset * Parser::parse_normal()
 }
 
 
-latexkeys const * Parser::read_delim()
-{
-       Token const & t = getToken();
-       latexkeys const * l = in_word_set(t.asString());
-       return l ? l : in_word_set(".");
-}
-
-
 void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
 {
        MathTextCodes yyvarcode = LM_TC_MIN;
@@ -653,7 +643,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('{', '}');
@@ -758,10 +748,10 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
                }
                
                else if (t.cs() == "left") {
-                       latexkeys const * l = read_delim();
+                       string l = getToken().asString();
                        MathArray ar;
                        parse_into(ar, FLAG_RIGHT);
-                       latexkeys const * r = read_delim();
+                       string r = getToken().asString();
                        MathDelimInset * dl = new MathDelimInset(l, r);
                        dl->cell(0) = ar;
                        array.push_back(dl);
@@ -786,9 +776,6 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
                        break; 
                }
 
-               else  LM_TK_SPECIAL:
-                       array.push_back(new MathCharInset(ival_, LM_TC_TEX));
-                       break;
 */
                
                else if (t.cs() == "begin") {
@@ -845,14 +832,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);
                }
        
@@ -884,7 +880,7 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
 
                                else {
                                        MathInset * p = createMathInset(t.cs());
-                                       for (int i = 0; i < p->nargs(); ++i) 
+                                       for (unsigned int i = 0; i < p->nargs(); ++i) 
                                                parse_into(p->cell(i), FLAG_ITEM);
                                        array.push_back(p);
                                }
@@ -893,7 +889,7 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
                        else {
                                MathInset * p = createMathInset(t.cs());
                                if (p) {
-                                       for (int i = 0; i < p->nargs(); ++i)
+                                       for (unsigned int i = 0; i < p->nargs(); ++i)
                                                parse_into(p->cell(i), FLAG_ITEM);
                                        array.push_back(p);
                                } else {