* src/misc/bareword.hh, src/misc/bareword.cc (quote_unless_bare_word):

New function.
This commit is contained in:
Alexandre Duret-Lutz 2004-10-22 16:06:55 +00:00
parent 38f7cac8dd
commit d9b29a0590
3 changed files with 18 additions and 0 deletions

View file

@ -1,5 +1,8 @@
2004-10-22 Alexandre Duret-Lutz <adl@src.lip6.fr>
* src/misc/bareword.hh, src/misc/bareword.cc (quote_unless_bare_word):
New function.
* src/ltlvisit/tostring.cc (to_spin_string_visitor): Move to
anonymous namespace.

View file

@ -21,6 +21,7 @@
#include "bareword.hh"
#include <ctype.h>
#include "escape.hh"
namespace spot
{
@ -37,4 +38,14 @@ namespace spot
return false;
return true;
}
std::string
quote_unless_bare_word(const std::string& str)
{
if (is_bare_word(str.c_str()))
return str;
else
return "\"" + escape_str(str) + "\"";
}
}

View file

@ -19,7 +19,11 @@
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
#include <string>
namespace spot
{
bool is_bare_word(const char* str);
std::string quote_unless_bare_word(const std::string& str);
}