extend HOA I/O to preserve the state-player property

* spot/parseaut/parseaut.yy, spot/parseaut/scanaut.ll,
spot/twaalgos/hoa.cc: Add input and output support.
* doc/org/hoa.org: Document the HOA extension.
* bin/ltlsynt.cc: Add a --print-game-hoa option to
produce such format.
* tests/core/gamehoa.test: New file to test this.
* tests/Makefile.am: Add it.
* NEWS: Mention this new feature.
This commit is contained in:
Alexandre Duret-Lutz 2020-09-08 16:25:36 +02:00
parent 25c75c55b1
commit ea9384dd4b
8 changed files with 209 additions and 5 deletions

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2014-2019 Laboratoire de Recherche et
// Copyright (C) 2014-2020 Laboratoire de Recherche et
// Developpement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -609,6 +609,24 @@ namespace spot
os << (v1_1 ? "spot." : "spot-") << "rejected-word: \"";
escape_str(os, *word) << '"' << nl;
}
if (auto player = aut->get_named_prop<std::vector<bool>>("state-player"))
{
os << (v1_1 ? "spot." : "spot-") << "state-player:";
if (player->size() != num_states)
throw std::runtime_error("print_hoa(): state-player property has"
" (" + std::to_string(player->size()) +
" states but automaton has " +
std::to_string(num_states));
unsigned n = 0;
while (n < num_states)
{
os << ' ' << (*player)[n];
++n;
if (newline && n < num_states && (n % 30 == 0))
os << "\n ";
}
os << nl;
}
// If we want to output implicit labels, we have to
// fill a vector with all destinations in order.