Add more debug statments, and use the same channel for the same class of error.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8950 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
José Matox 2004-08-16 00:16:17 +00:00
parent c7c1ec103f
commit 2f298af791
2 changed files with 24 additions and 20 deletions

View File

@ -1,3 +1,10 @@
2004-08-16 José Matos <jamatos@lyx.org>
* text.C (readParToken, readParagraph, read): report all unknown tokens.
For the same level of importance use the same chanel to report problems.
(read): add code to deal with \begin_body and \end_body.
2004-08-15 José Matos <jamatos@lyx.org>
* lyxlex.C (getString): fix comment, buffer::readBody is now

View File

@ -159,7 +159,7 @@ int numberOfHfills(Paragraph const & par, Row const & row)
}
int readParToken(Buffer const & buf, Paragraph & par, LyXLex & lex,
void readParToken(Buffer const & buf, Paragraph & par, LyXLex & lex,
string const & token, LyXFont & font)
{
static Change change;
@ -187,11 +187,9 @@ int readParToken(Buffer const & buf, Paragraph & par, LyXLex & lex,
bool hasLayout = tclass.hasLayout(layoutname);
if (!hasLayout) {
lyxerr << "Layout '" << layoutname << "' does not"
<< " exist in textclass '" << tclass.name()
<< "'." << endl;
lyxerr << "Trying to use default layout instead."
<< endl;
buf.error(ErrorItem(_("Unknown layout"),
bformat(_("Layout '%1$s' does not exists in textclass '%2$s'\nTrying to use the default instead.\n"),
layoutname, tclass.name()), par.id(), 0, par.size()));
layoutname = tclass.defaultLayoutName();
}
@ -219,7 +217,6 @@ int readParToken(Buffer const & buf, Paragraph & par, LyXLex & lex,
string line = lex.getString();
buf.error(ErrorItem(_("Unknown Inset"), line,
par.id(), 0, par.size()));
return 1;
}
} else if (token == "\\family") {
lex.next();
@ -345,23 +342,19 @@ int readParToken(Buffer const & buf, Paragraph & par, LyXLex & lex,
buf.error(ErrorItem(_("Unknown token"),
bformat(_("Unknown token: %1$s %2$s\n"), token, lex.getString()),
par.id(), 0, par.size()));
return 1;
}
return 0;
}
int readParagraph(Buffer const & buf, Paragraph & par, LyXLex & lex)
void readParagraph(Buffer const & buf, Paragraph & par, LyXLex & lex)
{
int unknown = 0;
lex.nextToken();
string token = lex.getString();
LyXFont font;
while (lex.isOK()) {
unknown += readParToken(buf, par, lex, token, font);
readParToken(buf, par, lex, token, font);
lex.nextToken();
token = lex.getString();
@ -385,9 +378,8 @@ int readParagraph(Buffer const & buf, Paragraph & par, LyXLex & lex)
<< "Missing \\end_layout.\n";
break;
}
lyxerr << "Paragraph token unknown: `" << token << '\'' << endl;
}
return unknown;
}
@ -1867,13 +1859,18 @@ bool LyXText::read(Buffer const & buf, LyXLex & lex)
break;
}
if (token == "\\end_body") {
continue;
}
if (token == "\\begin_body") {
continue;
}
if (token == "\\end_document") {
return false;
}
// FIXME: ugly.
int unknown = 0;
if (token == "\\begin_layout") {
lex.pushToken(token);
@ -1897,9 +1894,9 @@ bool LyXText::read(Buffer const & buf, LyXLex & lex)
--depth;
}
} else {
++unknown;
lyxerr << "Handling unknown body token: `"
<< token << '\'' << endl;
}
}
return true;
}