/* This file is part of * ====================================================== * * LyX, The Document Processor * * Copyright (C) 1995 Matthias Ettrich * Copyright (C) 1995-1998 The LyX Team. *
*======================================================*/
// Used to handle things like \command[foo[bar]]{foo{bar}} int nestdepth = 0;
for (int i=0; i<cmd.length(); i++) { char c = cmd[i]; if ((state==Command && c == ' ') ||
(state==Command && c == '[') ||
(state==Command && c == '{')) {
state = WS;
} if ((state==Option && c == ']') ||
(state==Content && c == '}')) { if (nestdepth==0) {
state = WS;
} else {
nestdepth--;
}
} if ((state==Option && c == '[') ||
(state==Content && c == '{')) {
nestdepth++;
} switch (state) { case Command: tcommand += c; break; case Option: toptions += c; break; case Content: tcontents += c; break; case WS: if (c == '\\') {
state = Command;
} elseif (c == '[') {
state = Option;
nestdepth = 0; // Just to be sure
} elseif (c == '{') {
state = Content;
nestdepth = 0; // Just to be sure
} break;
}
}
// Don't mess with this. if (!tcommand.empty()) command = tcommand; if (!toptions.empty()) options = toptions; if (!tcontents.empty()) setContents(tcontents); // setContents is overloaded in InsetInclude
// This function will not be necessary when lyx3 void InsetCommand::Read(LyXLex &lex)
{ if (lex.EatLine()) {
LString t = lex.GetString();
scanCommand(t);
} else
lex.printError("InsetCommand: Parse error: `$$Token'");
}
LString InsetCommand::getCommand() const
{
LString s; if (!command.empty()) s += "\\"+command; if (!options.empty()) s += "["+options+']'; if (!contents.empty()) s += "{"+contents+'}'; return s;
}
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.