From f7b471b8576846e575f8c73ef6b70c4b06ff377d Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Sun, 12 May 2019 13:24:39 -0700 Subject: Improve error message and simplify slightly --- decl.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/decl.c b/decl.c index b771a04..a65d7c6 100644 --- a/decl.c +++ b/decl.c @@ -951,17 +951,10 @@ decl(struct scope *s, struct func *f) } break; } - switch (tok.kind) { - case TCOMMA: - next(); - allowfunc = 0; - break; - case TSEMICOLON: - next(); + if (consume(TSEMICOLON)) return true; - default: - error(&tok.loc, "expected ',' or ';' after declarator"); - } + expect(TCOMMA, "or ';' after declarator"); + allowfunc = 0; } } -- cgit v1.2.3