lang: ast: implement parsing of static and dynamic package initialisers
This commit is contained in:
@@ -12,6 +12,13 @@ struct token_parse_result stmt_parse_for(
|
||||
struct expr_parser_state *state
|
||||
= parser_get_state(ctx, struct expr_parser_state);
|
||||
|
||||
if (state->s_terminator == IVY_KW_FOR) {
|
||||
/* treat this as a statement terminator. */
|
||||
struct token_parse_result result = expr_finalise_and_return(ctx, state);
|
||||
result.r_flags |= PARSE_REPEAT_TOKEN;
|
||||
return result;
|
||||
}
|
||||
|
||||
if (state->s_sub_type == EXPR_SUBTYPE_KEYWORD_ARG) {
|
||||
/* keyword messages have a higher precedence than inline
|
||||
* conditionals, so treat this as a statement terminator. */
|
||||
@@ -119,6 +126,13 @@ struct token_parse_result stmt_parse_if(
|
||||
struct expr_parser_state *state
|
||||
= parser_get_state(ctx, struct expr_parser_state);
|
||||
|
||||
if (state->s_terminator == IVY_KW_IF) {
|
||||
/* treat this as a statement terminator. */
|
||||
struct token_parse_result result = expr_finalise_and_return(ctx, state);
|
||||
result.r_flags |= PARSE_REPEAT_TOKEN;
|
||||
return result;
|
||||
}
|
||||
|
||||
if (state->s_sub_type == EXPR_SUBTYPE_KEYWORD_ARG) {
|
||||
/* keyword messages have a higher precedence than inline
|
||||
* conditionals, so treat this as a statement terminator. */
|
||||
|
||||
Reference in New Issue
Block a user