From 0e5ee59ea7f661be205d63a6e93da9b557ee0c05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Wed, 29 Mar 2017 21:32:11 +0200 Subject: [PATCH] Simplified handling of unsupported clingo statements. --- include/anthem/StatementVisitor.h | 65 ++----------------------------- 1 file changed, 3 insertions(+), 62 deletions(-) diff --git a/include/anthem/StatementVisitor.h b/include/anthem/StatementVisitor.h index 941e07c..4008a9c 100644 --- a/include/anthem/StatementVisitor.h +++ b/include/anthem/StatementVisitor.h @@ -128,69 +128,10 @@ struct StatementVisitor return formulas; } - std::vector visit(const Clingo::AST::Definition &, const Clingo::AST::Statement &statement, Context &context) + template + std::vector visit(const T &, const Clingo::AST::Statement &statement, Context &context) { - throwErrorAtLocation(statement.location, "“definition” statements currently unsupported", context); - return {}; - } - - std::vector visit(const Clingo::AST::ShowSignature &, const Clingo::AST::Statement &statement, Context &context) - { - throwErrorAtLocation(statement.location, "“show signature” statements currently unsupported", context); - return {}; - } - - std::vector visit(const Clingo::AST::ShowTerm &, const Clingo::AST::Statement &statement, Context &context) - { - throwErrorAtLocation(statement.location, "“show term” statements currently unsupported", context); - return {}; - } - - std::vector visit(const Clingo::AST::Minimize &, const Clingo::AST::Statement &statement, Context &context) - { - throwErrorAtLocation(statement.location, "“minimize” statements currently unsupported", context); - return {}; - } - - std::vector visit(const Clingo::AST::Script &, const Clingo::AST::Statement &statement, Context &context) - { - throwErrorAtLocation(statement.location, "“script” statements currently unsupported", context); - return {}; - } - - std::vector visit(const Clingo::AST::External &, const Clingo::AST::Statement &statement, Context &context) - { - throwErrorAtLocation(statement.location, "“external” statements currently unsupported", context); - return {}; - } - - std::vector visit(const Clingo::AST::Edge &, const Clingo::AST::Statement &statement, Context &context) - { - throwErrorAtLocation(statement.location, "“edge” statements currently unsupported", context); - return {}; - } - - std::vector visit(const Clingo::AST::Heuristic &, const Clingo::AST::Statement &statement, Context &context) - { - throwErrorAtLocation(statement.location, "“heuristic” statements currently unsupported", context); - return {}; - } - - std::vector visit(const Clingo::AST::ProjectAtom &, const Clingo::AST::Statement &statement, Context &context) - { - throwErrorAtLocation(statement.location, "“project atom” statements currently unsupported", context); - return {}; - } - - std::vector visit(const Clingo::AST::ProjectSignature &, const Clingo::AST::Statement &statement, Context &context) - { - throwErrorAtLocation(statement.location, "“project signature” statements currently unsupported", context); - return {}; - } - - std::vector visit(const Clingo::AST::TheoryDefinition &, const Clingo::AST::Statement &statement, Context &context) - { - throwErrorAtLocation(statement.location, "“theory definition” statements currently unsupported", context); + throwErrorAtLocation(statement.location, "statement currently unsupported, expected rule", context); return {}; } };