From f660211af3ae309b69b3e66e08faf47525787909 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Thu, 27 Jun 2002 11:31:32 +0000 Subject: [PATCH] Fix stupid parser bug git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4496 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/math_factory.C | 4 ---- src/mathed/math_parser.C | 28 ++++++++++++++-------------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/mathed/math_factory.C b/src/mathed/math_factory.C index 6193b8a55f..835c0b98ce 100644 --- a/src/mathed/math_factory.C +++ b/src/mathed/math_factory.C @@ -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", ""}, diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index 7945df4e4c..3108d61d20 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -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); -- 2.39.2