diff --git a/include/plasp/pddl/Action.h b/include/plasp/pddl/Action.h index ee3461a..f10ae14 100644 --- a/include/plasp/pddl/Action.h +++ b/include/plasp/pddl/Action.h @@ -31,7 +31,7 @@ class Action const Expression &effect() const; private: - Action(std::string name); + Action() = default; std::string m_name; diff --git a/src/plasp/pddl/Action.cpp b/src/plasp/pddl/Action.cpp index b46f943..45a332d 100644 --- a/src/plasp/pddl/Action.cpp +++ b/src/plasp/pddl/Action.cpp @@ -21,18 +21,11 @@ namespace pddl // //////////////////////////////////////////////////////////////////////////////////////////////////// -Action::Action(std::string name) -: m_name{name} -{ -} - -//////////////////////////////////////////////////////////////////////////////////////////////////// - void Action::parseDeclaration(Context &context, Domain &domain) { - const auto actionName = context.parser.parseIdentifier(isIdentifier); + auto action = std::make_unique(Action()); - auto action = std::make_unique(Action(actionName)); + action->m_name = context.parser.parseIdentifier(isIdentifier); context.parser.expect(":parameters"); context.parser.expect("("); @@ -49,11 +42,9 @@ void Action::parseDeclaration(Context &context, Domain &domain) { context.parser.expect(":"); - const auto sectionIdentifier = context.parser.parseIdentifier(isIdentifier); - - if (sectionIdentifier == "precondition") + if (context.parser.probe("precondition")) action->m_precondition = parsePreconditionExpression(context, expressionContext); - else if (sectionIdentifier == "effect") + else if (context.parser.probe("effect")) action->m_effect = parseEffectExpression(context, expressionContext); context.parser.skipWhiteSpace();