Add support the bounded star operator [*i..j].

* src/ltlast/bunop.hh, src/ltlast/bunop.cc: New files for
bounded unary operators.
* src/ltlast/Makefile.am, src/ltlast/allnodes.hh: Add them.
* src/ltlast/predecl.hh (bunop): Declare.
* src/ltlast/unop.hh, src/ltlast/unop.cc (Star): Remove
declaration of Star and associated code.
* src/ltlast/visitor.hh: Add visit(bunop* node) methods.
* src/ltlparse/ltlparse.yy, src/ltlparse/ltlscan.ll: Add parse
rules for LTL.  This required passing the parse_error list
to the lexer, so it can report scanning errors when it reads
a number that does not fit in an unsigned int.
* src/ltlparse/parsedecl.hh (YY_DECL): Take error_list
as third argument.
* src/ltltest/consterm.test, src/ltltest/tostring.test,
src/ltltest/equals.test, src/tgbatest/ltl2tgba.test: More tests.
* src/ltlvisit/basicreduce.cc, src/ltlvisit/clone.cc,
src/ltlvisit/clone.hh, src/ltlvisit/consterm.cc,
src/ltlvisit/dotty.cc, src/ltlvisit/mark.cc,
src/ltlvisit/nenoform.cc, src/ltlvisit/postfix.cc,
src/ltlvisit/postfix.hh, src/ltlvisit/reduce.cc,
src/ltlvisit/syntimpl.cc, src/ltlvisit/tostring.cc,
src/ltlvisit/tunabbrev.cc, src/tgba/formula2bdd.cc,
src/tgbaalgos/eltl2tgba_lacim.cc, src/tgbaalgos/ltl2taa.cc,
src/tgbaalgos/ltl2tgba_lacim.cc: Adjust syntax to use
"bunop::Star" instead of "unop::Star".
* src/tgbaalgos/ltl2tgba_fm.cc: Likewise, but also adjust
the code to handle the bounds of the operator.
This commit is contained in:
Alexandre Duret-Lutz 2010-05-12 19:09:20 +02:00
parent 47b2bea865
commit 126b724a98
33 changed files with 678 additions and 115 deletions

View file

@ -179,6 +179,31 @@ namespace spot
closep();
}
void
visit(const bunop* bo)
{
// Abbreviate "1*" as "*".
if (bo->child() != constant::true_instance())
{
// a* is OK, no need to print {a}*.
// However want braces for {!a}*, the only unary
// operator that can be nested with *.
bool need_parent = !!dynamic_cast<const unop*>(bo->child());
if (need_parent || full_parent_)
openp();
bo->child()->accept(*this);
if (need_parent || full_parent_)
closep();
}
// Output "*" instead of "[*]".
if (bo->min() == 0 && bo->max() == bunop::unbounded)
os_ << "*";
else
os_ << bo->format();
}
void
visit(const unop* uo)
{
@ -225,19 +250,6 @@ namespace spot
in_ratexp_ = true;
top_level_ = true;
break;
case unop::Star:
// Abbreviate "1*" as "*".
if (uo->child() == constant::true_instance())
{
os_ << "*";
return;
}
// 1* is OK, no need to print {1}*.
// However want braces for {!a}*, the only unary
// operator that can be nested with *.
need_parent = !!dynamic_cast<const unop*>(uo->child());
// Do not output anything yet, star is a postfix operator.
break;
}
top_level_ = false;
@ -249,9 +261,6 @@ namespace spot
switch (uo->op())
{
case unop::Star:
os_ << "*";
break;
case unop::Closure:
case unop::NegClosure:
os_ << "}";
@ -476,19 +485,6 @@ namespace spot
top_level_ = true;
in_ratexp_ = true;
break;
case unop::Star:
// Abbreviate "1*" as "*".
if (uo->child() == constant::true_instance())
{
os_ << "*";
return;
}
// 1* is OK, no need to print {1}*.
// However want braces for {!a}*, the only unary
// operator that can be nested with *.
need_parent = !!dynamic_cast<const unop*>(uo->child());
// Do not output anything yet, star is a postfix operator.
break;
}
if (need_parent)
@ -499,9 +495,6 @@ namespace spot
switch (uo->op())
{
case unop::Star:
os_ << "*";
break;
case unop::Closure:
case unop::NegClosure:
os_ << "}";