shift() behaved a little differently when p.tos == 0,
and if the stack is completely empty, there is little
point trying to shift TK_error as there is no state
to work with.
So rearrange the loop slightly.
Signed-off-by: NeilBrown <neil@brown.name>
short indents = 0, start_of_line;
err_tk = tok_copy(*tk);
- while (shift(&p, TK_error, 0, 0,
- err_tk, states) == 0
- && p.tos > 0)
+ while (p.tos > 0 &&
+ shift(&p, TK_error, 0, 0,
+ err_tk, states) == 0)
// discard this state
indents += pop(&p, 1, &start_of_line, do_free);
if (p.tos == 0) {