X-Git-Url: https://ocean-lang.org/code/?p=ocean;a=blobdiff_plain;f=csrc%2Foceani.mdc;h=af24d9becd86326c48633e66cd0718a5510479da;hp=c820d39153674dcc75fcb2fa5022e60c2624ffce;hb=d7e32bb049504f5e931f09ac041470f496c58b2c;hpb=c9827dcb3cb79fe907633b8badd1e5fd918ca388 diff --git a/csrc/oceani.mdc b/csrc/oceani.mdc index c820d39..af24d9b 100644 --- a/csrc/oceani.mdc +++ b/csrc/oceani.mdc @@ -242,18 +242,19 @@ structures can be used. fprintf(stderr, "oceani: no main function found.\n"); context.parse_error = 1; } + if (context.prog && !context.parse_error) { + if (!analyse_prog(context.prog, &context)) { + fprintf(stderr, "oceani: type error in program - not running.\n"); + context.parse_error = 1; + } + } if (context.prog && doprint) { ## print const decls ## print type decls print_exec(context.prog, 0, brackets); } - if (context.prog && doexec && !context.parse_error) { - if (!analyse_prog(context.prog, &context)) { - fprintf(stderr, "oceani: type error in program - not running.\n"); - exit(1); - } + if (context.prog && doexec && !context.parse_error) interp_prog(&context, context.prog, argc - optind, argv+optind); - } free_exec(context.prog); while (s) { @@ -3582,19 +3583,17 @@ it is declared, and error will be raised as the name is created as do_indent(indent, ""); print_exec(b->left, indent, bracket); if (cast(var, b->left)->var->constant) { + printf("::"); if (v->where_decl == v->where_set) { - printf("::"); type_print(v->type, stdout); printf(" "); - } else - printf(" ::"); + } } else { + printf(":"); if (v->where_decl == v->where_set) { - printf(":"); type_print(v->type, stdout); printf(" "); - } else - printf(" :"); + } } if (b->right) { printf("= ");