Added note suggesting using the compatibility mode if errors occur.

This commit is contained in:
Patrick Lühne 2017-06-21 03:07:09 +02:00
parent 002f875c53
commit 17985e3b5a
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF

View File

@ -5,6 +5,7 @@
#include <boost/program_options.hpp>
#include <pddlparse/AST.h>
#include <pddlparse/Exception.h>
#include <pddlparse/Mode.h>
#include <pddlparse/Parse.h>
@ -96,6 +97,13 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
const auto printCompatibilityInfo =
[&]()
{
if (parsingMode != pddl::Mode::Compatibility)
logger.log(plasp::output::Priority::Info, "try using --parsing-mode=compatibility for extended legacy feature support");
};
const auto colorPolicy = variablesMap["color"].as<std::string>();
if (colorPolicy == "auto")
@ -190,6 +198,20 @@ int main(int argc, char **argv)
catch (const tokenize::TokenizerException &e)
{
logger.log(plasp::output::Priority::Error, e.location(), e.message().c_str());
printCompatibilityInfo();
return EXIT_FAILURE;
}
catch (const pddl::ParserException &e)
{
if (e.location())
logger.log(plasp::output::Priority::Error, e.location().value(), e.message().c_str());
else
logger.log(plasp::output::Priority::Error, e.message().c_str());
printCompatibilityInfo();
return EXIT_FAILURE;
}
catch (const plasp::output::TranslatorException &e)