Renamed internal variables for clarity.
This commit is contained in:
parent
95984f0447
commit
0285c1cbbb
@ -17,8 +17,8 @@ int main(int argc, char **argv)
|
||||
("help,h", "Display this help message")
|
||||
("version,v", "Display version information")
|
||||
("input,i", po::value<std::vector<std::string>>(), "Input files")
|
||||
("simplify,s", po::bool_switch(&context.simplify), "Simplify the output")
|
||||
("complete,c", po::bool_switch(&context.complete), "Perform completion")
|
||||
("simplify,s", po::bool_switch(&context.performSimplification), "Simplify the output")
|
||||
("complete,c", po::bool_switch(&context.performCompletion), "Perform completion")
|
||||
("color", po::value<std::string>()->default_value("auto"), "Colorize output (always, never, auto)")
|
||||
("log-priority,p", po::value<std::string>()->default_value("warning"), "Log messages starting from this priority (debug, info, warning, error)");
|
||||
|
||||
|
@ -26,8 +26,8 @@ struct Context
|
||||
|
||||
output::Logger logger;
|
||||
|
||||
bool simplify = false;
|
||||
bool complete = false;
|
||||
bool performSimplification = false;
|
||||
bool performCompletion = false;
|
||||
|
||||
std::experimental::optional<std::vector<ast::PredicateSignature>> visiblePredicateSignatures;
|
||||
};
|
||||
|
@ -58,13 +58,13 @@ void translate(const char *fileName, std::istream &stream, Context &context)
|
||||
|
||||
Clingo::parse_program(fileContent.c_str(), translateStatement, logger);
|
||||
|
||||
if (context.simplify)
|
||||
if (context.performSimplification)
|
||||
for (auto &scopedFormula : scopedFormulas)
|
||||
simplify(scopedFormula.formula);
|
||||
|
||||
ast::PrintContext printContext;
|
||||
|
||||
if (!context.complete)
|
||||
if (!context.performCompletion)
|
||||
{
|
||||
if (context.visiblePredicateSignatures)
|
||||
context.logger.log(output::Priority::Warning) << "#show statements are ignored because completion is not enabled";
|
||||
@ -81,7 +81,7 @@ void translate(const char *fileName, std::istream &stream, Context &context)
|
||||
auto completedFormulas = complete(std::move(scopedFormulas), context);
|
||||
|
||||
// TODO: rethink simplification steps
|
||||
if (context.simplify)
|
||||
if (context.performSimplification)
|
||||
for (auto &completedFormula : completedFormulas)
|
||||
simplify(completedFormula);
|
||||
|
||||
|
@ -16,8 +16,8 @@ TEST_CASE("[completion] Rules are completed", "[completion]")
|
||||
|
||||
anthem::output::Logger logger(output, errors);
|
||||
anthem::Context context(std::move(logger));
|
||||
context.simplify = true;
|
||||
context.complete = true;
|
||||
context.performSimplification = true;
|
||||
context.performCompletion = true;
|
||||
|
||||
SECTION("predicate in single rule head")
|
||||
{
|
||||
|
@ -16,8 +16,8 @@ TEST_CASE("[hidden predicate elimination] Hidden predicates are correctly elimin
|
||||
|
||||
anthem::output::Logger logger(output, errors);
|
||||
anthem::Context context(std::move(logger));
|
||||
context.simplify = true;
|
||||
context.complete = true;
|
||||
context.performSimplification = true;
|
||||
context.performCompletion = true;
|
||||
|
||||
SECTION("simple example (positive 0-ary predicate)")
|
||||
{
|
||||
|
@ -16,8 +16,8 @@ TEST_CASE("[simplification] Rules are simplified correctly", "[simplification]")
|
||||
|
||||
anthem::output::Logger logger(output, errors);
|
||||
anthem::Context context(std::move(logger));
|
||||
context.simplify = true;
|
||||
context.complete = false;
|
||||
context.performSimplification = true;
|
||||
context.performCompletion = false;
|
||||
|
||||
SECTION("example 1")
|
||||
{
|
||||
|
@ -16,8 +16,8 @@ TEST_CASE("[translation] Rules are translated correctly", "[translation]")
|
||||
|
||||
anthem::output::Logger logger(output, errors);
|
||||
anthem::Context context(std::move(logger));
|
||||
context.simplify = false;
|
||||
context.complete = false;
|
||||
context.performSimplification = false;
|
||||
context.performCompletion = false;
|
||||
|
||||
SECTION("simple example 1")
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user