lang: ast: fix some source formatting
This commit is contained in:
@@ -19,7 +19,8 @@ struct tuple_parser_state {
|
||||
|
||||
static void finalise_tuple(struct tuple_parser_state *state)
|
||||
{
|
||||
struct ivy_ast_tuple_node *tuple = (struct ivy_ast_tuple_node *)state->s_base.s_node;
|
||||
struct ivy_ast_tuple_node *tuple
|
||||
= (struct ivy_ast_tuple_node *)state->s_base.s_node;
|
||||
|
||||
tuple->n_members = state->s_items;
|
||||
state->s_items = B_QUEUE_INIT;
|
||||
@@ -27,7 +28,8 @@ static void finalise_tuple(struct tuple_parser_state *state)
|
||||
|
||||
struct token_parse_result parse_comma(struct ivy_parser *ctx, struct ivy_token *tok)
|
||||
{
|
||||
struct tuple_parser_state *state = parser_get_state(ctx, struct tuple_parser_state);
|
||||
struct tuple_parser_state *state
|
||||
= parser_get_state(ctx, struct tuple_parser_state);
|
||||
if (state->s_prev != IVY_SYM_LEFT_PAREN && state->s_prev != IVY_SYM_COMMA) {
|
||||
/* token not expected at this time. */
|
||||
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
||||
@@ -42,7 +44,9 @@ struct token_parse_result parse_comma(struct ivy_parser *ctx, struct ivy_token *
|
||||
state->s_prev_node = NULL;
|
||||
state->s_prev = IVY_SYM_COMMA;
|
||||
|
||||
struct expr_parser_state *expr = (struct expr_parser_state *)parser_push_state(ctx, IVY_AST_EXPR, 0);
|
||||
struct expr_parser_state *expr
|
||||
= (struct expr_parser_state *)parser_push_state(
|
||||
ctx, IVY_AST_EXPR, 0);
|
||||
expr_add_terminator(expr, IVY_SYM_COMMA);
|
||||
expr_add_terminator(expr, IVY_SYM_RIGHT_PAREN);
|
||||
expr->s_subexpr_depth = 1;
|
||||
@@ -50,9 +54,11 @@ struct token_parse_result parse_comma(struct ivy_parser *ctx, struct ivy_token *
|
||||
return PARSE_RESULT(IVY_OK, 0);
|
||||
}
|
||||
|
||||
struct token_parse_result parse_right_paren(struct ivy_parser *ctx, struct ivy_token *tok)
|
||||
struct token_parse_result parse_right_paren(
|
||||
struct ivy_parser *ctx, struct ivy_token *tok)
|
||||
{
|
||||
struct tuple_parser_state *state = parser_get_state(ctx, struct tuple_parser_state);
|
||||
struct tuple_parser_state *state
|
||||
= parser_get_state(ctx, struct tuple_parser_state);
|
||||
if (state->s_prev != IVY_SYM_COMMA) {
|
||||
/* token not expected at this time. */
|
||||
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
||||
@@ -76,8 +82,7 @@ struct token_parse_result parse_right_paren(struct ivy_parser *ctx, struct ivy_t
|
||||
static enum ivy_status add_child(
|
||||
struct parser_state *parent, struct ivy_ast_node *child)
|
||||
{
|
||||
struct tuple_parser_state *state
|
||||
= (struct tuple_parser_state *)parent;
|
||||
struct tuple_parser_state *state = (struct tuple_parser_state *)parent;
|
||||
|
||||
if (state->s_prev_node) {
|
||||
return IVY_ERR_BAD_SYNTAX;
|
||||
@@ -99,7 +104,9 @@ static void init_state(struct ivy_parser *ctx, struct parser_state *sp, uintptr_
|
||||
state->s_prev = IVY_SYM_COMMA;
|
||||
}
|
||||
|
||||
struct expr_parser_state *expr = (struct expr_parser_state *)parser_push_state(ctx, IVY_AST_EXPR, 0);
|
||||
struct expr_parser_state *expr
|
||||
= (struct expr_parser_state *)parser_push_state(
|
||||
ctx, IVY_AST_EXPR, 0);
|
||||
expr_add_terminator(expr, IVY_SYM_COMMA);
|
||||
expr_add_terminator(expr, IVY_SYM_RIGHT_PAREN);
|
||||
expr->s_subexpr_depth = 1;
|
||||
@@ -112,7 +119,8 @@ static void collect_children(
|
||||
|
||||
b_queue_iterator it = {0};
|
||||
b_queue_foreach (&it, &tuple->n_members) {
|
||||
struct ivy_ast_node *item = b_unbox(struct ivy_ast_node, it.entry, n_entry);
|
||||
struct ivy_ast_node *item
|
||||
= b_unbox(struct ivy_ast_node, it.entry, n_entry);
|
||||
ast_node_iterator_enqueue_node(iterator, node, item);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user