lang: ast: fix expr type not being set when parsing a lambda
This commit is contained in:
@@ -662,6 +662,20 @@ struct token_parse_result arith_parse_right_brace(
|
||||
struct token_parse_result arith_parse_left_bracket(
|
||||
struct ivy_parser *ctx, struct ivy_token *tok)
|
||||
{
|
||||
struct expr_parser_state *state
|
||||
= parser_get_state(ctx, struct expr_parser_state);
|
||||
|
||||
if (state->s_type == EXPR_TYPE_STMT) {
|
||||
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
||||
}
|
||||
|
||||
if (state->s_prev_component == EXPR_CMP_OPERAND) {
|
||||
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
||||
}
|
||||
|
||||
state->s_prev_token = IVY_SYM_LEFT_BRACKET;
|
||||
state->s_type = EXPR_TYPE_ARITH;
|
||||
|
||||
parser_push_state(ctx, IVY_AST_LAMBDA, 0);
|
||||
return PARSE_RESULT(IVY_OK, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user