lang: ast: implement parsing of inline and standalone if-else statements

This commit is contained in:
2024-12-04 16:35:19 +00:00
parent d2677e2038
commit c23523ce14
19 changed files with 641 additions and 134 deletions

View File

@@ -38,7 +38,8 @@ static struct token_parse_result parse_linefeed(
}
struct block_parser_state *block_state
= (struct block_parser_state *)parser_push_state(ctx, IVY_AST_BLOCK);
= (struct block_parser_state *)parser_push_state(
ctx, IVY_AST_BLOCK, 0);
block_state->s_terminator = IVY_SYM_BANG;
return PARSE_RESULT(IVY_OK, 0);
@@ -75,7 +76,7 @@ static struct token_parse_result parse_pipe(
}
state->s_oneline = true;
parser_push_state(ctx, IVY_AST_EXPR);
parser_push_state(ctx, IVY_AST_EXPR, 0);
return PARSE_RESULT(IVY_OK, 0);
}
@@ -104,7 +105,7 @@ static void init_state(struct ivy_parser *ctx, struct parser_state *sp)
state->s_i = 0;
state->s_prev = IVY_SYM_HYPHEN;
parser_push_state(ctx, IVY_AST_SELECTOR);
parser_push_state(ctx, IVY_AST_SELECTOR, 0);
}
static void collect_children(