Commit 5a1e38d9 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

hoa: store the automaton name as a property

* src/hoaparse/hoaparse.yy: Store the automaton name.
* src/tgbaalgos/hoa.cc: Output it if it exists.
* src/tgbatest/hoaparse.test: Adjust tests.
parent f37ff840
...@@ -359,7 +359,9 @@ header-item: "States:" INT ...@@ -359,7 +359,9 @@ header-item: "States:" INT
} }
| "name:" STRING | "name:" STRING
{ {
delete $2; res.h->aut->set_named_prop("automaton-name", $2, [](void* name) {
delete static_cast<std::string*>(name);
});
} }
| "properties:" properties | "properties:" properties
| HEADERNAME header-spec | HEADERNAME header-spec
......
...@@ -250,7 +250,10 @@ namespace spot ...@@ -250,7 +250,10 @@ namespace spot
const char nl = newline ? '\n' : ' '; const char nl = newline ? '\n' : ' ';
os << "HOA: v1" << nl; os << "HOA: v1" << nl;
if (f) auto* n = aut->get_named_prop("automaton-name");
if (n)
escape_str(os << "name: \"", *static_cast<std::string*>(n)) << '"' << nl;
else if (f)
escape_str(os << "name: \"", to_string(f)) << '"' << nl; escape_str(os << "name: \"", to_string(f)) << '"' << nl;
os << "States: " << num_states << nl os << "States: " << num_states << nl
<< "Start: 0" << nl << "Start: 0" << nl
......
...@@ -384,6 +384,7 @@ EOF ...@@ -384,6 +384,7 @@ EOF
expectok input <<EOF expectok input <<EOF
HOA: v1 HOA: v1
name: "GFa & GF(b & c)"
States: 1 States: 1
Start: 0 Start: 0
AP: 3 "a" "b" "c" AP: 3 "a" "b" "c"
...@@ -431,6 +432,7 @@ AP: 1 "a" ...@@ -431,6 +432,7 @@ AP: 1 "a"
[!0--ABORT-- [!0--ABORT--
HOA: v1 HOA: v1
States: 2 States: 2
name: "survivor"
Start: 0 Start: 0
Acceptance: 2 (Inf(0) & Inf(!0)) & Inf(!1) Acceptance: 2 (Inf(0) & Inf(!0)) & Inf(!1)
AP: 1 "a" AP: 1 "a"
...@@ -460,6 +462,7 @@ diff stderr input.exp ...@@ -460,6 +462,7 @@ diff stderr input.exp
cat >expected <<EOF cat >expected <<EOF
HOA: v1 HOA: v1
name: "survivor"
States: 2 States: 2
Start: 0 Start: 0
AP: 1 "a" AP: 1 "a"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment