diff --git a/src/plasp/pddl/Problem.cpp b/src/plasp/pddl/Problem.cpp index 4ec03cc..941a7d4 100644 --- a/src/plasp/pddl/Problem.cpp +++ b/src/plasp/pddl/Problem.cpp @@ -105,29 +105,32 @@ const expressions::Constants &Problem::objects() const void Problem::parseSection() { - m_context.parser.expect("("); - m_context.parser.expect(":"); + auto &parser = m_context.parser; - const auto sectionIdentifier = m_context.parser.parseIdentifier(isIdentifier); + parser.expect("("); + parser.expect(":"); // TODO: check order of the sections - if (sectionIdentifier == "domain") + if (parser.probe("domain")) parseDomainSection(); - else if (sectionIdentifier == "requirements") + else if (parser.probe("requirements")) parseRequirementSection(); - else if (sectionIdentifier == "objects") + else if (parser.probe("objects")) parseObjectSection(); - else if (sectionIdentifier == "init" - || sectionIdentifier == "goal" - || sectionIdentifier == "constraints" - || sectionIdentifier == "metric" - || sectionIdentifier == "length") + else if (parser.probe("init") + || parser.probe("goal") + || parser.probe("constraints") + || parser.probe("metric") + || parser.probe("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 + "\""); + } } ////////////////////////////////////////////////////////////////////////////////////////////////////