prepare_types(&context);
if (!context.parse_error && !analyse_funcs(&context)) {
fprintf(stderr, "oceani: type error in program - not running.\n");
- context.parse_error = 1;
+ context.parse_error += 1;
}
if (doprint) {
}
}
fputs("\n", stderr);
- c->parse_error = 1;
+ c->parse_error += 1;
}
static void tok_err(struct parse_context *c, char *fmt, struct token *t)
{
fprintf(stderr, "%s:%d:%d: %s: %.*s\n", c->file_name, t->line, t->col, fmt,
t->txt.len, t->txt.txt);
- c->parse_error = 1;
+ c->parse_error += 1;
}
## Entities: declared and predeclared.
static struct type *propagate_types(struct exec *prog, struct parse_context *c, enum prop_err *perr,
struct type *type, int rules)
{
+ int pre_err = c->parse_error;
struct type *ret = __propagate_types(prog, c, perr, type, rules);
- if (c->parse_error)
+ if (c->parse_error > pre_err)
*perr |= Efail;
return ret;
}
propagate_types(f->init, c, &perr, f->f.type, 0);
} while (perr & Eretry);
if (perr & Efail)
- c->parse_error = 1; // NOTEST
+ c->parse_error += 1; // NOTEST
}
t->structure.nfields = cnt;
v->var->type, 0);
} while (perr & Eretry);
if (perr & Efail)
- c->parse_error = 1;
+ c->parse_error += 1;
else {
struct value res = interp_exec(
c, vb->right, &v->var->type);
propagate_types(b->left, c, &perr, Tnone, 0); // NOTEST
}
if (perr & Efail)
- c->parse_error = 1;
+ c->parse_error += 1;
}
return !c->parse_error;
progp = var_value(c, mainv);
if (!progp || !progp->function) {
fprintf(stderr, "oceani: no main function found.\n");
- c->parse_error = 1;
+ c->parse_error += 1;
return;
}
if (!analyse_main(mainv->type, c)) {
fprintf(stderr, "oceani: main has wrong type.\n");
- c->parse_error = 1;
+ c->parse_error += 1;
return;
}
al = mainv->type->function.params;