From f72aef6cb3dc7b1f77e7089cc569553a0ad0ead6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Mon, 5 Aug 2002 06:39:33 +0000 Subject: [PATCH] fix parser bug git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4856 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/math_parser.C | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index aa9c09cbed..18d8064444 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -564,13 +564,13 @@ void Parser::parse1(MathGridInset & grid, unsigned flags, if (flags & FLAG_OPTION) { if (t.cat() == catOther && t.character() == '[') { - // skip the bracket and collect everything to the closing bracket - flags |= FLAG_BRACK_LAST; - continue; + MathArray ar; + parse(ar, FLAG_BRACK_LAST, mathmode); + cell->append(ar); + } else { + // no option found, put back token and we are done + putback(); } - - // no option found, put back token and we are done - putback(); return; } @@ -665,8 +665,10 @@ void Parser::parse1(MathGridInset & grid, unsigned flags, limits = 0; } - else if (t.character() == ']' && (flags & FLAG_BRACK_LAST)) + else if (t.character() == ']' && (flags & FLAG_BRACK_LAST)) { + lyxerr << "finished reading option\n"; return; + } else if (t.cat() == catOther) cell->push_back(MathAtom(new MathCharInset(t.character()))); @@ -842,6 +844,8 @@ void Parser::parse1(MathGridInset & grid, unsigned flags, else if (t.cs() == "sqrt") { MathArray ar; parse(ar, FLAG_OPTION, mathmode); + lyxerr << "read option: " << ar << endl; + dump(); if (ar.size()) { cell->push_back(MathAtom(new MathRootInset)); cell->back()->cell(0) = ar;