commit 4cad49c2584ddea18817a133e02739242891a77e
parent ea673424d1072dcefc15bf7536398f27efee5a94
Author: Armin Weigl <tb46305@gmail.com>
Date: Sun, 7 Feb 2021 13:54:35 +0100
synassert on missing comma between case options
Diffstat:
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/parse.c b/src/parse.c
@@ -1641,6 +1641,9 @@ parse_case_options(struct lexer *lexer)
break;
default:
unlex(lexer, &tok);
+ opt = xcalloc(1, sizeof(struct ast_case_option));
+ *next = opt;
+ next = &opt->next;
break;
}
break;
@@ -1648,14 +1651,9 @@ parse_case_options(struct lexer *lexer)
more = false;
break;
default:
- unlex(lexer, &tok);
+ synassert(false, &tok, T_CASE, T_COMMA, T_EOF);
break;
}
- if (more) {
- opt = xcalloc(1, sizeof(struct ast_case_option));
- *next = opt;
- next = &opt->next;
- }
}
return opts;