@@ -1483,7 +1483,7 @@ static AstNode *ast_parse_if_expr(ParseContext *pc, size_t *token_index, bool ma
|
||||
}
|
||||
|
||||
/*
|
||||
ReturnExpression : option("%" | "?") "return" option(Expression)
|
||||
ReturnExpression : option("%") "return" option(Expression)
|
||||
*/
|
||||
static AstNode *ast_parse_return_expr(ParseContext *pc, size_t *token_index) {
|
||||
Token *token = &pc->tokens->at(*token_index);
|
||||
@@ -1500,15 +1500,6 @@ static AstNode *ast_parse_return_expr(ParseContext *pc, size_t *token_index) {
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
} else if (token->id == TokenIdMaybe) {
|
||||
Token *next_token = &pc->tokens->at(*token_index + 1);
|
||||
if (next_token->id == TokenIdKeywordReturn) {
|
||||
kind = ReturnKindMaybe;
|
||||
node_type = NodeTypeReturnExpr;
|
||||
*token_index += 2;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
} else if (token->id == TokenIdKeywordReturn) {
|
||||
kind = ReturnKindUnconditional;
|
||||
node_type = NodeTypeReturnExpr;
|
||||
@@ -1525,7 +1516,7 @@ static AstNode *ast_parse_return_expr(ParseContext *pc, size_t *token_index) {
|
||||
}
|
||||
|
||||
/*
|
||||
Defer(body) = option("%" | "?") "defer" body
|
||||
Defer(body) = option("%") "defer" body
|
||||
*/
|
||||
static AstNode *ast_parse_defer_expr(ParseContext *pc, size_t *token_index) {
|
||||
Token *token = &pc->tokens->at(*token_index);
|
||||
@@ -1542,15 +1533,6 @@ static AstNode *ast_parse_defer_expr(ParseContext *pc, size_t *token_index) {
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
} else if (token->id == TokenIdMaybe) {
|
||||
Token *next_token = &pc->tokens->at(*token_index + 1);
|
||||
if (next_token->id == TokenIdKeywordDefer) {
|
||||
kind = ReturnKindMaybe;
|
||||
node_type = NodeTypeDefer;
|
||||
*token_index += 2;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
} else if (token->id == TokenIdKeywordDefer) {
|
||||
kind = ReturnKindUnconditional;
|
||||
node_type = NodeTypeDefer;
|
||||
|
||||
Reference in New Issue
Block a user