X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=parser.c;h=a11c70955878c248adbef9c0bd7b48307abaafd2;hp=4058a8f99b042c349cfa54fa3aa89717121a2fb3;hb=f832b86dcdf936b5604df84654d16b4c105f0ff0;hpb=33c7707f564d0f3a8e40e955fdaa505af67a88cb diff --git a/parser.c b/parser.c index 4058a8f..a11c709 100644 --- a/parser.c +++ b/parser.c @@ -2512,11 +2512,6 @@ static bool parse_switch(parser_t *parser, ast_block *block, ast_expression **ou while (parser->tok != '}') { ast_block *caseblock; - if (parser->tok != TOKEN_KEYWORD) { - ast_delete(switchnode); - parseerror(parser, "expected 'case' or 'default'"); - return false; - } if (!strcmp(parser_tokval(parser), "case")) { if (!parser_next(parser)) { ast_delete(switchnode); @@ -2545,6 +2540,11 @@ static bool parse_switch(parser_t *parser, ast_block *block, ast_expression **ou return false; } } + else { + ast_delete(switchnode); + parseerror(parser, "expected 'case' or 'default'"); + return false; + } /* Now the colon and body */ if (parser->tok != ':') {