lang: ast: implement caret (return) parsing

This commit is contained in:
2024-12-06 10:01:56 +00:00
parent d1855afc05
commit f3cd89c72a
6 changed files with 72 additions and 1 deletions

View File

@@ -47,6 +47,9 @@ struct expr_parser_state {
enum expr_type s_type;
enum expr_subtype s_sub_type;
/* this is a return statement (prefixed with a caret) */
bool s_return;
/* for arithmetic expressions, this records whether the previous
* component (either a token or parenthesised group of tokens) is an
* operator, operand, or message */
@@ -117,6 +120,8 @@ extern struct token_parse_result arith_parse_semicolon(
struct ivy_parser *ctx, struct ivy_token *tok);
extern struct token_parse_result arith_parse_dot(
struct ivy_parser *ctx, struct ivy_token *tok);
extern struct token_parse_result arith_parse_caret(
struct ivy_parser *ctx, struct ivy_token *tok);
extern struct token_parse_result arith_parse_comma(
struct ivy_parser *ctx, struct ivy_token *tok);
extern struct token_parse_result arith_parse_equal_right_angle(