From cc889a7f6692fa04d517b79ecfc516a6a10702e1 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Sun, 13 Feb 2011 22:35:11 +0100 Subject: [PATCH] Make it possible to format SERE. * src/ltlvisit/tostring.hh, src/ltlvisit/tostring.cc (to_string): Add third option to enable formating suitable for SERE. --- src/ltlvisit/tostring.cc | 15 +++++++++------ src/ltlvisit/tostring.hh | 17 ++++++++++------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/ltlvisit/tostring.cc b/src/ltlvisit/tostring.cc index 330a5d312..91a04e15a 100644 --- a/src/ltlvisit/tostring.cc +++ b/src/ltlvisit/tostring.cc @@ -61,9 +61,11 @@ namespace spot class to_string_visitor: public const_visitor { public: - to_string_visitor(std::ostream& os, bool full_parent = false) + to_string_visitor(std::ostream& os, + bool full_parent = false, + bool ratexp = false) : os_(os), top_level_(true), - full_parent_(full_parent), in_ratexp_(false) + full_parent_(full_parent), in_ratexp_(ratexp) { } @@ -552,18 +554,19 @@ namespace spot } // anonymous std::ostream& - to_string(const formula* f, std::ostream& os, bool full_parent) + to_string(const formula* f, std::ostream& os, bool full_parent, + bool ratexp) { - to_string_visitor v(os, full_parent); + to_string_visitor v(os, full_parent, ratexp); f->accept(v); return os; } std::string - to_string(const formula* f, bool full_parent) + to_string(const formula* f, bool full_parent, bool ratexp) { std::ostringstream os; - to_string(f, os, full_parent); + to_string(f, os, full_parent, ratexp); return os.str(); } diff --git a/src/ltlvisit/tostring.hh b/src/ltlvisit/tostring.hh index 62fda4f0a..65916b9fc 100644 --- a/src/ltlvisit/tostring.hh +++ b/src/ltlvisit/tostring.hh @@ -1,4 +1,4 @@ -// Copyright (C) 2010 Laboratoire de Recherche et Développement de +// Copyright (C) 2010, 2011 Laboratoire de Recherche et Développement de // l'Epita (LRDE). // Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6), // département Systèmes Répartis Coopératifs (SRC), Université Pierre @@ -39,30 +39,33 @@ namespace spot /// \param f The formula to translate. /// \param os The stream where it should be output. /// \param full_parent Whether or not the string should by fully - /// parenthesized. + /// parenthesized. + /// \param ratexp Whether we are printing a SERE. std::ostream& - to_string(const formula* f, std::ostream& os, bool full_parent = false); + to_string(const formula* f, std::ostream& os, bool full_parent = false, + bool ratexp = false); /// \brief Output a formula as a string which is parsable unless the formula /// contains automaton operators (used in ELTL formulae). /// \param f The formula to translate. /// \param full_parent Whether or not the string should by fully - /// parenthesized. + /// parenthesized. + /// \param ratexp Whether we are printing a SERE. std::string - to_string(const formula* f, bool full_parent = false); + to_string(const formula* f, bool full_parent = false, bool ratexp = false); /// \brief Output a formula as a (parsable by Spin) string. /// \param f The formula to translate. /// \param os The stream where it should be output. /// \param full_parent Whether or not the string should by fully - /// parenthesized. + /// parenthesized. std::ostream& to_spin_string(const formula* f, std::ostream& os, bool full_parent = false); /// \brief Convert a formula into a (parsable by Spin) string. /// \param f The formula to translate. /// \param full_parent Whether or not the string should by fully - /// parenthesized. + /// parenthesized. std::string to_spin_string(const formula* f, bool full_parent = false); /// @}