* src/ltlparse/ltlparse.yy: Fix precedence OP_OR < OP_XOR < OP_AND.
* src/ltlast/binop.cc (binop::instance): Order operands for associative operators, so that e.g. "a xor b" and "b xor a" are mapped to the same formula. * src/ltltest/equals.test: Check this.
This commit is contained in:
parent
65b6a4d8da
commit
0d32884d20
4 changed files with 31 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#include <cassert>
|
||||
#include <utility>
|
||||
#include "binop.hh"
|
||||
#include "visitor.hh"
|
||||
|
||||
|
|
@ -89,6 +90,23 @@ namespace spot
|
|||
binop*
|
||||
binop::instance(type op, formula* first, formula* second)
|
||||
{
|
||||
// Sort the operands of associative operators, so that for
|
||||
// example the formula instance for 'a xor b' is the same as
|
||||
// that for 'b xor a'.
|
||||
switch (op)
|
||||
{
|
||||
case Xor:
|
||||
case Equiv:
|
||||
if (second < first)
|
||||
std::swap(first, second);
|
||||
break;
|
||||
case Implies:
|
||||
case U:
|
||||
case R:
|
||||
// Non associative operators.
|
||||
break;
|
||||
}
|
||||
|
||||
pairf pf(first, second);
|
||||
pair p(op, pf);
|
||||
map::iterator i = instances.find(p);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue