handle \cr and \crcr like \\

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3013 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2001-11-12 18:00:20 +00:00
parent 5843696fe9
commit 29663cf58f
3 changed files with 9 additions and 5 deletions

View File

@ -37,7 +37,6 @@ key_type wordlist_array[] =
{";", LM_TK_SPACE, 3},
{"Pr", LM_TK_FUNCLIM, 0},
{"[", LM_TK_BEGIN, LM_OT_EQUATION},
{"\\", LM_TK_NEWLINE, static_cast<unsigned>(-1)}, // -1 needed in mathed_parse_lines!
{"]", LM_TK_END, LM_OT_EQUATION},
{"_", LM_TK_SPECIAL, '_'},
{"acute", LM_TK_DECORATION, 0},

View File

@ -188,6 +188,8 @@ public:
char character() const { return char_; }
///
string asString() const;
///
bool isCR() const;
private:
///
@ -198,6 +200,11 @@ private:
CatCode cat_;
};
bool Token::isCR() const
{
return cs_ == "\\" || cs_ == "cr" || cs_ == "crcr";
}
string Token::asString() const
{
return cs_.size() ? cs_ : string(1, char_);
@ -507,7 +514,7 @@ bool Parser::parse_lines(MathAtom & t, bool numbered, bool outmost)
}
// no newline?
if (prevToken() != Token("\\")) {
if (!prevToken().isCR()) {
//lyxerr << "no newline here\n";
break;
}
@ -699,7 +706,7 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
}
if (flags & FLAG_BLOCK) {
if (t.cat() == catAlign || t.cs() == "\\")
if (t.cat() == catAlign || t.isCR())
return;
if (t.cs() == "end") {
getArg('{', '}');

View File

@ -59,8 +59,6 @@ enum MathTokenEnum
LM_TK_BEGIN,
///
LM_TK_END,
///
LM_TK_NEWLINE,
/// mathcal, mathrm...
LM_TK_OLDFONT,
/// cal,...