#include "support/gettext.h"
#include "support/lstrings.h"
-#include <boost/assert.hpp>
+#include "support/lassert.h"
using namespace std;
using namespace lyx::support;
case BIBTEX_CODE:
return InsetBibtex::findInfo(cmdName);
case CITE_CODE:
- return InsetCitation::findInfo(cmdName);
+ return InsetCitation::findInfo(cmdName);
case FLOAT_LIST_CODE:
return InsetFloatList::findInfo(cmdName);
case HYPERLINK_CODE:
case INDEX_PRINT_CODE:
return InsetPrintIndex::findInfo(cmdName);
case LABEL_CODE:
- return InsetLabel::findInfo(cmdName);
+ return InsetLabel::findInfo(cmdName);
case NOMENCL_CODE:
return InsetNomencl::findInfo(cmdName);
case NOMENCL_PRINT_CODE:
case TOC_CODE:
return InsetTOC::findInfo(cmdName);
default:
- BOOST_ASSERT(false);
+ LASSERT(false, /**/);
}
static const ParamInfo pi;
return pi; // to silence the warning
ParamInfo::ParamData const &
ParamInfo::operator[](std::string const & name) const
{
- BOOST_ASSERT(hasParam(name));
+ LASSERT(hasParam(name), /**/);
const_iterator it = begin();
const_iterator last = end();
for (; it != last; ++it) {
case TOC_CODE:
return InsetTOC::defaultCommand();
default:
- BOOST_ASSERT(false);
+ LASSERT(false, /**/);
}
return string(); // silence the warning
}
case TOC_CODE:
return InsetTOC::isCompatibleCommand(s);
default:
- BOOST_ASSERT(false);
+ LASSERT(false, /**/);
}
return false; // silence the warning
}
void InsetCommandParams::read(Lexer & lex)
{
- if (lex.isOK()) {
- lex.next();
- string const insetType = lex.getString();
- InsetCode const code = insetCode(insetType);
- if (code != insetCode_) {
- lex.printError("InsetCommandParams: Attempt to change type of inset.");
- throw ExceptionMessage(WarningException, _("InsetCommandParams Error: "),
- _("Attempt to change type of parameters."));
- }
- }
-
- if (lex.isOK()) {
- lex.next();
- string const test = lex.getString();
- if (test != "LatexCommand") {
- lex.printError("InsetCommandParams: No LatexCommand line found.");
- throw ExceptionMessage(WarningException, _("InsetCommandParams error: "),
- _("Can't find LatexCommand line."));
- }
- }
- lex.next();
- cmdName_ = lex.getString();
- if (!isCompatibleCommand(insetCode_, cmdName_)){
- lex.printError("InsetCommandParams: Incompatible command name " + cmdName_ + ".");
+ lex.setContext("InsetCommandParams::read");
+ lex >> insetName(insetCode_).c_str();
+ lex >> "LatexCommand";
+ lex >> cmdName_;
+ if (!isCompatibleCommand(insetCode_, cmdName_)) {
+ lex.printError("Incompatible command name " + cmdName_ + ".");
throw ExceptionMessage(WarningException, _("InsetCommandParams Error: "),
_("Incompatible command name."));
}
lex.printError("Missing \\end_inset at this point. "
"Read: `$$Token'");
throw ExceptionMessage(WarningException,
- _("Missing \\end_inset at this point."),
- from_utf8(token));
+ _("InsetCommandParams Error: "),
+ _("Missing \\end_inset at this point: ") + from_utf8(token));
}
}
bool InsetCommandParams::writeEmptyOptional(ParamInfo::const_iterator ci) const
{
- if (!ci->isOptional())
- BOOST_ASSERT(false);
+ if (!ci->isOptional()) {
+ LASSERT(false, /**/);
+ }
++ci; // we want to start with the next one
ParamInfo::const_iterator end = info_.end();
for (; ci != end; ++ci) {
ParamInfo::const_iterator it =
find_if(info_.begin(), info_.end(),
not1(mem_fun_ref(&ParamInfo::ParamData::isOptional)));
- if (it == info_.end())
- BOOST_ASSERT(false);
+ if (it == info_.end()) {
+ LASSERT(false, return docstring());
+ }
return (*this)[it->name()];
}
docstring const & InsetCommandParams::operator[](string const & name) const
{
static const docstring dummy; //so we don't return a ref to temporary
- BOOST_ASSERT(info_.hasParam(name));
+ LASSERT(info_.hasParam(name), return dummy);
ParamMap::const_iterator data = params_.find(name);
if (data == params_.end() || data->second.empty())
return dummy;
docstring & InsetCommandParams::operator[](string const & name)
{
- BOOST_ASSERT(info_.hasParam(name));
+ LASSERT(info_.hasParam(name), /**/);
return params_[name];
}