python: improve handling of formulas

* src/misc/escape.hh, src/misc/escape.cc (escape_latex): New function.
* src/ltlvisit/tostring.cc: Escape atomic proposition in LaTeX output.
* wrap/python/spot.py: Make it easy to output formulas in different
syntaxes.  Also allow the AST to be shown.
* wrap/python/spot_impl.i: Catch std::runtime_error.
* wrap/python/tests/formulas.ipynb: New file.
* wrap/python/tests/Makefile.am: Add it.
This commit is contained in:
Alexandre Duret-Lutz 2015-03-11 19:41:24 +01:00
parent a6dbf5cf5e
commit 2362b9ab68
7 changed files with 667 additions and 35 deletions

View file

@ -190,9 +190,11 @@ using namespace spot;
}
catch (const std::invalid_argument& e)
{
std::string er("\n");
er += e.what();
SWIG_exception(SWIG_ValueError, er.c_str());
SWIG_exception(SWIG_ValueError, e.what());
}
catch (const std::runtime_error& e)
{
SWIG_exception(SWIG_RuntimeError, e.what());
}
}