lang: ast: misc formatting and reference fixes
This commit is contained in:
@@ -1,20 +1,25 @@
|
||||
#include "ctx.h"
|
||||
#include "expr/expr.h"
|
||||
#include "iterate.h"
|
||||
#include "node.h"
|
||||
|
||||
#include <blue/object/string.h>
|
||||
|
||||
static void to_string(struct ivy_ast_node *node, b_string *str)
|
||||
{
|
||||
struct ivy_ast_string_node *s = (struct ivy_ast_string_node *)node;
|
||||
b_string_append_cstrf(str, "%s (\"%s\")", ivy_ast_node_type_to_string(node->n_type), s->n_value->t_str);
|
||||
b_string_append_cstrf(
|
||||
str, "%s (\"%s\")", ivy_ast_node_type_to_string(node->n_type),
|
||||
s->n_value->t_str);
|
||||
}
|
||||
|
||||
struct token_parse_result parse_string(
|
||||
struct ivy_parser *ctx, struct ivy_token *tok)
|
||||
struct token_parse_result parse_string(struct ivy_parser *ctx, struct ivy_token *tok)
|
||||
{
|
||||
struct parser_state *state = parser_get_state_generic(ctx);
|
||||
struct ivy_ast_fstring_node *parent = (struct ivy_ast_fstring_node *)state->s_node;
|
||||
struct ivy_ast_string_node *child = (struct ivy_ast_string_node *)ast_node_create(IVY_AST_STRING);
|
||||
struct ivy_ast_fstring_node *parent
|
||||
= (struct ivy_ast_fstring_node *)state->s_node;
|
||||
struct ivy_ast_string_node *child
|
||||
= (struct ivy_ast_string_node *)ast_node_create(IVY_AST_STRING);
|
||||
|
||||
if (!child) {
|
||||
return PARSE_RESULT(IVY_ERR_NO_MEMORY, 0);
|
||||
@@ -28,7 +33,9 @@ struct token_parse_result parse_string(
|
||||
struct token_parse_result parse_left_brace(
|
||||
struct ivy_parser *ctx, struct ivy_token *tok)
|
||||
{
|
||||
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->s_terminator = IVY_SYM_RIGHT_BRACE;
|
||||
return PARSE_RESULT(IVY_OK, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user