From: NeilBrown Date: Sun, 21 Jul 2013 08:00:13 +0000 (+1000) Subject: parsergen: fix bug testing return value for shift() X-Git-Tag: draftparser~5 X-Git-Url: https://ocean-lang.org/code/?p=ocean;a=commitdiff_plain;h=2db88bf6ed733e1d4da5e48622cfea511e327c87 parsergen: fix bug testing return value for shift() shift() returns 0 on failure, not negative. Signed-off-by: NeilBrown --- diff --git a/csrc/parsergen.mdc b/csrc/parsergen.mdc index 5d5ea1e..2c2e2a6 100644 --- a/csrc/parsergen.mdc +++ b/csrc/parsergen.mdc @@ -2408,7 +2408,7 @@ We return whatever `asn` was returned by reducing production zero. * Then we discard input tokens until * we find one that is acceptable. */ - while (shift(&p, TK_error, tk, states) < 0 + while (shift(&p, TK_error, tk, states) == 0 && p.tos > 0) // discard this state pop(&p, 1, do_free);