From: NeilBrown Date: Fri, 3 Oct 2014 03:22:29 +0000 (+1000) Subject: parsergen: fix handling of Newline in parse. X-Git-Tag: workingparser~14 X-Git-Url: https://ocean-lang.org/code/?p=ocean;a=commitdiff_plain;h=b3ff3da5b9a5b75a00f608233ddc917f138c052c parsergen: fix handling of Newline in parse. The required handling for 'newline' when not ignored is: if the current state can REDUCE and the reduction length is no more symbols than the frames-since-start-of-line count, we REDUCE. 'can REDUCE' removes "reduce_size >= 0", not ">". 'not more symbols' means "reduce_size <= tos->since_newline", not "<". Signed-off-by: NeilBrown --- diff --git a/csrc/parsergen.mdc b/csrc/parsergen.mdc index d6feb8a..f87d83f 100644 --- a/csrc/parsergen.mdc +++ b/csrc/parsergen.mdc @@ -2712,8 +2712,8 @@ since the last state which could have been at the start of a line. parser_trace_action(trace, "Discard"); continue; } - if (states[tos->state].reduce_size > 0 && - states[tos->state].reduce_size < tos->since_newline) + if (states[tos->state].reduce_size >= 0 && + states[tos->state].reduce_size <= tos->since_newline) goto force_reduce; } if (shift(&p, &next, tk, states)) {