From: NeilBrown Date: Thu, 2 Oct 2014 10:59:55 +0000 (+1000) Subject: parsergen: remove starts_indented. X-Git-Tag: workingparser~16 X-Git-Url: https://ocean-lang.org/code/?p=ocean;a=commitdiff_plain;h=d61f36558ab8cd08efa2e605081fd57eccf83c51 parsergen: remove starts_indented. This is no longer used. Signed-off-by: NeilBrown --- diff --git a/csrc/parsergen.mdc b/csrc/parsergen.mdc index 082cf11..f99d318 100644 --- a/csrc/parsergen.mdc +++ b/csrc/parsergen.mdc @@ -2437,9 +2437,8 @@ The `state` is the most important one and guides the parsing process. The freeing function. The symbol leads us to the right free function through `do_free`. -The `indents` count and the `starts_indented` flag track the line -indents in the symbol. These are used to allow indent information to -guide parsing and error recovery. +The `indents` count tracks the line indents in the symbol. These are +used to allow indent information to guide parsing and error recovery. `since_newline` tracks how many stack frames since the last start-of-line (whether indented or not). So if `since_newline` is @@ -2462,7 +2461,6 @@ before the beginning. short newline_permitted; short sym; - short starts_indented; short indents; short since_newline; short since_indent; @@ -2568,8 +2566,6 @@ removed. It is called _after_ we reduce a production, just before we { int i; p->tos -= num; - next->starts_indented = - p->stack[p->tos].starts_indented; next->since_newline = p->stack[p->tos].since_newline; next->indents = 0; @@ -2663,7 +2659,6 @@ since the last state which could have been at the start of a line. parser_trace(trace, &p, &next, tk, states, non_term, config->known_count); if (next.sym == TK_in) { - next.starts_indented = 1; next.indents = 1; next.since_newline = 0; free(tk); @@ -2720,7 +2715,6 @@ since the last state which could have been at the start of a line. } if (shift(&p, &next, tk, states)) { next.since_newline = !(tk->num == TK_newline); - next.starts_indented = 0; next.indents = 0; tk = NULL; parser_trace_action(trace, "Shift"); @@ -2746,10 +2740,8 @@ since the last state which could have been at the start of a line. pop(&p, size, &frame, do_free); else { frame.indents = next.indents; - frame.starts_indented = frame.indents; frame.since_newline = 1; next.indents = 0; - next.starts_indented = 0; } res = memdup(buf, bufsize); memset(buf, 0, bufsize); @@ -2883,8 +2875,7 @@ end inside square brackets. fputs(non_term[sym - TK_reserved - knowns], trace); if (f->indents) - fprintf(trace, "%c%d", f->starts_indented?':':'.', - f->indents); + fprintf(trace, ".%d", f->indents); if (f->since_newline == 0) fputs("/", trace); fputs(" ", trace); @@ -2898,8 +2889,7 @@ end inside square brackets. else text_dump(trace, tk->txt, 20); if (n->indents) - fprintf(trace, "%c%d", n->starts_indented?':':'.', - n->indents); + fprintf(trace, ".%d", n->indents); if (n->since_newline == 0) fputs("/", trace); fputs("]", trace);