Commit 3efeacb6 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

acc: preserve input order in parse_acc_code()

* src/twa/acc.cc: Here.
* src/tests/acc.test: Adjust.
parent b4881579
......@@ -78,10 +78,10 @@ t
f
Fin(2)
Inf(2)
Inf(2) | Fin(2)
Fin(2) | Inf(2)
Fin(2) & Inf(2)
Fin(3) | (Fin(2) & Inf(1)) | Fin(0)
Fin(3) | (Fin(2) & Inf(1)) | Fin(0)
Fin(0) | (Fin(2) & Inf(1)) | Fin(3)
Fin(0) | (Fin(2) & Inf(1)) | Fin(3)
EOF
run 0 ../acc | tee stdout
......
......@@ -991,15 +991,18 @@ namespace spot
static acc_cond::acc_code parse_acc(const char*& input)
{
auto t = parse_term(input);
auto res = parse_term(input);
skip_space(input);
while (*input == '|')
{
++input;
skip_space(input);
t.append_or(parse_term(input));
// Prepend instead of append, to preserve the input order.
auto tmp = parse_term(input);
std::swap(tmp, res);
res.append_or(std::move(tmp));
}
return t;
return res;
}
static unsigned parse_num(const char*& input)
......@@ -1067,7 +1070,10 @@ namespace spot
{
++input;
skip_space(input);
res.append_and(parse_term(input));
// Prepend instead of append, to preserve the input order.
auto tmp = parse_term(input);
std::swap(tmp, res);
res.append_and(std::move(tmp));
}
return res;
}
......
Supports Markdown
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