Removed unneeded temporary object.

This commit is contained in:
Patrick Lühne 2016-06-08 01:44:06 +02:00
parent 183b0c954e
commit 374ac3b07f

View File

@ -105,29 +105,32 @@ const expressions::Constants &Problem::objects() const
void Problem::parseSection() void Problem::parseSection()
{ {
m_context.parser.expect<std::string>("("); auto &parser = m_context.parser;
m_context.parser.expect<std::string>(":");
const auto sectionIdentifier = m_context.parser.parseIdentifier(isIdentifier); parser.expect<std::string>("(");
parser.expect<std::string>(":");
// TODO: check order of the sections // TODO: check order of the sections
if (sectionIdentifier == "domain") if (parser.probe<std::string>("domain"))
parseDomainSection(); parseDomainSection();
else if (sectionIdentifier == "requirements") else if (parser.probe<std::string>("requirements"))
parseRequirementSection(); parseRequirementSection();
else if (sectionIdentifier == "objects") else if (parser.probe<std::string>("objects"))
parseObjectSection(); parseObjectSection();
else if (sectionIdentifier == "init" else if (parser.probe<std::string>("init")
|| sectionIdentifier == "goal" || parser.probe<std::string>("goal")
|| sectionIdentifier == "constraints" || parser.probe<std::string>("constraints")
|| sectionIdentifier == "metric" || parser.probe<std::string>("metric")
|| sectionIdentifier == "length") || parser.probe<std::string>("length"))
{ {
std::cout << "Skipping section " << sectionIdentifier << std::endl; std::cout << "Skipping section" << std::endl;
skipSection(m_context.parser); skipSection(m_context.parser);
} }
else else
{
const auto sectionIdentifier = parser.parseIdentifier(isIdentifier);
throw utils::ParserException(m_context.parser, "Unknown problem section \"" + sectionIdentifier + "\""); throw utils::ParserException(m_context.parser, "Unknown problem section \"" + sectionIdentifier + "\"");
}
} }
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////