InsetCommand::InsetCommand()
-{
-}
+{}
InsetCommand::InsetCommand(string const & cmd, string const & arg,
string const & opt)
: cmdname(cmd), options(opt), contents(arg)
-{
-}
+{}
// In lyxf3 this will be just LaTeX
// This function will not be necessary when lyx3
void InsetCommand::Read(Buffer const *, LyXLex & lex)
{
+ string token;
+
if (lex.EatLine()) {
- string t = lex.GetString();
- scanCommand(t);
+ token = lex.GetString();
+ scanCommand(token);
} else
lex.printError("InsetCommand: Parse error: `$$Token'");
+ while (lex.IsOK()) {
+ lex.nextToken();
+ token = lex.GetString();
+ if (token == "\\end_inset")
+ break;
+ }
+ if (token != "\\end_inset") {
+ lex.printError("Missing \\end_inset at this point. "
+ "Read: `$$Token'");
+ }
}
-int InsetCommand::Latex(Buffer const *, ostream & os, bool /*fragile*/, bool/*fs*/) const
+int InsetCommand::Latex(Buffer const *, ostream & os,
+ bool /*fragile*/, bool/*fs*/) const
{
os << getCommand();
return 0;