Fix stupid parser bug

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4496 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2002-06-27 11:31:32 +00:00
parent 9724b8dd78
commit f660211af3
2 changed files with 14 additions and 18 deletions

View File

@ -64,13 +64,9 @@ struct key_type {
key_type wordlist_array[] = key_type wordlist_array[] =
{ {
{"!", "space", ""}, {"!", "space", ""},
//{"(", "begin", ""},
//{")", "end", ""},
{",", "space", ""}, {",", "space", ""},
{":", "space", ""}, {":", "space", ""},
{";", "space", ""}, {";", "space", ""},
//{"[", "begin", ""},
//{"]", "end", ""},
{"Vmatrix", "matrix", ""}, {"Vmatrix", "matrix", ""},
{"acute", "decoration", ""}, {"acute", "decoration", ""},
{"bar", "decoration", ""}, {"bar", "decoration", ""},

View File

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