patrick
/
plasp
Archived
1
0
Fork 0

Removed unneeded temporary object.

This commit is contained in:
Patrick Lühne 2016-06-08 01:44:06 +02:00
parent 183b0c954e
commit 374ac3b07f
1 changed files with 15 additions and 12 deletions

View File

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