lang: ast: implement support for multiple expression terminator tokens
This commit is contained in:
@@ -124,7 +124,7 @@ static struct token_parse_result parse_equal_right_angle(
|
||||
state->s_prev_node = NULL;
|
||||
|
||||
struct expr_parser_state *expr = (struct expr_parser_state *)parser_push_state(ctx, IVY_AST_EXPR, 0);
|
||||
expr->s_terminator = IVY_SYM_COMMA;
|
||||
expr_add_terminator(expr, IVY_SYM_COMMA);
|
||||
expr->s_subexpr_depth = 1;
|
||||
|
||||
return PARSE_RESULT(IVY_OK, 0);
|
||||
@@ -162,7 +162,7 @@ static struct token_parse_result parse_comma(
|
||||
state->s_prev = IVY_SYM_COMMA;
|
||||
|
||||
struct expr_parser_state *expr = (struct expr_parser_state *)parser_push_state(ctx, IVY_AST_EXPR, 0);
|
||||
expr->s_terminator = IVY_SYM_EQUAL_RIGHT_ANGLE;
|
||||
expr_add_terminator(expr, IVY_SYM_EQUAL_RIGHT_ANGLE);
|
||||
expr->s_subexpr_depth = 1;
|
||||
|
||||
return PARSE_RESULT(IVY_OK, 0);
|
||||
@@ -261,7 +261,7 @@ static struct token_parse_result parse_for(
|
||||
state->s_prev_node = NULL;
|
||||
|
||||
struct expr_parser_state *expr = (struct expr_parser_state *)parser_push_state(ctx, IVY_AST_EXPR, 0);
|
||||
expr->s_terminator = IVY_KW_IN;
|
||||
expr_add_terminator(expr, IVY_KW_IN);
|
||||
expr->s_subexpr_depth = 1;
|
||||
|
||||
return PARSE_RESULT(IVY_OK, 0);
|
||||
@@ -292,7 +292,7 @@ static struct token_parse_result parse_in(
|
||||
state->s_prev_node = NULL;
|
||||
|
||||
struct expr_parser_state *expr = (struct expr_parser_state *)parser_push_state(ctx, IVY_AST_EXPR, 0);
|
||||
expr->s_terminator = IVY_KW_IF;
|
||||
expr_add_terminator(expr, IVY_KW_IF);
|
||||
expr->s_subexpr_depth = 1;
|
||||
|
||||
return PARSE_RESULT(IVY_OK, 0);
|
||||
@@ -323,7 +323,7 @@ static struct token_parse_result parse_if(
|
||||
state->s_prev_node = NULL;
|
||||
|
||||
struct expr_parser_state *expr = (struct expr_parser_state *)parser_push_state(ctx, IVY_AST_EXPR, 0);
|
||||
expr->s_terminator = IVY_SYM_RIGHT_BRACE;
|
||||
expr_add_terminator(expr, IVY_SYM_RIGHT_BRACE);
|
||||
expr->s_subexpr_depth = 1;
|
||||
|
||||
return PARSE_RESULT(IVY_OK, 0);
|
||||
@@ -411,7 +411,7 @@ static void init_state(struct ivy_parser *ctx, struct parser_state *sp, uintptr_
|
||||
state->s_next_implicit_index = 0;
|
||||
|
||||
struct expr_parser_state *expr = (struct expr_parser_state *)parser_push_state(ctx, IVY_AST_EXPR, 0);
|
||||
expr->s_terminator = IVY_KW_FOR;
|
||||
expr_add_terminator(expr, IVY_KW_FOR);
|
||||
expr->s_subexpr_depth = 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user