aboutsummaryrefslogtreecommitdiff
path: root/parse.c
diff options
context:
space:
mode:
authorAndrew Chambers <[email protected]>2021-10-14 02:38:59 +1300
committerAndrew Chambers <[email protected]>2021-10-14 02:38:59 +1300
commitbc8b406043b23a5825320248cbad3ff73cd124fe (patch)
tree0b20398d179622e1fb106e3138539187cadb28c1 /parse.c
parent3964d1dc536bce2e7da15569b42e9ad1c7258d78 (diff)
Minor refactor.
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c9
1 files changed, 5 insertions, 4 deletions
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;
}