Minor refactoring removing unnecessary temporary variable.
This commit is contained in:
parent
069ad4ca99
commit
42559fd601
@ -31,7 +31,7 @@ class Action
|
|||||||
const Expression &effect() const;
|
const Expression &effect() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Action(std::string name);
|
Action() = default;
|
||||||
|
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
|
|
||||||
|
@ -21,18 +21,11 @@ namespace pddl
|
|||||||
//
|
//
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
Action::Action(std::string name)
|
|
||||||
: m_name{name}
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
void Action::parseDeclaration(Context &context, Domain &domain)
|
void Action::parseDeclaration(Context &context, Domain &domain)
|
||||||
{
|
{
|
||||||
const auto actionName = context.parser.parseIdentifier(isIdentifier);
|
auto action = std::make_unique<Action>(Action());
|
||||||
|
|
||||||
auto action = std::make_unique<Action>(Action(actionName));
|
action->m_name = context.parser.parseIdentifier(isIdentifier);
|
||||||
|
|
||||||
context.parser.expect<std::string>(":parameters");
|
context.parser.expect<std::string>(":parameters");
|
||||||
context.parser.expect<std::string>("(");
|
context.parser.expect<std::string>("(");
|
||||||
@ -49,11 +42,9 @@ void Action::parseDeclaration(Context &context, Domain &domain)
|
|||||||
{
|
{
|
||||||
context.parser.expect<std::string>(":");
|
context.parser.expect<std::string>(":");
|
||||||
|
|
||||||
const auto sectionIdentifier = context.parser.parseIdentifier(isIdentifier);
|
if (context.parser.probe<std::string>("precondition"))
|
||||||
|
|
||||||
if (sectionIdentifier == "precondition")
|
|
||||||
action->m_precondition = parsePreconditionExpression(context, expressionContext);
|
action->m_precondition = parsePreconditionExpression(context, expressionContext);
|
||||||
else if (sectionIdentifier == "effect")
|
else if (context.parser.probe<std::string>("effect"))
|
||||||
action->m_effect = parseEffectExpression(context, expressionContext);
|
action->m_effect = parseEffectExpression(context, expressionContext);
|
||||||
|
|
||||||
context.parser.skipWhiteSpace();
|
context.parser.skipWhiteSpace();
|
||||||
|
Reference in New Issue
Block a user