]> ocean-lang.org Git - ocean/blobdiff - csrc/parsergen.mdc
parsergen: make sure result in start symbol is returned.
[ocean] / csrc / parsergen.mdc
index 8e088b5b70c5150671f0afbbf84933739c073ef6..f8d8a39c47a8861a079135d6d3753b10b4ddc482 100644 (file)
@@ -540,8 +540,13 @@ where `START` is the first non-terminal given.
        struct production *p = calloc(1,sizeof(*p));
        struct text start = {"$start",6};
        struct text eof = {"$eof",4};
+       struct text code = {"$0 = $<1;", 9};
        p->head = sym_find(g, start);
        p->head->type = Nonterminal;
+       p->head->struct_name = g->current_type;
+       p->head->isref = g->type_isref;
+       if (g->current_type.txt)
+               p->code = code;
        array_add(&p->body, &p->body_size, head);
        array_add(&p->body, &p->body_size, sym_find(g, eof));
        p->head->first_production = g->production_count;