Commit 953181bb authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz

parseaut: store names from states in the dstar format

* src/parseaut/parseaut.yy: Keep track of named states.
* src/tests/parseaut.test: Test it.
parent a26dd5af
......@@ -1185,9 +1185,7 @@ dstar_sizes:
}
| dstar_sizes aps
opt_name: | STRING { delete $1; }
dstar_state_id: "State:" INT opt_name
dstar_state_id: "State:" INT string_opt
{
if (res.cur_guard != res.guards.end())
error(@1, "not enough transitions for previous state");
......@@ -1205,10 +1203,26 @@ dstar_state_id: "State:" INT opt_name
}
error(@2, o.str());
}
else
{
res.info_states[$2].declared = true;
if ($3)
{
if (!res.state_names)
res.state_names =
new std::vector<std::string>(res.states > 0 ?
res.states : 0);
if (res.state_names->size() < $2 + 1)
res.state_names->resize($2 + 1);
(*res.state_names)[$2] = std::move(*$3);
delete $3;
}
}
res.cur_guard = res.guards.begin();
res.dest_map.clear();
res.cur_state = $2;
res.info_states[$2].declared = true;
}
sign: '+' { $$ = res.plus; }
......
......@@ -1040,13 +1040,13 @@ Acc-Sig:
0
2
2
State: 1
State: 1 "some name"
Acc-Sig: -0
1
1
1
1
State: 2
State: 2 "another name"
Acc-Sig: +0
2
2
......@@ -1080,9 +1080,9 @@ State: 0
[0&!1] 0
[!0&!1] 1
[1] 2
State: 1
State: 1 "some name"
[t] 1
State: 2
State: 2 "another name"
[t] 2
--END--
HOA: v1
......
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