void InsetNewlineParams::read(Lexer & lex)
{
- lex.next();
- string const command = lex.getString();
-
- if (command == "newline")
+ string token;
+ lex.setContext("InsetNewlineParams::read");
+ lex >> token;
+ if (token == "newline")
kind = InsetNewlineParams::NEWLINE;
- else if (command == "linebreak")
+ else if (token == "linebreak")
kind = InsetNewlineParams::LINEBREAK;
else
- lex.printError("InsetNewline: Unknown kind: `$$Token'");
-
- string token;
- lex >> token;
- if (!lex)
- return;
- if (token != "\\end_inset")
- lex.printError("Missing \\end_inset at this point. "
- "Read: `$$Token'");
+ lex.printError("Unknown kind: `$$Token'");
+ lex >> "\\end_inset";
}
InsetNewlineParams params;
string2params(to_utf8(cmd.argument()), params);
status.setOnOff(params_.kind == params.kind);
- } else {
- status.enabled(true);
}
+ status.setEnabled(true);
return true;
default:
return Inset::getStatus(cur, cmd, status);
params = InsetNewlineParams();
if (in.empty())
return;
-
istringstream data(in);
Lexer lex;
lex.setStream(data);
-
- string name;
- lex >> name;
- if (!lex || name != "newline") {
- LYXERR0("Expected arg 1 to be \"newlien\" in " << in);
- return;
- }
-
+ lex.setContext("InsetNewline::string2params");
+ lex >> "newline";
params.read(lex);
}