]> ocean-lang.org Git - ocean/blobdiff - csrc/parsergen.mdc
parsergen: avoid creating extra line in code blocks.
[ocean] / csrc / parsergen.mdc
index e6dcccbf34bc46f4bcca75dca9cb0d7f325d4d55..02abed32520c18dcaa1d677b81529f25ec040e03 100644 (file)
@@ -2284,17 +2284,17 @@ transformed, and will cause an error when the code is compiled.
                        }
                        c -= 1;
                }
-               fputs("\n", f);
                for (i = 0; i < p->body_size; i++) {
                        if (p->body[i]->struct_name.txt &&
                            used[i]) {
                                // assume this has been copied out
                                if (p->body[i]->isref)
-                                       fprintf(f, "\t\t*(void**)body[%d] = NULL;\n", i);
+                                       fprintf(f, "\t\t*(void**)body[%d] = NULL;", i);
                                else
-                                       fprintf(f, "\t\tmemset(body[%d], 0, sizeof(struct %.*s));\n", i, p->body[i]->struct_name.len, p->body[i]->struct_name.txt);
+                                       fprintf(f, "\t\tmemset(body[%d], 0, sizeof(struct %.*s));", i, p->body[i]->struct_name.len, p->body[i]->struct_name.txt);
                        }
                }
+               fputs("\n", f);
                free(used);
        }
 
@@ -2320,6 +2320,7 @@ transformed, and will cause an error when the code is compiled.
                        if (p->code.txt) {
                                fprintf(f, "#line %d \"%s\"\n", p->code_line, file);
                                gen_code(p, f, g);
+                               fprintf(f, "#line 7 \"gen_reduce\"\n");
                        }
 
                        if (p->head->struct_name.txt)