]> ocean-lang.org Git - ocean/commitdiff
parsegen: pop was not computing start_of_line properly.
authorNeilBrown <neil@brown.name>
Fri, 3 Oct 2014 03:27:40 +0000 (13:27 +1000)
committerNeilBrown <neil@brown.name>
Fri, 3 Oct 2014 03:27:40 +0000 (13:27 +1000)
In there is any line start in the sequence being popped,
then the new symbol is considered to start a line.

Signed-off-by: NeilBrown <neil@brown.name>
csrc/parsergen.mdc

index 136cdf62c923d0ddcf7b305e96757c939983fcb2..720f95f3a374e2a90cedf51360756f9b5789e895 100644 (file)
@@ -2570,17 +2570,18 @@ removed. It is called _after_ we reduce a production, just before we
                       void(*do_free)(short sym, void *asn))
        {
                int i;
-               short indents;
+               short indents = 0;
+               int sol = 0;
+
                p->tos -= num;
-               if (start_of_line)
-                       *start_of_line =
-                               !p->stack[p->tos].since_newline;
-               indents = 0;
                for (i = 0; i < num; i++) {
+                       sol |= !p->stack[p->tos+1].since_newline;
                        indents += p->stack[p->tos+i].indents;
                        do_free(p->stack[p->tos+i].sym,
                                p->asn_stack[p->tos+i]);
                }
+               if (start_of_line)
+                       *start_of_line = sol;
                return indents;
        }