From bc8b406043b23a5825320248cbad3ff73cd124fe Mon Sep 17 00:00:00 2001 From: Andrew Chambers Date: Thu, 14 Oct 2021 02:38:59 +1300 Subject: Minor refactor. --- parse.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'parse.c') diff --git a/parse.c b/parse.c index eebadde..15fcc24 100644 --- a/parse.c +++ b/parse.c @@ -120,13 +120,10 @@ AsmLine *parse(void) { yycontext ctx; memset(&ctx, 0, sizeof(yycontext)); + result = NULL; prevl = NULL; - curlineno = 0; while (yyparse(&ctx)) { - curlineno += 1; - if (ctx.v.kind == ASM_SYNTAX_ERROR) - lfatal("syntax error\n"); l = zalloc(sizeof(AsmLine)); l->v = internparsev(&ctx.v); if (prevl) @@ -135,5 +132,9 @@ AsmLine *parse(void) { result = l; prevl = l; } + + if (!result) + fatal("io error"); + return result; } -- cgit v1.2.3