To-dos and formatting.
This commit is contained in:
parent
8db4b5a53e
commit
069ad4ca99
@ -28,8 +28,6 @@ class Constant: public Expression
|
|||||||
|
|
||||||
static Constant *parseAndFind(Context &context, const ExpressionContext &expressionContext);
|
static Constant *parseAndFind(Context &context, const ExpressionContext &expressionContext);
|
||||||
|
|
||||||
// TODO: method for lazy creation if not existing
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void accept(ExpressionVisitor &expressionVisitor) const override;
|
void accept(ExpressionVisitor &expressionVisitor) const override;
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ void Domain::parseRequirementSection()
|
|||||||
m_context.parser.skipWhiteSpace();
|
m_context.parser.skipWhiteSpace();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Do this check only once the problem is parsed
|
// TODO: do this check only once the problem is parsed
|
||||||
// If no requirements are specified, assume STRIPS
|
// If no requirements are specified, assume STRIPS
|
||||||
if (m_requirements.empty())
|
if (m_requirements.empty())
|
||||||
m_requirements.emplace_back(Requirement::Type::STRIPS);
|
m_requirements.emplace_back(Requirement::Type::STRIPS);
|
||||||
@ -310,14 +310,6 @@ void Domain::parseActionSection()
|
|||||||
|
|
||||||
void Domain::checkConsistency()
|
void Domain::checkConsistency()
|
||||||
{
|
{
|
||||||
// Verify that all used predicates have been declared
|
|
||||||
std::for_each(m_predicateDeclarations.cbegin(), m_predicateDeclarations.cend(),
|
|
||||||
[&](const auto &predicate)
|
|
||||||
{
|
|
||||||
if (!predicate->isDeclared())
|
|
||||||
throw ConsistencyException("Predicate \"" + predicate->name() + "\" used but never declared");
|
|
||||||
});
|
|
||||||
|
|
||||||
// Verify that constants are unique
|
// Verify that constants are unique
|
||||||
// Verify that all primitive types are unique
|
// Verify that all primitive types are unique
|
||||||
// Check for case-sensitivity issues
|
// Check for case-sensitivity issues
|
||||||
|
@ -159,7 +159,7 @@ void Problem::parseRequirementSection()
|
|||||||
m_context.parser.skipWhiteSpace();
|
m_context.parser.skipWhiteSpace();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Do this check only once the domain is parsed
|
// TODO: do this check only once the domain is parsed
|
||||||
// If no requirements are specified, assume STRIPS
|
// If no requirements are specified, assume STRIPS
|
||||||
if (m_requirements.empty())
|
if (m_requirements.empty())
|
||||||
m_requirements.emplace_back(Requirement::Type::STRIPS);
|
m_requirements.emplace_back(Requirement::Type::STRIPS);
|
||||||
|
@ -45,8 +45,6 @@ ConstantPointer Constant::parseDeclaration(Context &context)
|
|||||||
// Flag constant for potentially upcoming type declaration
|
// Flag constant for potentially upcoming type declaration
|
||||||
constant->setDirty();
|
constant->setDirty();
|
||||||
|
|
||||||
// TODO: Store constant in hash map
|
|
||||||
|
|
||||||
return constant;
|
return constant;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,12 +139,12 @@ Constant *Constant::parseAndFind(Context &context, const ExpressionContext &expr
|
|||||||
|
|
||||||
Constant *Constant::parseAndFind(const std::string &constantName, const Constants &constants)
|
Constant *Constant::parseAndFind(const std::string &constantName, const Constants &constants)
|
||||||
{
|
{
|
||||||
// TODO: use hash map
|
|
||||||
const auto match = std::find_if(constants.cbegin(), constants.cend(),
|
const auto match = std::find_if(constants.cbegin(), constants.cend(),
|
||||||
[&](const auto &constant)
|
[&](const auto &constant)
|
||||||
{
|
{
|
||||||
return constant->name() == constantName;
|
return constant->name() == constantName;
|
||||||
});
|
});
|
||||||
|
|
||||||
const auto constantExists = (match != constants.cend());
|
const auto constantExists = (match != constants.cend());
|
||||||
|
|
||||||
if (!constantExists)
|
if (!constantExists)
|
||||||
|
@ -46,7 +46,6 @@ void PrimitiveType::parseDeclaration(Context &context, Domain &domain)
|
|||||||
|
|
||||||
const auto typeName = context.parser.parseIdentifier(isIdentifier);
|
const auto typeName = context.parser.parseIdentifier(isIdentifier);
|
||||||
|
|
||||||
// TODO: use hash map
|
|
||||||
const auto match = std::find_if(types.cbegin(), types.cend(),
|
const auto match = std::find_if(types.cbegin(), types.cend(),
|
||||||
[&](const auto &primitiveType)
|
[&](const auto &primitiveType)
|
||||||
{
|
{
|
||||||
@ -113,7 +112,6 @@ PrimitiveType *PrimitiveType::parseAndFind(Context &context, Domain &domain)
|
|||||||
|
|
||||||
BOOST_ASSERT(!typeName.empty());
|
BOOST_ASSERT(!typeName.empty());
|
||||||
|
|
||||||
// TODO: use hash map
|
|
||||||
const auto match = std::find_if(types.cbegin(), types.cend(),
|
const auto match = std::find_if(types.cbegin(), types.cend(),
|
||||||
[&](const auto &primitiveType)
|
[&](const auto &primitiveType)
|
||||||
{
|
{
|
||||||
|
@ -21,6 +21,7 @@ TEST(UtilsTests, ParseSimple)
|
|||||||
ASSERT_THROW(p.expect<std::string>("expected"), plasp::utils::ParserException);
|
ASSERT_THROW(p.expect<std::string>("expected"), plasp::utils::ParserException);
|
||||||
|
|
||||||
// TODO: test case-insensitive input
|
// TODO: test case-insensitive input
|
||||||
|
// TODO: test probing
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
Reference in New Issue
Block a user