]> git.lyx.org Git - features.git/commitdiff
Fix stupid parser bug
authorAndré Pönitz <poenitz@gmx.net>
Thu, 27 Jun 2002 11:31:32 +0000 (11:31 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Thu, 27 Jun 2002 11:31:32 +0000 (11:31 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4496 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_factory.C
src/mathed/math_parser.C

index 6193b8a55f9ecff9ea98c7c0bd0f19e5e9079d3d..835c0b98ceee354e0f3020a1acea42ccd1dca73f 100644 (file)
@@ -64,13 +64,9 @@ struct key_type {
 key_type wordlist_array[] =
 {
        {"!",  "space", ""},
-       //{"(",  "begin", ""},
-       //{")",  "end", ""},
        {",",  "space", ""},
        {":",  "space", ""},
        {";",  "space", ""},
-       //{"[",  "begin", ""},
-       //{"]",  "end", ""},
        {"Vmatrix",  "matrix", ""},
        {"acute",  "decoration", ""},
        {"bar",  "decoration", ""},
index 7945df4e4c2e025bc78839511f14030ce19f0231..3108d61d2052f540b9df975866e98647a9abfd5f 100644 (file)
@@ -550,7 +550,7 @@ bool Parser::parse_macro(string & name)
 
 
        if (getToken().cat() != catBegin) {
-               lyxerr << "'{' in macro definition expected (2)\n";
+               error("'{' in macro definition expected (2)\n");
                return false;
        }
 
@@ -561,7 +561,7 @@ bool Parser::parse_macro(string & name)
        MathArray test;
        test.push_back(createMathInset(name));
        if (ar1.contains(test)) {
-               lyxerr << "we cannot handle recursive macros at all.\n";
+               error("we cannot handle recursive macros at all.\n");
                return false;
        }
 
@@ -712,9 +712,7 @@ void Parser::parse_into1(MathGridInset & grid, unsigned flags,
                else if (t.cat() == catEnd) {
                        if (flags & FLAG_BRACE_LAST)
                                return;
-                       lyxerr << "found '}' unexpectedly, cell: '" << cell << "'\n";
-                       dump();
-                       //lyxerr << "found '}' unexpectedly\n";
+                       error("found '}' unexpectedly");
                        //lyx::Assert(0);
                        //add(cell, '}', LM_TC_TEX);
                }
@@ -744,9 +742,6 @@ void Parser::parse_into1(MathGridInset & grid, unsigned flags,
                        limits = 0;
                }
 
-               else if (t.character() == ')' && (flags & FLAG_SIMPLE2))
-                       return;
-
                else if (t.character() == ']' && (flags & FLAG_BRACK_END))
                        return;
 
@@ -778,15 +773,20 @@ void Parser::parse_into1(MathGridInset & grid, unsigned flags,
                                // FIXME: check that we ended the correct environment
                                return;
                        }
-                       lyxerr << "found 'end' unexpectedly, cell: '" << cell << "'\n";
-                       dump();
+                       error("found 'end' unexpectedly");
                }
 
-               else if (t.cs() == ")")
-                       break;
+               else if (t.cs() == ")") {
+                       if (flags & FLAG_SIMPLE2)
+                               return;
+                       error("found '\\)' unexpectedly");
+               }
 
-               else if (t.cs() == "]")
-                       break;
+               else if (t.cs() == "]") {
+                       if (flags & FLAG_EQUATION)
+                               return;
+                       error("found '\\]' unexpectedly");
+               }
 
                else if (t.cs() == "\\") {
                        grid.vcrskip(LyXLength(getArg('[', ']')), cellrow);