Added debug printing function to facilitate testing expression normalization.

This commit is contained in:
2016-09-04 22:26:17 +02:00
parent c9ecd0c020
commit ed2d64c1c9
23 changed files with 185 additions and 95 deletions

View File

@@ -1,5 +1,8 @@
#include <plasp/pddl/expressions/And.h>
#include <algorithm>
#include <iostream>
namespace plasp
{
namespace pddl

View File

@@ -45,6 +45,17 @@ ExpressionPointer At::normalized()
////////////////////////////////////////////////////////////////////////////////////////////////////
void At::print(std::ostream &ostream) const
{
ostream << "(at " << m_timePoint << " ";
m_argument->print(ostream);
ostream << ")";
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
}

View File

@@ -239,6 +239,13 @@ PrimitiveTypePointer Constant::type() const
////////////////////////////////////////////////////////////////////////////////////////////////////
void Constant::print(std::ostream &ostream) const
{
ostream << "(" << m_name << ")";
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
}

View File

@@ -15,18 +15,16 @@ namespace expressions
//
////////////////////////////////////////////////////////////////////////////////////////////////////
bool Dummy::isNormalized() const
Dummy::Dummy(std::string name)
: m_name{name}
{
return m_isNormalized;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
ExpressionPointer Dummy::normalized()
void Dummy::print(std::ostream &ostream) const
{
m_isNormalized = true;
return this;
ostream << "(" << m_name << ")";
}
////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@@ -84,6 +84,17 @@ ExpressionPointer Not::normalized()
////////////////////////////////////////////////////////////////////////////////////////////////////
void Not::print(std::ostream &ostream) const
{
ostream << "(not ";
m_argument->print(ostream);
ostream << ")";
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
}

View File

@@ -170,6 +170,14 @@ const Expressions &Predicate::arguments() const
////////////////////////////////////////////////////////////////////////////////////////////////////
void Predicate::print(std::ostream &ostream) const
{
// TODO: implement correctly
ostream << "(<predicate>)";
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
}

View File

@@ -87,6 +87,14 @@ void PredicateDeclaration::normalizeParameterNames()
////////////////////////////////////////////////////////////////////////////////////////////////////
void PredicateDeclaration::print(std::ostream &ostream) const
{
// TODO: implement correctly
ostream << "(<predicate declaration>)";
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
}

View File

@@ -169,6 +169,14 @@ const PrimitiveTypes &PrimitiveType::parentTypes() const
////////////////////////////////////////////////////////////////////////////////////////////////////
void PrimitiveType::print(std::ostream &ostream) const
{
// TODO: implement correctly
ostream << "(<primitive type" << m_name << ">)";
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
}

View File

@@ -41,6 +41,14 @@ const std::string &Unsupported::type() const
////////////////////////////////////////////////////////////////////////////////////////////////////
void Unsupported::print(std::ostream &ostream) const
{
// TODO: implement correctly
ostream << "(<unsupported expression “" << m_type << "”>)";
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
}

View File

@@ -203,6 +203,14 @@ bool Variable::isDirty() const
////////////////////////////////////////////////////////////////////////////////////////////////////
void Variable::print(std::ostream &ostream) const
{
// TODO: implement correctly
ostream << "(<variable " << m_name << ">)";
}
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
}