mirror of
https://github.com/rui314/chibicc
synced 2024-11-25 07:40:48 +03:00
Add null statement
This commit is contained in:
parent
18ac283a5d
commit
ff8912c68e
7
parse.c
7
parse.c
@ -91,8 +91,13 @@ static Node *compound_stmt(Token **rest, Token *tok) {
|
||||
return node;
|
||||
}
|
||||
|
||||
// expr-stmt = expr ";"
|
||||
// expr-stmt = expr? ";"
|
||||
static Node *expr_stmt(Token **rest, Token *tok) {
|
||||
if (equal(tok, ";")) {
|
||||
*rest = tok->next;
|
||||
return new_node(ND_BLOCK);
|
||||
}
|
||||
|
||||
Node *node = new_unary(ND_EXPR_STMT, expr(&tok, tok));
|
||||
*rest = skip(tok, ";");
|
||||
return node;
|
||||
|
Loading…
Reference in New Issue
Block a user