]> ocean-lang.org Git - ocean/commitdiff
parsergen: next.indents in parser_run is always zero.
authorNeilBrown <neil@brown.name>
Fri, 3 Oct 2014 03:26:00 +0000 (13:26 +1000)
committerNeilBrown <neil@brown.name>
Fri, 3 Oct 2014 03:26:00 +0000 (13:26 +1000)
now that indents are counted with the previous symbol,
next.indents is always zero.  So stop using it or updating it.

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

index d97f98c7b3ff724f2b81488d5a6ffbd6410ef390..13d0ef654251d27220a46b69224ea99814325c7e 100644 (file)
@@ -2664,7 +2664,7 @@ since the last state which could have been at the start of a line.
                        if (!tk)
                                tk = tok_copy(token_next(tokens));
                        next.sym = tk->num;
-                       parser_trace(trace, &p, next.indents, !next.since_newline,
+                       parser_trace(trace, &p, !next.since_newline,
                                     tk, states, non_term, config->known_count);
 
                        if (next.sym == TK_in) {
@@ -2727,7 +2727,6 @@ since the last state which could have been at the start of a line.
                        }
                        if (shift(&p, tk->num, 0, tk->num == TK_newline, tk, states)) {
                                next.since_newline = !(tk->num == TK_newline);
-                               next.indents = 0;
                                tk = NULL;
                                parser_trace_action(trace, "Shift");
                                continue;
@@ -2751,9 +2750,8 @@ since the last state which could have been at the start of a line.
                                        indents = pop(&p, size, &start_of_line,
                                                      do_free);
                                else {
-                                       indents = next.indents;
+                                       indents = 0;
                                        start_of_line = 0;
-                                       next.indents = 0;
                                }
                                res = memdup(buf, bufsize);
                                memset(buf, 0, bufsize);
@@ -2789,7 +2787,7 @@ since the last state which could have been at the start of a line.
 
                        err_tk = tok_copy(*tk);
                        next.sym = TK_error;
-                       while (shift(&p, TK_error, next.indents, !next.since_newline,
+                       while (shift(&p, TK_error, 0, !next.since_newline,
                                     err_tk, states) == 0
                               && p.tos > 0)
                                // discard this state
@@ -2870,7 +2868,7 @@ end inside square brackets.
                fprintf(trace, ") ");
        }
 
-       void parser_trace(FILE *trace, struct parser *p, int indents, int start_of_line,
+       void parser_trace(FILE *trace, struct parser *p, int start_of_line,
                          struct token *tk, const struct state states[],
                          const char *non_term[], int knowns)
        {
@@ -2904,8 +2902,6 @@ end inside square brackets.
                        fputs(reserved_words[tk->num], trace);
                else
                        text_dump(trace, tk->txt, 20);
-               if (indents)
-                       fprintf(trace, ".%d", indents);
                if (start_of_line)
                        fputs("/", trace);
                fputs("]", trace);