From 069ad4ca99decefcfe6ad3857c19dc3e6bbc088a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Wed, 8 Jun 2016 01:19:49 +0200 Subject: [PATCH] To-dos and formatting. --- include/plasp/pddl/expressions/Constant.h | 2 -- src/plasp/pddl/Domain.cpp | 10 +--------- src/plasp/pddl/Problem.cpp | 2 +- src/plasp/pddl/expressions/Constant.cpp | 4 +--- src/plasp/pddl/expressions/PrimitiveType.cpp | 2 -- tests/TestUtils.cpp | 1 + 6 files changed, 4 insertions(+), 17 deletions(-) diff --git a/include/plasp/pddl/expressions/Constant.h b/include/plasp/pddl/expressions/Constant.h index ee4b83e..9864af0 100644 --- a/include/plasp/pddl/expressions/Constant.h +++ b/include/plasp/pddl/expressions/Constant.h @@ -28,8 +28,6 @@ class Constant: public Expression static Constant *parseAndFind(Context &context, const ExpressionContext &expressionContext); - // TODO: method for lazy creation if not existing - public: void accept(ExpressionVisitor &expressionVisitor) const override; diff --git a/src/plasp/pddl/Domain.cpp b/src/plasp/pddl/Domain.cpp index 4a8d7a3..0ea864b 100644 --- a/src/plasp/pddl/Domain.cpp +++ b/src/plasp/pddl/Domain.cpp @@ -184,7 +184,7 @@ void Domain::parseRequirementSection() 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 (m_requirements.empty()) m_requirements.emplace_back(Requirement::Type::STRIPS); @@ -310,14 +310,6 @@ void Domain::parseActionSection() 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 all primitive types are unique // Check for case-sensitivity issues diff --git a/src/plasp/pddl/Problem.cpp b/src/plasp/pddl/Problem.cpp index 490b4e4..4ec03cc 100644 --- a/src/plasp/pddl/Problem.cpp +++ b/src/plasp/pddl/Problem.cpp @@ -159,7 +159,7 @@ void Problem::parseRequirementSection() 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 (m_requirements.empty()) m_requirements.emplace_back(Requirement::Type::STRIPS); diff --git a/src/plasp/pddl/expressions/Constant.cpp b/src/plasp/pddl/expressions/Constant.cpp index 3e4c004..12a88e1 100644 --- a/src/plasp/pddl/expressions/Constant.cpp +++ b/src/plasp/pddl/expressions/Constant.cpp @@ -45,8 +45,6 @@ ConstantPointer Constant::parseDeclaration(Context &context) // Flag constant for potentially upcoming type declaration constant->setDirty(); - // TODO: Store constant in hash map - return constant; } @@ -141,12 +139,12 @@ Constant *Constant::parseAndFind(Context &context, const ExpressionContext &expr 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 &constant) { return constant->name() == constantName; }); + const auto constantExists = (match != constants.cend()); if (!constantExists) diff --git a/src/plasp/pddl/expressions/PrimitiveType.cpp b/src/plasp/pddl/expressions/PrimitiveType.cpp index 86c8141..fb61e86 100644 --- a/src/plasp/pddl/expressions/PrimitiveType.cpp +++ b/src/plasp/pddl/expressions/PrimitiveType.cpp @@ -46,7 +46,6 @@ void PrimitiveType::parseDeclaration(Context &context, Domain &domain) const auto typeName = context.parser.parseIdentifier(isIdentifier); - // TODO: use hash map const auto match = std::find_if(types.cbegin(), types.cend(), [&](const auto &primitiveType) { @@ -113,7 +112,6 @@ PrimitiveType *PrimitiveType::parseAndFind(Context &context, Domain &domain) BOOST_ASSERT(!typeName.empty()); - // TODO: use hash map const auto match = std::find_if(types.cbegin(), types.cend(), [&](const auto &primitiveType) { diff --git a/tests/TestUtils.cpp b/tests/TestUtils.cpp index 192bef2..89b3a48 100644 --- a/tests/TestUtils.cpp +++ b/tests/TestUtils.cpp @@ -21,6 +21,7 @@ TEST(UtilsTests, ParseSimple) ASSERT_THROW(p.expect("expected"), plasp::utils::ParserException); // TODO: test case-insensitive input + // TODO: test probing } ////////////////////////////////////////////////////////////////////////////////////////////////////