patrick
/
plasp
Archived
1
0
Fork 0
This repository has been archived on 2023-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
plasp/lib/pddl/src/pddl/detail/normalization/Fact.cpp

40 lines
970 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <pddl/detail/normalization/Fact.h>
#include <pddl/AST.h>
#include <pddl/Exception.h>
#include <pddl/NormalizedAST.h>
#include <pddl/detail/normalization/Literal.h>
namespace pddl
{
namespace detail
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Fact
//
////////////////////////////////////////////////////////////////////////////////////////////////////
normalizedAST::Fact normalize(ast::Fact &&fact)
{
const auto handleLiteral =
[&](ast::Literal &literal) -> normalizedAST::Literal
{
return normalize(std::move(literal));
};
const auto handleAt =
[&](ast::AtPointer<ast::Literal> &) -> normalizedAST::Literal
{
throw NormalizationException("“at” expressions in preconditions cant be normalized currently");
};
return fact.match(handleLiteral, handleAt);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}