Make it possible to compile redbean with chibicc

This cuts build latency down from 5 seconds to 500 milliseconds.
This commit is contained in:
Justine Tunney 2022-04-22 15:03:32 -07:00
parent 552525cbdd
commit 6ff46ca373
50 changed files with 898 additions and 824 deletions

View file

@ -284,7 +284,9 @@ static long eval_const_expr(Token **rest, Token *tok) {
convert_pp_tokens(expr);
Token *rest2;
long val = const_expr(&rest2, expr);
if (rest2->kind != TK_EOF) error_tok(rest2, "extra token");
if (rest2->kind != TK_EOF && rest2->kind != TK_JAVADOWN) {
error_tok(rest2, "extra token");
}
__arena_pop();
return val;
}
@ -324,7 +326,12 @@ static MacroParam *read_macro_params(Token **rest, Token *tok,
*rest = skip(tok->next, ')');
return head.next;
}
if (tok->kind != TK_IDENT) error_tok(tok, "expected an identifier");
if (tok->kind == TK_JAVADOWN) {
tok = tok->next;
}
if (tok->kind != TK_IDENT) {
error_tok(tok, "expected an identifier");
}
if (EQUAL(tok->next, "...")) {
*va_args_name = strndup(tok->loc, tok->len);
*rest = skip(tok->next->next, ')');