lang: ast: implement parsing of match statements

This commit is contained in:
2024-12-04 22:22:25 +00:00
parent 0bb4a4284c
commit 7acf80f930
10 changed files with 396 additions and 13 deletions

View File

@@ -32,12 +32,20 @@ struct ast_node_type expr_node_ops = {
SYM_PARSER(LEFT_PAREN, arith_parse_left_paren),
SYM_PARSER(RIGHT_PAREN, arith_parse_right_paren),
SYM_PARSER(SEMICOLON, arith_parse_semicolon),
SYM_PARSER(UNDERSCORE, arith_parse_operand),
SYM_PARSER(COMMA, arith_parse_comma),
SYM_PARSER(DOT, arith_parse_dot),
SYM_PARSER(EQUAL_RIGHT_ANGLE, arith_parse_equal_right_angle),
},
.n_keyword_parsers = {
/* statement keywords */
KW_PARSER(MATCH, stmt_parse_match),
KW_PARSER(IF, stmt_parse_if),
KW_PARSER(THEN, stmt_parse_then),
KW_PARSER(ELSE, stmt_parse_else),
KW_PARSER(END, stmt_parse_end),
/* operator keywords */
KW_PARSER(IN, arith_parse_in),
}
};