lang: ast: implement parsing of inline and standalone if-else statements
This commit is contained in:
@@ -67,7 +67,6 @@ struct expr_parser_state {
|
||||
* expression will not be consumed. */
|
||||
unsigned int s_terminator;
|
||||
|
||||
|
||||
b_queue s_output_queue;
|
||||
b_queue s_operator_stack;
|
||||
|
||||
@@ -84,6 +83,16 @@ struct expr_parser_state {
|
||||
};
|
||||
};
|
||||
|
||||
/* general functions */
|
||||
|
||||
extern struct token_parse_result expr_finalise(
|
||||
struct ivy_parser *ctx, struct expr_parser_state *state,
|
||||
enum ivy_operator_precedence min_precedence, struct ivy_ast_node **expr);
|
||||
extern struct token_parse_result expr_finalise_and_return(
|
||||
struct ivy_parser *ctx, struct expr_parser_state *state);
|
||||
|
||||
/* arithmetic parser callbacks */
|
||||
|
||||
extern void arith_push_operator(
|
||||
struct expr_parser_state *state, struct ivy_ast_node *node);
|
||||
extern void arith_push_operand(
|
||||
@@ -109,4 +118,15 @@ extern struct token_parse_result arith_parse_semicolon(
|
||||
extern struct token_parse_result arith_parse_dot(
|
||||
struct ivy_parser *ctx, struct ivy_token *tok);
|
||||
|
||||
/* statement parser callbacks */
|
||||
|
||||
extern struct token_parse_result stmt_parse_if(
|
||||
struct ivy_parser *ctx, struct ivy_token *tok);
|
||||
extern struct token_parse_result stmt_parse_then(
|
||||
struct ivy_parser *ctx, struct ivy_token *tok);
|
||||
struct token_parse_result stmt_parse_else(
|
||||
struct ivy_parser *ctx, struct ivy_token *tok);
|
||||
struct token_parse_result stmt_parse_end(
|
||||
struct ivy_parser *ctx, struct ivy_token *tok);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user