parseaut: store names from states in the dstar format
* src/parseaut/parseaut.yy: Keep track of named states. * src/tests/parseaut.test: Test it.
This commit is contained in:
parent
a26dd5af1d
commit
953181bbb7
2 changed files with 22 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue