Make sure the neverclaim parser works on the output of spin and

ltl2ba.

* src/neverparse/neverclaimparse.yy: Accept multiple labels
for the same state.  Honor accepting states.  Forward parse
error from the parser used for guards.  Accept "false" as a
single instruction for a state.
* src/neverparse/neverclaimscan.ll: Recognize "false" specifically,
and remove the ";" hack.
* src/tgba/tgbaexplicit.cc
(tgba_explicit_string::~tgba_explicit_string): Adjust not to
destroy a state twice.
* src/tgba/tgbaexplicit.hh
(tgba_explicit_string::add_state_alias): New function.
* src/tgbatest/defs.in (SPIN, LTL2BA): New variables.
* src/tgbatest/neverclaimread.test: Check error messages for
syntax errors in guards.  Make sure we can read the output
of `spin -f' and `ltl2ba -f' on a few test formulae.
This commit is contained in:
Alexandre Duret-Lutz 2010-11-06 13:39:26 +01:00
parent ac08c5abce
commit fe1f59cd30
7 changed files with 173 additions and 43 deletions

View file

@ -1,4 +1,4 @@
// Copyright (C) 2009 Laboratoire de Recherche et Développement
// Copyright (C) 2009, 2010 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
@ -291,10 +291,14 @@ namespace spot
ns_map::iterator i;
for (i = name_state_map_.begin(); i != name_state_map_.end(); ++i)
{
tgba_explicit::state::iterator i2;
for (i2 = i->second->begin(); i2 != i->second->end(); ++i2)
delete *i2;
delete i->second;
// Do not erase the same state twice. (Because of possible aliases.)
if (state_name_map_.erase(i->second))
{
tgba_explicit::state::iterator i2;
for (i2 = i->second->begin(); i2 != i->second->end(); ++i2)
delete *i2;
delete i->second;
}
}
}

View file

@ -1,4 +1,4 @@
// Copyright (C) 2009 Laboratoire de Recherche et Développement
// Copyright (C) 2009, 2010 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2006 Laboratoire d'Informatique de
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
@ -212,7 +212,7 @@ namespace spot
}
return i->second;
}
state*
set_init_state(const label& state)
{
@ -323,6 +323,15 @@ namespace spot
virtual ~tgba_explicit_string();
virtual state* add_default_init();
virtual std::string format_state(const spot::state* s) const;
/// Create an alias for a state. Any reference to \a alias_name
/// will act as a reference to \a real_name.
virtual
void add_state_alias(const std::string& alias_name,
const std::string& real_name)
{
name_state_map_[alias_name] = add_state(real_name);
}
};
class tgba_explicit_formula: