acc: preserve input order in parse_acc_code()
* src/twa/acc.cc: Here. * src/tests/acc.test: Adjust.
This commit is contained in:
parent
b488157957
commit
3efeacb61b
2 changed files with 13 additions and 7 deletions
|
|
@ -78,10 +78,10 @@ t
|
||||||
f
|
f
|
||||||
Fin(2)
|
Fin(2)
|
||||||
Inf(2)
|
Inf(2)
|
||||||
Inf(2) | Fin(2)
|
Fin(2) | Inf(2)
|
||||||
Fin(2) & Inf(2)
|
Fin(2) & Inf(2)
|
||||||
Fin(3) | (Fin(2) & Inf(1)) | Fin(0)
|
Fin(0) | (Fin(2) & Inf(1)) | Fin(3)
|
||||||
Fin(3) | (Fin(2) & Inf(1)) | Fin(0)
|
Fin(0) | (Fin(2) & Inf(1)) | Fin(3)
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
run 0 ../acc | tee stdout
|
run 0 ../acc | tee stdout
|
||||||
|
|
|
||||||
|
|
@ -991,15 +991,18 @@ namespace spot
|
||||||
|
|
||||||
static acc_cond::acc_code parse_acc(const char*& input)
|
static acc_cond::acc_code parse_acc(const char*& input)
|
||||||
{
|
{
|
||||||
auto t = parse_term(input);
|
auto res = parse_term(input);
|
||||||
skip_space(input);
|
skip_space(input);
|
||||||
while (*input == '|')
|
while (*input == '|')
|
||||||
{
|
{
|
||||||
++input;
|
++input;
|
||||||
skip_space(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)
|
static unsigned parse_num(const char*& input)
|
||||||
|
|
@ -1067,7 +1070,10 @@ namespace spot
|
||||||
{
|
{
|
||||||
++input;
|
++input;
|
||||||
skip_space(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;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue