]> ocean-lang.org Git - ocean/commitdiff
parsergen: fix handling of Newline in parse.
authorNeilBrown <neil@brown.name>
Fri, 3 Oct 2014 03:22:29 +0000 (13:22 +1000)
committerNeilBrown <neil@brown.name>
Fri, 3 Oct 2014 03:23:52 +0000 (13:23 +1000)
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 <neil@brown.name>
csrc/parsergen.mdc

index d6feb8a3d0ac51c7bb0e0713765bd68288f4d55f..f87d83f7acab966c57d2291191482edf7b25a1f5 100644 (file)
@@ -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)) {