to_string: abbreviate [->i..j] and [=i..j] expressed using [*i..j]

* src/ltlast/bunop.hh (is_bunop, is_Star): New functions.
* src/ltlast/multop.hh (is_And, is_Or): Fix constness.
(is_Concat, is_Fusion): New functions.
* src/ltlast/unop.hh (is_unop, is_X, is_F, is_G, is_GF, is_FG):
Fix constness.
(is_Not): New function.
* src/ltlvisit/tostring.cc (strip_star_not, match_goto,
emit_bunop_child, resugar_concat): New methods.
(visit(bunop)): Rewrite without calling format().  Detect the
[->i..j] pattern.
(visit(multop)): Call resugar_concat to detect [=i..j] patterns.
This commit is contained in:
Alexandre Duret-Lutz 2012-04-13 23:01:28 +02:00
parent e109f21ce4
commit 39417037d7
4 changed files with 287 additions and 35 deletions

View file

@ -216,7 +216,7 @@ namespace spot
/// Return 0 otherwise.
inline
multop*
is_And(formula* f)
is_And(const formula* f)
{
return is_multop(f, multop::And);
}
@ -226,10 +226,30 @@ namespace spot
/// Return 0 otherwise.
inline
multop*
is_Or(formula* f)
is_Or(const formula* f)
{
return is_multop(f, multop::Or);
}
/// \brief Cast \a f into a multop if it is a Concat.
///
/// Return 0 otherwise.
inline
multop*
is_Concat(const formula* f)
{
return is_multop(f, multop::Concat);
}
/// \brief Cast \a f into a multop if it is a Fusion.
///
/// Return 0 otherwise.
inline
multop*
is_Fusion(const formula* f)
{
return is_multop(f, multop::Fusion);
}
}
}