meta: replace bluelib with fx
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
#include "ctx.h"
|
||||
#include "node.h"
|
||||
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/string.h>
|
||||
|
||||
static void to_string(struct ivy_ast_node *node, b_string *str)
|
||||
static void to_string(struct ivy_ast_node *node, fx_string *str)
|
||||
{
|
||||
struct ivy_ast_atom_node *v = (struct ivy_ast_atom_node *)node;
|
||||
|
||||
b_string_append_cstrf(
|
||||
fx_string_append_cstrf(
|
||||
str, "%s (%s)", ivy_ast_node_type_to_string(node->n_type),
|
||||
v->n_content->t_str);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "iterate.h"
|
||||
#include "node.h"
|
||||
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/string.h>
|
||||
#include <ivy/lang/lex.h>
|
||||
|
||||
void block_add_terminator(struct block_parser_state *state, unsigned short tok)
|
||||
@@ -134,7 +134,7 @@ static enum ivy_status add_child(
|
||||
struct ivy_ast_block_node *block
|
||||
= (struct ivy_ast_block_node *)parent->s_node;
|
||||
|
||||
b_queue_push_back(&block->n_expr, &child->n_entry);
|
||||
fx_queue_push_back(&block->n_expr, &child->n_entry);
|
||||
|
||||
return IVY_OK;
|
||||
}
|
||||
@@ -143,12 +143,12 @@ static void collect_children(
|
||||
struct ivy_ast_node *node, struct ivy_ast_node_iterator *iterator)
|
||||
{
|
||||
struct ivy_ast_block_node *block = (struct ivy_ast_block_node *)node;
|
||||
b_queue_entry *entry = b_queue_first(&block->n_expr);
|
||||
fx_queue_entry *entry = fx_queue_first(&block->n_expr);
|
||||
while (entry) {
|
||||
struct ivy_ast_node *expr
|
||||
= b_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
= fx_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
ast_node_iterator_enqueue_node(iterator, node, expr);
|
||||
entry = b_queue_next(entry);
|
||||
entry = fx_queue_next(entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@ static void collect_children(
|
||||
ast_node_iterator_enqueue_node(iterator, node, cascade->n_recipient);
|
||||
}
|
||||
|
||||
b_queue_entry *entry = b_queue_first(&cascade->n_msg);
|
||||
fx_queue_entry *entry = fx_queue_first(&cascade->n_msg);
|
||||
while (entry) {
|
||||
struct ivy_ast_node *arg
|
||||
= b_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
= fx_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
ast_node_iterator_enqueue_node(iterator, node, arg);
|
||||
entry = b_queue_next(entry);
|
||||
entry = fx_queue_next(entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "iterate.h"
|
||||
#include "node.h"
|
||||
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/string.h>
|
||||
#include <ivy/lang/lex.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -130,10 +130,10 @@ static enum ivy_status add_child(
|
||||
|
||||
switch (child->n_type) {
|
||||
case IVY_AST_MSGH:
|
||||
b_queue_push_back(&c->n_msg_handlers, &child->n_entry);
|
||||
fx_queue_push_back(&c->n_msg_handlers, &child->n_entry);
|
||||
break;
|
||||
case IVY_AST_PROPERTY:
|
||||
b_queue_push_back(&c->n_properties, &child->n_entry);
|
||||
fx_queue_push_back(&c->n_properties, &child->n_entry);
|
||||
break;
|
||||
default:
|
||||
return IVY_ERR_NOT_SUPPORTED;
|
||||
@@ -142,11 +142,11 @@ static enum ivy_status add_child(
|
||||
return IVY_OK;
|
||||
}
|
||||
|
||||
static void to_string(struct ivy_ast_node *node, b_string *str)
|
||||
static void to_string(struct ivy_ast_node *node, fx_string *str)
|
||||
{
|
||||
struct ivy_ast_class_node *c = (struct ivy_ast_class_node *)node;
|
||||
|
||||
b_string_append_cstrf(
|
||||
fx_string_append_cstrf(
|
||||
str, "%s (%s)", ivy_ast_node_type_to_string(node->n_type),
|
||||
c->n_ident->t_str);
|
||||
}
|
||||
@@ -162,20 +162,20 @@ static void collect_children(
|
||||
struct ivy_ast_node *node, struct ivy_ast_node_iterator *iterator)
|
||||
{
|
||||
struct ivy_ast_class_node *c = (struct ivy_ast_class_node *)node;
|
||||
b_queue_entry *entry = b_queue_first(&c->n_properties);
|
||||
fx_queue_entry *entry = fx_queue_first(&c->n_properties);
|
||||
while (entry) {
|
||||
struct ivy_ast_node *child
|
||||
= b_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
= fx_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
ast_node_iterator_enqueue_node(iterator, node, child);
|
||||
entry = b_queue_next(entry);
|
||||
entry = fx_queue_next(entry);
|
||||
}
|
||||
|
||||
entry = b_queue_first(&c->n_msg_handlers);
|
||||
entry = fx_queue_first(&c->n_msg_handlers);
|
||||
while (entry) {
|
||||
struct ivy_ast_node *child
|
||||
= b_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
= fx_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
ast_node_iterator_enqueue_node(iterator, node, child);
|
||||
entry = b_queue_next(entry);
|
||||
entry = fx_queue_next(entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ struct cond_group_parser_state {
|
||||
unsigned int s_prev_token;
|
||||
|
||||
struct ivy_ast_cond_node *s_cur_branch;
|
||||
b_queue s_branches;
|
||||
fx_queue s_branches;
|
||||
|
||||
struct ivy_ast_node *s_prev_node;
|
||||
};
|
||||
@@ -26,7 +26,7 @@ static enum ivy_status flush_current_branch(struct cond_group_parser_state *stat
|
||||
return IVY_ERR_INTERNAL_FAILURE;
|
||||
}
|
||||
|
||||
b_queue_push_back(&state->s_branches, &state->s_cur_branch->n_base.n_entry);
|
||||
fx_queue_push_back(&state->s_branches, &state->s_cur_branch->n_base.n_entry);
|
||||
|
||||
state->s_cur_branch
|
||||
= (struct ivy_ast_cond_node *)ast_node_create(IVY_AST_COND);
|
||||
@@ -255,7 +255,7 @@ static enum ivy_status finalise_cond_group(struct cond_group_parser_state *state
|
||||
flush_current_branch(state);
|
||||
|
||||
group->n_branches = state->s_branches;
|
||||
state->s_branches = B_QUEUE_INIT;
|
||||
state->s_branches = FX_QUEUE_INIT;
|
||||
return IVY_OK;
|
||||
} else {
|
||||
/* we have just reached the 'end' keyword. */
|
||||
@@ -274,7 +274,7 @@ static enum ivy_status finalise_cond_group(struct cond_group_parser_state *state
|
||||
flush_current_branch(state);
|
||||
|
||||
group->n_branches = state->s_branches;
|
||||
state->s_branches = B_QUEUE_INIT;
|
||||
state->s_branches = FX_QUEUE_INIT;
|
||||
return IVY_OK;
|
||||
}
|
||||
}
|
||||
@@ -339,12 +339,12 @@ static void cond_group_collect_children(
|
||||
struct ivy_ast_cond_group_node *group
|
||||
= (struct ivy_ast_cond_group_node *)node;
|
||||
|
||||
b_queue_entry *entry = b_queue_first(&group->n_branches);
|
||||
fx_queue_entry *entry = fx_queue_first(&group->n_branches);
|
||||
while (entry) {
|
||||
struct ivy_ast_node *branch
|
||||
= b_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
= fx_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
ast_node_iterator_enqueue_node(iterator, node, branch);
|
||||
entry = b_queue_next(entry);
|
||||
entry = fx_queue_next(entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "../debug.h"
|
||||
#include "node.h"
|
||||
|
||||
#include <blue/core/queue.h>
|
||||
#include <fx/core/queue.h>
|
||||
#include <ivy/diag.h>
|
||||
#include <ivy/lang/ast.h>
|
||||
#include <stddef.h>
|
||||
@@ -14,10 +14,10 @@
|
||||
#ifdef IVY_LANG_DEBUG
|
||||
static void print_state_stack(struct ivy_parser *parser)
|
||||
{
|
||||
b_queue_iterator it = {0};
|
||||
b_queue_foreach (&it, &parser->p_state) {
|
||||
fx_queue_iterator it = {0};
|
||||
fx_queue_foreach (&it, &parser->p_state) {
|
||||
struct parser_state *state
|
||||
= b_unbox(struct parser_state, it.entry, s_entry);
|
||||
= fx_unbox(struct parser_state, it.entry, s_entry);
|
||||
debug_printf(
|
||||
" %s\n",
|
||||
ivy_ast_node_type_to_string(state->s_node->n_type));
|
||||
@@ -44,13 +44,13 @@ void ivy_parser_destroy(struct ivy_parser *parser, struct ivy_ast_node **result)
|
||||
{
|
||||
struct ivy_ast_node *root = NULL;
|
||||
|
||||
b_queue_entry *entry = b_queue_first(&parser->p_state);
|
||||
fx_queue_entry *entry = fx_queue_first(&parser->p_state);
|
||||
;
|
||||
while (entry) {
|
||||
struct parser_state *state
|
||||
= b_unbox(struct parser_state, entry, s_entry);
|
||||
b_queue_entry *next = b_queue_next(entry);
|
||||
b_queue_delete(&parser->p_state, entry);
|
||||
= fx_unbox(struct parser_state, entry, s_entry);
|
||||
fx_queue_entry *next = fx_queue_next(entry);
|
||||
fx_queue_delete(&parser->p_state, entry);
|
||||
|
||||
if (root) {
|
||||
ivy_ast_node_destroy(root);
|
||||
@@ -173,29 +173,29 @@ enum ivy_status ivy_parser_push_eof(struct ivy_parser *parser)
|
||||
|
||||
struct parser_state *parser_get_state_generic(struct ivy_parser *parser)
|
||||
{
|
||||
b_queue_entry *entry = b_queue_last(&parser->p_state);
|
||||
fx_queue_entry *entry = fx_queue_last(&parser->p_state);
|
||||
if (!entry) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct parser_state *state = b_unbox(struct parser_state, entry, s_entry);
|
||||
struct parser_state *state = fx_unbox(struct parser_state, entry, s_entry);
|
||||
return state;
|
||||
}
|
||||
|
||||
struct parser_state *parser_get_parent_state_generic(
|
||||
struct ivy_parser *parser, enum ivy_ast_node_type type)
|
||||
{
|
||||
b_queue_entry *entry = b_queue_last(&parser->p_state);
|
||||
fx_queue_entry *entry = fx_queue_last(&parser->p_state);
|
||||
if (!entry) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
entry = b_queue_prev(entry);
|
||||
entry = fx_queue_prev(entry);
|
||||
if (!entry) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct parser_state *state = b_unbox(struct parser_state, entry, s_entry);
|
||||
struct parser_state *state = fx_unbox(struct parser_state, entry, s_entry);
|
||||
|
||||
if (state->s_node->n_type != type) {
|
||||
return NULL;
|
||||
@@ -219,15 +219,15 @@ struct parser_state *parser_push_state(
|
||||
|
||||
memset(state, 0x0, node_type->n_state_size);
|
||||
|
||||
b_queue_entry *current_state_entry = b_queue_last(&parser->p_state);
|
||||
fx_queue_entry *current_state_entry = fx_queue_last(&parser->p_state);
|
||||
if (current_state_entry) {
|
||||
struct parser_state *current_state = b_unbox(
|
||||
struct parser_state *current_state = fx_unbox(
|
||||
struct parser_state, current_state_entry, s_entry);
|
||||
state->s_parent = current_state->s_node;
|
||||
}
|
||||
|
||||
state->s_node = ast_node_create(type);
|
||||
b_queue_push_back(&parser->p_state, &state->s_entry);
|
||||
fx_queue_push_back(&parser->p_state, &state->s_entry);
|
||||
|
||||
if (node_type->n_init_state) {
|
||||
node_type->n_init_state(parser, state, arg);
|
||||
@@ -246,9 +246,9 @@ void parser_pop_state(struct ivy_parser *parser, enum pop_state_flags flags)
|
||||
return;
|
||||
}
|
||||
|
||||
b_queue_entry *entry = b_queue_last(&parser->p_state);
|
||||
struct parser_state *state = b_unbox(struct parser_state, entry, s_entry);
|
||||
b_queue_pop_back(&parser->p_state);
|
||||
fx_queue_entry *entry = fx_queue_last(&parser->p_state);
|
||||
struct parser_state *state = fx_unbox(struct parser_state, entry, s_entry);
|
||||
fx_queue_pop_back(&parser->p_state);
|
||||
|
||||
if (state && state->s_node && (flags & STATE_ADD_NODE_TO_PARENT)) {
|
||||
parser_add_child(parser, state->s_node);
|
||||
@@ -298,15 +298,15 @@ bool ivy_parser_is_node_complete(struct ivy_parser *parser)
|
||||
|
||||
struct ivy_ast_node *ivy_parser_root_node(struct ivy_parser *parser)
|
||||
{
|
||||
b_queue_entry *entry = b_queue_first(&parser->p_state);
|
||||
struct parser_state *state = b_unbox(struct parser_state, entry, s_entry);
|
||||
fx_queue_entry *entry = fx_queue_first(&parser->p_state);
|
||||
struct parser_state *state = fx_unbox(struct parser_state, entry, s_entry);
|
||||
return state ? state->s_node : NULL;
|
||||
}
|
||||
|
||||
struct ivy_ast_node *ivy_parser_dequeue_node(struct ivy_parser *parser)
|
||||
{
|
||||
b_queue_entry *entry = b_queue_first(&parser->p_state);
|
||||
struct parser_state *state = b_unbox(struct parser_state, entry, s_entry);
|
||||
fx_queue_entry *entry = fx_queue_first(&parser->p_state);
|
||||
struct parser_state *state = fx_unbox(struct parser_state, entry, s_entry);
|
||||
|
||||
if (!state) {
|
||||
return NULL;
|
||||
@@ -318,13 +318,13 @@ struct ivy_ast_node *ivy_parser_dequeue_node(struct ivy_parser *parser)
|
||||
|
||||
struct ivy_ast_unit_node *unit = (struct ivy_ast_unit_node *)state->s_node;
|
||||
|
||||
entry = b_queue_pop_front(&unit->n_children);
|
||||
entry = fx_queue_pop_front(&unit->n_children);
|
||||
|
||||
if (!entry) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return b_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
return fx_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
}
|
||||
|
||||
struct ivy_diag *parser_push_diag(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef _AST_CTX_H_
|
||||
#define _AST_CTX_H_
|
||||
|
||||
#include <blue/core/queue.h>
|
||||
#include <fx/core/queue.h>
|
||||
#include <ivy/diag.h>
|
||||
#include <ivy/lang/ast.h>
|
||||
#include <ivy/lang/diag.h>
|
||||
@@ -14,7 +14,7 @@
|
||||
((state_type *)parser_get_parent_state_generic(parser, type_id))
|
||||
|
||||
struct parser_state {
|
||||
b_queue_entry s_entry;
|
||||
fx_queue_entry s_entry;
|
||||
struct ivy_ast_node *s_parent;
|
||||
struct ivy_ast_node *s_node;
|
||||
};
|
||||
@@ -22,9 +22,9 @@ struct parser_state {
|
||||
struct ivy_parser {
|
||||
enum ivy_status p_status;
|
||||
struct ivy_diag_ctx *p_diag_ctx;
|
||||
b_queue p_state;
|
||||
b_queue p_token_queue;
|
||||
b_queue p_node_queue;
|
||||
fx_queue p_state;
|
||||
fx_queue p_token_queue;
|
||||
fx_queue p_node_queue;
|
||||
};
|
||||
|
||||
enum pop_state_flags {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#include "ctx.h"
|
||||
#include "node.h"
|
||||
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/string.h>
|
||||
|
||||
static void to_string(struct ivy_ast_node *node, b_string *str)
|
||||
static void to_string(struct ivy_ast_node *node, fx_string *str)
|
||||
{
|
||||
struct ivy_ast_double_node *v = (struct ivy_ast_double_node *)node;
|
||||
|
||||
b_string_append_cstrf(
|
||||
fx_string_append_cstrf(
|
||||
str, "%s (%.2lf)", ivy_ast_node_type_to_string(node->n_type),
|
||||
v->n_value->t_double);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "../node.h"
|
||||
#include "expr.h"
|
||||
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/string.h>
|
||||
#include <ivy/lang/lex.h>
|
||||
#include <ivy/lang/operator.h>
|
||||
#include <stdio.h>
|
||||
@@ -63,7 +63,7 @@ enum ivy_status arith_push_operand(
|
||||
IVY_AST_IDENT);
|
||||
v->n_content = tok;
|
||||
ivy_ast_node_set_bounds_from_token((struct ivy_ast_node *)v, tok);
|
||||
b_queue_push_back(&state->s_output_queue, &v->n_base.n_entry);
|
||||
fx_queue_push_back(&state->s_output_queue, &v->n_base.n_entry);
|
||||
break;
|
||||
}
|
||||
case IVY_TOK_INT: {
|
||||
@@ -71,7 +71,7 @@ enum ivy_status arith_push_operand(
|
||||
= (struct ivy_ast_int_node *)ast_node_create(IVY_AST_INT);
|
||||
v->n_value = tok;
|
||||
ivy_ast_node_set_bounds_from_token((struct ivy_ast_node *)v, tok);
|
||||
b_queue_push_back(&state->s_output_queue, &v->n_base.n_entry);
|
||||
fx_queue_push_back(&state->s_output_queue, &v->n_base.n_entry);
|
||||
break;
|
||||
}
|
||||
case IVY_TOK_DOUBLE: {
|
||||
@@ -80,7 +80,7 @@ enum ivy_status arith_push_operand(
|
||||
IVY_AST_DOUBLE);
|
||||
v->n_value = tok;
|
||||
ivy_ast_node_set_bounds_from_token((struct ivy_ast_node *)v, tok);
|
||||
b_queue_push_back(&state->s_output_queue, &v->n_base.n_entry);
|
||||
fx_queue_push_back(&state->s_output_queue, &v->n_base.n_entry);
|
||||
break;
|
||||
}
|
||||
case IVY_TOK_ATOM: {
|
||||
@@ -88,7 +88,7 @@ enum ivy_status arith_push_operand(
|
||||
= (struct ivy_ast_atom_node *)ast_node_create(IVY_AST_ATOM);
|
||||
v->n_content = tok;
|
||||
ivy_ast_node_set_bounds_from_token((struct ivy_ast_node *)v, tok);
|
||||
b_queue_push_back(&state->s_output_queue, &v->n_base.n_entry);
|
||||
fx_queue_push_back(&state->s_output_queue, &v->n_base.n_entry);
|
||||
break;
|
||||
}
|
||||
case IVY_TOK_STRING: {
|
||||
@@ -97,7 +97,7 @@ enum ivy_status arith_push_operand(
|
||||
IVY_AST_STRING);
|
||||
v->n_value = tok;
|
||||
ivy_ast_node_set_bounds_from_token((struct ivy_ast_node *)v, tok);
|
||||
b_queue_push_back(&state->s_output_queue, &v->n_base.n_entry);
|
||||
fx_queue_push_back(&state->s_output_queue, &v->n_base.n_entry);
|
||||
break;
|
||||
}
|
||||
case IVY_TOK_SYMBOL: {
|
||||
@@ -107,7 +107,7 @@ enum ivy_status arith_push_operand(
|
||||
|
||||
struct ivy_ast_node *v = ast_node_create(IVY_AST_DISCARD);
|
||||
ivy_ast_node_set_bounds_from_token((struct ivy_ast_node *)v, tok);
|
||||
b_queue_push_back(&state->s_output_queue, &v->n_entry);
|
||||
fx_queue_push_back(&state->s_output_queue, &v->n_entry);
|
||||
break;
|
||||
}
|
||||
case IVY_TOK_KEYWORD: {
|
||||
@@ -133,7 +133,7 @@ enum ivy_status arith_push_operand(
|
||||
}
|
||||
|
||||
ivy_ast_node_set_bounds_from_token((struct ivy_ast_node *)v, tok);
|
||||
b_queue_push_back(&state->s_output_queue, &v->n_entry);
|
||||
fx_queue_push_back(&state->s_output_queue, &v->n_entry);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -204,20 +204,20 @@ static struct ivy_ast_node *create_operator_node_from_token(struct ivy_token *to
|
||||
#ifdef IVY_LANG_DEBUG
|
||||
static void print_expr_queues(struct expr_parser_state *state)
|
||||
{
|
||||
b_queue_iterator it = {0};
|
||||
fx_queue_iterator it = {0};
|
||||
|
||||
debug_printf("operators:");
|
||||
b_queue_foreach (&it, &state->s_operator_stack) {
|
||||
fx_queue_foreach (&it, &state->s_operator_stack) {
|
||||
struct ivy_ast_node *n
|
||||
= b_unbox(struct ivy_ast_node, it.entry, n_entry);
|
||||
= fx_unbox(struct ivy_ast_node, it.entry, n_entry);
|
||||
debug_printf(" ");
|
||||
print_operand(n);
|
||||
}
|
||||
|
||||
debug_printf("\noperands:");
|
||||
b_queue_foreach (&it, &state->s_output_queue) {
|
||||
fx_queue_foreach (&it, &state->s_output_queue) {
|
||||
struct ivy_ast_node *n
|
||||
= b_unbox(struct ivy_ast_node, it.entry, n_entry);
|
||||
= fx_unbox(struct ivy_ast_node, it.entry, n_entry);
|
||||
debug_printf(" ");
|
||||
print_operand(n);
|
||||
}
|
||||
@@ -234,13 +234,13 @@ void arith_push_operator(struct expr_parser_state *state, struct ivy_ast_node *n
|
||||
}
|
||||
|
||||
while (true) {
|
||||
b_queue_entry *top = b_queue_last(&state->s_operator_stack);
|
||||
fx_queue_entry *top = fx_queue_last(&state->s_operator_stack);
|
||||
if (!top) {
|
||||
break;
|
||||
}
|
||||
|
||||
struct ivy_ast_node *top_node
|
||||
= b_unbox(struct ivy_ast_node, top, n_entry);
|
||||
= fx_unbox(struct ivy_ast_node, top, n_entry);
|
||||
const struct ivy_operator *top_op = NULL;
|
||||
|
||||
switch (top_node->n_type) {
|
||||
@@ -266,11 +266,11 @@ void arith_push_operator(struct expr_parser_state *state, struct ivy_ast_node *n
|
||||
break;
|
||||
}
|
||||
|
||||
b_queue_delete(&state->s_operator_stack, top);
|
||||
b_queue_push_back(&state->s_output_queue, top);
|
||||
fx_queue_delete(&state->s_operator_stack, top);
|
||||
fx_queue_push_back(&state->s_output_queue, top);
|
||||
}
|
||||
|
||||
b_queue_push_back(&state->s_operator_stack, &node->n_entry);
|
||||
fx_queue_push_back(&state->s_operator_stack, &node->n_entry);
|
||||
#ifdef IVY_LANG_DEBUG
|
||||
print_expr_queues(state);
|
||||
#endif
|
||||
@@ -296,7 +296,7 @@ enum ivy_status expr_finalise_arith(
|
||||
struct expr_parser_state *state, struct ivy_ast_node **expr_tree,
|
||||
enum ivy_operator_precedence minimum_precedence)
|
||||
{
|
||||
b_queue_entry *entry = NULL;
|
||||
fx_queue_entry *entry = NULL;
|
||||
|
||||
/* first, take all the operators still left on the operator stack and
|
||||
* add them to the output queue.
|
||||
@@ -304,13 +304,13 @@ enum ivy_status expr_finalise_arith(
|
||||
* since each set of parentheses has its own expression context,
|
||||
* we don't have to handle parentheses here */
|
||||
while (true) {
|
||||
entry = b_queue_pop_back(&state->s_operator_stack);
|
||||
entry = fx_queue_pop_back(&state->s_operator_stack);
|
||||
if (!entry) {
|
||||
break;
|
||||
}
|
||||
|
||||
struct ivy_ast_node *node
|
||||
= b_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
= fx_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
if (!node) {
|
||||
/* this should never happen */
|
||||
return IVY_ERR_INTERNAL_FAILURE;
|
||||
@@ -336,11 +336,11 @@ enum ivy_status expr_finalise_arith(
|
||||
/* if we aren't processing operators below a certain precedence
|
||||
* then leave them on the stack and stop here. */
|
||||
if (op->op_precedence < minimum_precedence) {
|
||||
b_queue_push_back(&state->s_operator_stack, entry);
|
||||
fx_queue_push_back(&state->s_operator_stack, entry);
|
||||
break;
|
||||
}
|
||||
|
||||
b_queue_push_back(&state->s_output_queue, entry);
|
||||
fx_queue_push_back(&state->s_output_queue, entry);
|
||||
}
|
||||
|
||||
#if 0
|
||||
@@ -353,22 +353,22 @@ enum ivy_status expr_finalise_arith(
|
||||
* always follow their operands, so a queue of operands is needed
|
||||
* for the conversion. */
|
||||
|
||||
b_queue q = B_QUEUE_INIT;
|
||||
b_queue_entry *tmp = NULL;
|
||||
entry = b_queue_first(&state->s_output_queue);
|
||||
fx_queue q = FX_QUEUE_INIT;
|
||||
fx_queue_entry *tmp = NULL;
|
||||
entry = fx_queue_first(&state->s_output_queue);
|
||||
int i = 0;
|
||||
|
||||
while (entry) {
|
||||
struct ivy_ast_node *item
|
||||
= b_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
b_queue_entry *next = b_queue_next(entry);
|
||||
b_queue_delete(&state->s_output_queue, entry);
|
||||
= fx_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
fx_queue_entry *next = fx_queue_next(entry);
|
||||
fx_queue_delete(&state->s_output_queue, entry);
|
||||
|
||||
/* if the node is an operand, just push it to a temporary queue
|
||||
* and come back to it later. */
|
||||
if (item->n_type != IVY_AST_OP && item->n_type != IVY_AST_MSG) {
|
||||
/* operand */
|
||||
b_queue_push_back(&q, &item->n_entry);
|
||||
fx_queue_push_back(&q, &item->n_entry);
|
||||
goto next;
|
||||
}
|
||||
|
||||
@@ -384,11 +384,11 @@ enum ivy_status expr_finalise_arith(
|
||||
* self-contained keyword message, and can be pushed to
|
||||
* the operand queue as-is. */
|
||||
if (!msg->n_recipient) {
|
||||
tmp = b_queue_pop_back(&q);
|
||||
msg->n_recipient = b_unbox(
|
||||
tmp = fx_queue_pop_back(&q);
|
||||
msg->n_recipient = fx_unbox(
|
||||
struct ivy_ast_node, tmp, n_entry);
|
||||
}
|
||||
b_queue_push_back(&q, &msg->n_base.n_entry);
|
||||
fx_queue_push_back(&q, &msg->n_base.n_entry);
|
||||
goto next;
|
||||
}
|
||||
|
||||
@@ -397,15 +397,15 @@ enum ivy_status expr_finalise_arith(
|
||||
* all the operands it needs, it can be pushed to the operand
|
||||
* queue as-is */
|
||||
if (op_node_is_complete(op_node)) {
|
||||
b_queue_push_back(&q, &item->n_entry);
|
||||
fx_queue_push_back(&q, &item->n_entry);
|
||||
goto next;
|
||||
}
|
||||
|
||||
/* otherwise, pop the relevant operands from the operand
|
||||
* queue... */
|
||||
op = op_node->n_op;
|
||||
tmp = b_queue_pop_back(&q);
|
||||
op_node->n_right = b_unbox(struct ivy_ast_node, tmp, n_entry);
|
||||
tmp = fx_queue_pop_back(&q);
|
||||
op_node->n_right = fx_unbox(struct ivy_ast_node, tmp, n_entry);
|
||||
|
||||
if (op_node->n_right) {
|
||||
op_node->n_right->n_parent = (struct ivy_ast_node *)op_node;
|
||||
@@ -416,9 +416,9 @@ enum ivy_status expr_finalise_arith(
|
||||
}
|
||||
|
||||
if (op->op_arity == IVY_OP_BINARY) {
|
||||
tmp = b_queue_pop_back(&q);
|
||||
tmp = fx_queue_pop_back(&q);
|
||||
op_node->n_left
|
||||
= b_unbox(struct ivy_ast_node, tmp, n_entry);
|
||||
= fx_unbox(struct ivy_ast_node, tmp, n_entry);
|
||||
|
||||
if (op_node->n_left) {
|
||||
op_node->n_left->n_parent
|
||||
@@ -432,7 +432,7 @@ enum ivy_status expr_finalise_arith(
|
||||
|
||||
/* ...and push the newly-completed operator node to the operand
|
||||
* queue */
|
||||
b_queue_push_back(&q, &op_node->n_base.n_entry);
|
||||
fx_queue_push_back(&q, &op_node->n_base.n_entry);
|
||||
next:
|
||||
entry = next;
|
||||
}
|
||||
@@ -448,15 +448,15 @@ enum ivy_status expr_finalise_arith(
|
||||
* their operands have just been moved to the temporary operand stack
|
||||
* used above. move them back to the parser state's output queue here
|
||||
* so they can be used later. */
|
||||
entry = b_queue_first(&state->s_operator_stack);
|
||||
entry = fx_queue_first(&state->s_operator_stack);
|
||||
while (entry) {
|
||||
b_queue_entry *entry2 = b_queue_pop_front(&q);
|
||||
fx_queue_entry *entry2 = fx_queue_pop_front(&q);
|
||||
if (!entry2) {
|
||||
return IVY_ERR_INTERNAL_FAILURE;
|
||||
}
|
||||
|
||||
b_queue_push_back(&state->s_output_queue, entry2);
|
||||
entry = b_queue_next(entry);
|
||||
fx_queue_push_back(&state->s_output_queue, entry2);
|
||||
entry = fx_queue_next(entry);
|
||||
}
|
||||
|
||||
#if 0
|
||||
@@ -468,8 +468,8 @@ enum ivy_status expr_finalise_arith(
|
||||
|
||||
/* the final node remaining on the temp operand stack is the root node
|
||||
* of the new expression tree */
|
||||
tmp = b_queue_pop_back(&q);
|
||||
*expr_tree = b_unbox(struct ivy_ast_node, tmp, n_entry);
|
||||
tmp = fx_queue_pop_back(&q);
|
||||
*expr_tree = fx_unbox(struct ivy_ast_node, tmp, n_entry);
|
||||
|
||||
return IVY_OK;
|
||||
}
|
||||
@@ -521,7 +521,7 @@ struct token_parse_result arith_parse_operand(
|
||||
memset(empty_label, 0x0, sizeof *empty_label);
|
||||
empty_label->t_type = IVY_TOK_LABEL;
|
||||
|
||||
b_queue_push_back(&state->s_labels, &empty_label->t_entry);
|
||||
fx_queue_push_back(&state->s_labels, &empty_label->t_entry);
|
||||
|
||||
struct expr_parser_state *arg_expr
|
||||
= (struct expr_parser_state *)parser_push_state(
|
||||
@@ -695,9 +695,9 @@ struct token_parse_result arith_parse_left_paren(
|
||||
|
||||
if (state->s_prev_token == IVY_TOK_IDENT) {
|
||||
/* this might be the opening parenthesis for a complex message. */
|
||||
b_queue_entry *msg_entry = b_queue_last(&state->s_operator_stack);
|
||||
fx_queue_entry *msg_entry = fx_queue_last(&state->s_operator_stack);
|
||||
struct ivy_ast_node *msg
|
||||
= b_unbox(struct ivy_ast_node, msg_entry, n_entry);
|
||||
= fx_unbox(struct ivy_ast_node, msg_entry, n_entry);
|
||||
|
||||
if (!msg || msg->n_type != IVY_AST_MSG) {
|
||||
/* this is not a complex message, it's probably a
|
||||
@@ -705,7 +705,7 @@ struct token_parse_result arith_parse_left_paren(
|
||||
goto not_complex_msg;
|
||||
}
|
||||
|
||||
b_queue_pop_back(&state->s_operator_stack);
|
||||
fx_queue_pop_back(&state->s_operator_stack);
|
||||
|
||||
struct expr_parser_state *msg_expr
|
||||
= (struct expr_parser_state *)parser_push_state(
|
||||
@@ -761,7 +761,7 @@ not_complex_msg:
|
||||
memset(empty_label, 0x0, sizeof *empty_label);
|
||||
empty_label->t_type = IVY_TOK_LABEL;
|
||||
|
||||
b_queue_push_back(&state->s_labels, &empty_label->t_entry);
|
||||
fx_queue_push_back(&state->s_labels, &empty_label->t_entry);
|
||||
|
||||
struct expr_parser_state *arg_expr
|
||||
= (struct expr_parser_state *)parser_push_state(
|
||||
@@ -908,21 +908,21 @@ struct token_parse_result arith_parse_right_bracket(
|
||||
return result;
|
||||
}
|
||||
|
||||
static struct ivy_ast_selector_node *keyword_selector_from_label_list(b_queue *labels)
|
||||
static struct ivy_ast_selector_node *keyword_selector_from_label_list(fx_queue *labels)
|
||||
{
|
||||
struct ivy_ast_selector_node *sel
|
||||
= (struct ivy_ast_selector_node *)ast_node_create(IVY_AST_SELECTOR);
|
||||
|
||||
b_queue_entry *entry = b_queue_first(labels);
|
||||
b_queue_entry *next = NULL;
|
||||
fx_queue_entry *entry = fx_queue_first(labels);
|
||||
fx_queue_entry *next = NULL;
|
||||
|
||||
while (entry) {
|
||||
struct ivy_token *label
|
||||
= b_unbox(struct ivy_token, entry, t_entry);
|
||||
next = b_queue_next(entry);
|
||||
b_queue_delete(labels, entry);
|
||||
= fx_unbox(struct ivy_token, entry, t_entry);
|
||||
next = fx_queue_next(entry);
|
||||
fx_queue_delete(labels, entry);
|
||||
|
||||
b_queue_push_back(&sel->n_arg_labels, &label->t_entry);
|
||||
fx_queue_push_back(&sel->n_arg_labels, &label->t_entry);
|
||||
entry = next;
|
||||
}
|
||||
|
||||
@@ -937,16 +937,16 @@ static struct ivy_ast_cascade_node *expr_finalise_cascade(
|
||||
|
||||
cascade->n_recipient = state->s_recipient;
|
||||
|
||||
b_queue_entry *entry = b_queue_first(&state->s_cascade_msg);
|
||||
b_queue_entry *next = NULL;
|
||||
fx_queue_entry *entry = fx_queue_first(&state->s_cascade_msg);
|
||||
fx_queue_entry *next = NULL;
|
||||
|
||||
while (entry) {
|
||||
struct ivy_ast_node *msg
|
||||
= b_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
next = b_queue_next(entry);
|
||||
b_queue_delete(&state->s_cascade_msg, entry);
|
||||
= fx_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
next = fx_queue_next(entry);
|
||||
fx_queue_delete(&state->s_cascade_msg, entry);
|
||||
|
||||
b_queue_push_back(&cascade->n_msg, &msg->n_entry);
|
||||
fx_queue_push_back(&cascade->n_msg, &msg->n_entry);
|
||||
entry = next;
|
||||
}
|
||||
|
||||
@@ -962,16 +962,16 @@ static struct ivy_ast_msg_node *expr_finalise_keyword_msg(
|
||||
msg->n_recipient = state->s_recipient;
|
||||
msg->n_sel = keyword_selector_from_label_list(&state->s_labels);
|
||||
|
||||
b_queue_entry *entry = b_queue_first(&state->s_args);
|
||||
b_queue_entry *next = NULL;
|
||||
fx_queue_entry *entry = fx_queue_first(&state->s_args);
|
||||
fx_queue_entry *next = NULL;
|
||||
|
||||
while (entry) {
|
||||
struct ivy_ast_node *arg
|
||||
= b_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
next = b_queue_next(entry);
|
||||
b_queue_delete(&state->s_args, entry);
|
||||
= fx_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
next = fx_queue_next(entry);
|
||||
fx_queue_delete(&state->s_args, entry);
|
||||
|
||||
b_queue_push_back(&msg->n_arg, &arg->n_entry);
|
||||
fx_queue_push_back(&msg->n_arg, &arg->n_entry);
|
||||
entry = next;
|
||||
}
|
||||
|
||||
@@ -988,26 +988,26 @@ static struct ivy_ast_msg_node *expr_finalise_complex_msg(
|
||||
|
||||
state->s_msg = NULL;
|
||||
|
||||
b_queue_entry *entry = b_queue_first(&state->s_labels);
|
||||
b_queue_entry *next = NULL;
|
||||
fx_queue_entry *entry = fx_queue_first(&state->s_labels);
|
||||
fx_queue_entry *next = NULL;
|
||||
while (entry) {
|
||||
struct ivy_token *label
|
||||
= b_unbox(struct ivy_token, entry, t_entry);
|
||||
next = b_queue_next(entry);
|
||||
b_queue_delete(&state->s_labels, entry);
|
||||
b_queue_push_back(&msg->n_sel->n_arg_labels, &label->t_entry);
|
||||
= fx_unbox(struct ivy_token, entry, t_entry);
|
||||
next = fx_queue_next(entry);
|
||||
fx_queue_delete(&state->s_labels, entry);
|
||||
fx_queue_push_back(&msg->n_sel->n_arg_labels, &label->t_entry);
|
||||
|
||||
entry = next;
|
||||
}
|
||||
|
||||
entry = b_queue_first(&state->s_args);
|
||||
entry = fx_queue_first(&state->s_args);
|
||||
while (entry) {
|
||||
struct ivy_ast_node *arg
|
||||
= b_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
next = b_queue_next(entry);
|
||||
b_queue_delete(&state->s_args, entry);
|
||||
= fx_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
next = fx_queue_next(entry);
|
||||
fx_queue_delete(&state->s_args, entry);
|
||||
|
||||
b_queue_push_back(&msg->n_arg, &arg->n_entry);
|
||||
fx_queue_push_back(&msg->n_arg, &arg->n_entry);
|
||||
|
||||
entry = next;
|
||||
}
|
||||
@@ -1032,9 +1032,9 @@ static enum ivy_status begin_cascade_operation(struct ivy_parser *ctx)
|
||||
enum ivy_operator_precedence min_precedence
|
||||
= IVY_PRECEDENCE_CASCADE;
|
||||
|
||||
struct ivy_ast_node *prev = b_unbox(
|
||||
struct ivy_ast_node *prev = fx_unbox(
|
||||
struct ivy_ast_node,
|
||||
b_queue_last(&state->s_operator_stack), n_entry);
|
||||
fx_queue_last(&state->s_operator_stack), n_entry);
|
||||
if (prev && prev->n_type == IVY_AST_MSG) {
|
||||
/* unary complex messages (which will be found on the
|
||||
* operator stack) have a very high precedence (much
|
||||
@@ -1079,7 +1079,7 @@ static enum ivy_status begin_cascade_operation(struct ivy_parser *ctx)
|
||||
cascade_expr->s_type = EXPR_TYPE_ARITH;
|
||||
cascade_expr->s_subexpr_depth = state->s_subexpr_depth + 1;
|
||||
|
||||
b_queue_push_back(&cascade_expr->s_cascade_msg, &first_msg->n_base.n_entry);
|
||||
fx_queue_push_back(&cascade_expr->s_cascade_msg, &first_msg->n_base.n_entry);
|
||||
|
||||
struct expr_parser_state *msg_expr
|
||||
= (struct expr_parser_state *)parser_push_state(
|
||||
@@ -1338,8 +1338,8 @@ struct token_parse_result arith_parse_caret(
|
||||
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
||||
}
|
||||
|
||||
if (!b_queue_empty(&state->s_operator_stack)
|
||||
|| !b_queue_empty(&state->s_output_queue)) {
|
||||
if (!fx_queue_empty(&state->s_operator_stack)
|
||||
|| !fx_queue_empty(&state->s_output_queue)) {
|
||||
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
||||
}
|
||||
|
||||
@@ -1388,8 +1388,8 @@ struct token_parse_result arith_parse_comma(
|
||||
}
|
||||
|
||||
if (state->s_sub_type == EXPR_SUBTYPE_PAREN
|
||||
&& b_queue_empty(&state->s_output_queue)
|
||||
&& b_queue_empty(&state->s_operator_stack)) {
|
||||
&& fx_queue_empty(&state->s_output_queue)
|
||||
&& fx_queue_empty(&state->s_operator_stack)) {
|
||||
parser_pop_state(ctx, 0);
|
||||
} else {
|
||||
/* the tuple parser will handle the parentheses for us. */
|
||||
@@ -1452,8 +1452,8 @@ struct token_parse_result arith_parse_label(
|
||||
struct expr_parser_state *msg_expr;
|
||||
bool new_parser = true;
|
||||
|
||||
if (b_queue_empty(&state->s_operator_stack)
|
||||
&& b_queue_empty(&state->s_output_queue)) {
|
||||
if (fx_queue_empty(&state->s_operator_stack)
|
||||
&& fx_queue_empty(&state->s_output_queue)) {
|
||||
new_parser = false;
|
||||
}
|
||||
|
||||
@@ -1498,7 +1498,7 @@ struct token_parse_result arith_parse_label(
|
||||
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
||||
}
|
||||
|
||||
b_queue_push_back(&state->s_labels, &tok->t_entry);
|
||||
fx_queue_push_back(&state->s_labels, &tok->t_entry);
|
||||
|
||||
struct expr_parser_state *arg_expr
|
||||
= (struct expr_parser_state *)parser_push_state(
|
||||
@@ -1511,7 +1511,7 @@ struct token_parse_result arith_parse_label(
|
||||
/* we may have just finished parsing a keyword-message argument,
|
||||
* and this label marks the start of a new one. store the label
|
||||
* and create a new argument parsing context. */
|
||||
b_queue_push_back(&state->s_labels, &tok->t_entry);
|
||||
fx_queue_push_back(&state->s_labels, &tok->t_entry);
|
||||
|
||||
struct expr_parser_state *arg_expr
|
||||
= (struct expr_parser_state *)parser_push_state(
|
||||
@@ -1532,16 +1532,16 @@ enum ivy_status arith_add_child(
|
||||
|
||||
if (state->s_sub_type == EXPR_SUBTYPE_CASCADE) {
|
||||
/* treat the child node as a cascaded message */
|
||||
b_queue_push_back(&state->s_cascade_msg, &child->n_entry);
|
||||
fx_queue_push_back(&state->s_cascade_msg, &child->n_entry);
|
||||
} else if (
|
||||
state->s_sub_type == EXPR_SUBTYPE_KEYWORD_MSG
|
||||
|| state->s_sub_type == EXPR_SUBTYPE_COMPLEX_MSG) {
|
||||
/* treat the child node as a keyword-message argument */
|
||||
b_queue_push_back(&state->s_args, &child->n_entry);
|
||||
fx_queue_push_back(&state->s_args, &child->n_entry);
|
||||
} else if (state->s_sub_type == EXPR_SUBTYPE_KEYWORD_ARG) {
|
||||
/* treat the child node as a sub-expression enclosed in
|
||||
* parentheses (i.e. an operand). */
|
||||
b_queue_push_back(&state->s_output_queue, &child->n_entry);
|
||||
fx_queue_push_back(&state->s_output_queue, &child->n_entry);
|
||||
state->s_prev_component = EXPR_CMP_OPERAND;
|
||||
} else if (child->n_type == IVY_AST_MSG) {
|
||||
arith_push_operator(state, child);
|
||||
@@ -1549,7 +1549,7 @@ enum ivy_status arith_add_child(
|
||||
} else {
|
||||
/* treat the child node as a sub-expression enclosed in
|
||||
* parentheses (i.e. an operand). */
|
||||
b_queue_push_back(&state->s_output_queue, &child->n_entry);
|
||||
fx_queue_push_back(&state->s_output_queue, &child->n_entry);
|
||||
state->s_prev_component = EXPR_CMP_OPERAND;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "../ctx.h"
|
||||
#include "../node.h"
|
||||
|
||||
#include <blue/core/queue.h>
|
||||
#include <fx/core/queue.h>
|
||||
|
||||
#define EXPR_TERMINATOR_MAX 8
|
||||
|
||||
@@ -76,19 +76,19 @@ struct expr_parser_state {
|
||||
unsigned short s_terminators[EXPR_TERMINATOR_MAX];
|
||||
unsigned short s_nr_terminators;
|
||||
|
||||
b_queue s_output_queue;
|
||||
b_queue s_operator_stack;
|
||||
fx_queue s_output_queue;
|
||||
fx_queue s_operator_stack;
|
||||
|
||||
/* these variables are for keyword-message expressions */
|
||||
struct ivy_ast_node *s_recipient;
|
||||
struct ivy_ast_msg_node *s_msg;
|
||||
b_queue s_labels;
|
||||
fx_queue s_labels;
|
||||
|
||||
union {
|
||||
/* for keyword-messages, this is a list of arg values. */
|
||||
b_queue s_args;
|
||||
fx_queue s_args;
|
||||
/* for cascade operators, this is a list of messages to send to the recipient. */
|
||||
b_queue s_cascade_msg;
|
||||
fx_queue s_cascade_msg;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "../node.h"
|
||||
#include "expr.h"
|
||||
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/string.h>
|
||||
#include <ivy/lang/lex.h>
|
||||
#include <ivy/lang/operator.h>
|
||||
#include <stdio.h>
|
||||
@@ -27,8 +27,8 @@ struct token_parse_result stmt_parse_try(
|
||||
|
||||
state->s_prev_token = IVY_KW_TRY;
|
||||
|
||||
if (b_queue_empty(&state->s_operator_stack)
|
||||
&& b_queue_empty(&state->s_output_queue)) {
|
||||
if (fx_queue_empty(&state->s_operator_stack)
|
||||
&& fx_queue_empty(&state->s_output_queue)) {
|
||||
parser_pop_state(ctx, 0);
|
||||
}
|
||||
|
||||
@@ -71,8 +71,8 @@ struct token_parse_result stmt_parse_for(
|
||||
|
||||
state->s_prev_token = IVY_KW_FOR;
|
||||
|
||||
if (b_queue_empty(&state->s_operator_stack)
|
||||
&& b_queue_empty(&state->s_output_queue)) {
|
||||
if (fx_queue_empty(&state->s_operator_stack)
|
||||
&& fx_queue_empty(&state->s_output_queue)) {
|
||||
parser_pop_state(ctx, 0);
|
||||
}
|
||||
|
||||
@@ -107,8 +107,8 @@ struct token_parse_result stmt_parse_while(
|
||||
|
||||
state->s_prev_token = IVY_KW_WHILE;
|
||||
|
||||
if (b_queue_empty(&state->s_operator_stack)
|
||||
&& b_queue_empty(&state->s_output_queue)) {
|
||||
if (fx_queue_empty(&state->s_operator_stack)
|
||||
&& fx_queue_empty(&state->s_output_queue)) {
|
||||
parser_pop_state(ctx, 0);
|
||||
}
|
||||
|
||||
@@ -140,8 +140,8 @@ struct token_parse_result stmt_parse_match(
|
||||
|
||||
state->s_prev_token = IVY_KW_MATCH;
|
||||
|
||||
if (b_queue_empty(&state->s_operator_stack)
|
||||
&& b_queue_empty(&state->s_output_queue)) {
|
||||
if (fx_queue_empty(&state->s_operator_stack)
|
||||
&& fx_queue_empty(&state->s_output_queue)) {
|
||||
parser_pop_state(ctx, 0);
|
||||
}
|
||||
|
||||
@@ -186,8 +186,8 @@ struct token_parse_result stmt_parse_if(
|
||||
|
||||
state->s_prev_token = IVY_KW_IF;
|
||||
|
||||
if (b_queue_empty(&state->s_operator_stack)
|
||||
&& b_queue_empty(&state->s_output_queue)) {
|
||||
if (fx_queue_empty(&state->s_operator_stack)
|
||||
&& fx_queue_empty(&state->s_output_queue)) {
|
||||
parser_pop_state(ctx, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#include "ctx.h"
|
||||
#include "node.h"
|
||||
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/string.h>
|
||||
|
||||
static void to_string(struct ivy_ast_node *node, b_string *str)
|
||||
static void to_string(struct ivy_ast_node *node, fx_string *str)
|
||||
{
|
||||
struct ivy_ast_ident_node *ident = (struct ivy_ast_ident_node *)node;
|
||||
|
||||
b_string_append_cstrf(
|
||||
fx_string_append_cstrf(
|
||||
str, "%s (%s)", ivy_ast_node_type_to_string(node->n_type),
|
||||
ident->n_content->t_str);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
#include "ctx.h"
|
||||
#include "node.h"
|
||||
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/string.h>
|
||||
|
||||
static void to_string(struct ivy_ast_node *node, b_string *str)
|
||||
static void to_string(struct ivy_ast_node *node, fx_string *str)
|
||||
{
|
||||
struct ivy_ast_int_node *v = (struct ivy_ast_int_node *)node;
|
||||
|
||||
b_string_append_cstrf(
|
||||
fx_string_append_cstrf(
|
||||
str, "%s (%llu)", ivy_ast_node_type_to_string(node->n_type),
|
||||
v->n_value->t_int);
|
||||
}
|
||||
|
||||
@@ -7,14 +7,14 @@ enum ivy_status iterate_regular(
|
||||
ivy_ast_node_iteration_callback callback)
|
||||
{
|
||||
#if 0
|
||||
b_queue_push_back(&it->it_queue, &node->n_it.it_entry);
|
||||
fx_queue_push_back(&it->it_queue, &node->n_it.it_entry);
|
||||
node->n_it.it_depth = 0;
|
||||
|
||||
while (!b_queue_empty(&it->it_queue)) {
|
||||
b_queue_entry *entry = b_queue_first(&it->it_queue);
|
||||
struct ivy_ast_node_iterator_entry *it_entry = b_unbox(
|
||||
while (!fx_queue_empty(&it->it_queue)) {
|
||||
fx_queue_entry *entry = fx_queue_first(&it->it_queue);
|
||||
struct ivy_ast_node_iterator_entry *it_entry = fx_unbox(
|
||||
struct ivy_ast_node_iterator_entry, entry, it_entry);
|
||||
node = b_unbox(struct ivy_ast_node, it_entry, n_it);
|
||||
node = fx_unbox(struct ivy_ast_node, it_entry, n_it);
|
||||
|
||||
if (!node) {
|
||||
/* this should never happen. */
|
||||
@@ -32,7 +32,7 @@ enum ivy_status iterate_regular(
|
||||
type->n_collect_children(node, it);
|
||||
}
|
||||
|
||||
b_queue_delete(&it->it_queue, entry);
|
||||
fx_queue_delete(&it->it_queue, entry);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -60,15 +60,15 @@ enum ivy_status iterate_postorder(
|
||||
* - should probably use this just for the executable parts of the AST,
|
||||
* not for nodes defining classes, function metadata, etc.
|
||||
*/
|
||||
b_queue_push_back(&it->it_queue, &node->n_it.it_entry);
|
||||
fx_queue_push_back(&it->it_queue, &node->n_it.it_entry);
|
||||
node->n_it.it_depth = 0;
|
||||
|
||||
b_queue_entry *entry = b_queue_first(&it->it_queue);
|
||||
fx_queue_entry *entry = fx_queue_first(&it->it_queue);
|
||||
|
||||
while (entry) {
|
||||
struct ivy_ast_node_iterator_entry *it_entry = b_unbox(
|
||||
struct ivy_ast_node_iterator_entry *it_entry = fx_unbox(
|
||||
struct ivy_ast_node_iterator_entry, entry, it_entry);
|
||||
node = b_unbox(struct ivy_ast_node, it_entry, n_it);
|
||||
node = fx_unbox(struct ivy_ast_node, it_entry, n_it);
|
||||
|
||||
if (!node) {
|
||||
/* this should never happen. */
|
||||
@@ -81,16 +81,16 @@ enum ivy_status iterate_postorder(
|
||||
type->n_collect_children(node, it);
|
||||
}
|
||||
|
||||
entry = b_queue_next(entry);
|
||||
entry = fx_queue_next(entry);
|
||||
}
|
||||
|
||||
while (!b_queue_empty(&it->it_queue)) {
|
||||
b_queue_entry *entry = b_queue_pop_back(&it->it_queue);
|
||||
while (!fx_queue_empty(&it->it_queue)) {
|
||||
fx_queue_entry *entry = fx_queue_pop_back(&it->it_queue);
|
||||
if (!entry) {
|
||||
break;
|
||||
}
|
||||
|
||||
node = b_unbox(struct ivy_ast_node, entry, n_it);
|
||||
node = fx_unbox(struct ivy_ast_node, entry, n_it);
|
||||
|
||||
if (!node) {
|
||||
/* this should never happen. */
|
||||
@@ -107,15 +107,15 @@ enum ivy_status ivy_ast_node_iterate(
|
||||
struct ivy_ast_node *node, struct ivy_ast_node_iterator *it,
|
||||
ivy_ast_node_iteration_callback callback, void *arg)
|
||||
{
|
||||
b_queue_push_back(&it->it_queue, &node->n_it.it_entry);
|
||||
fx_queue_push_back(&it->it_queue, &node->n_it.it_entry);
|
||||
node->n_it.it_depth = 0;
|
||||
|
||||
b_queue_entry *entry = b_queue_first(&it->it_queue);
|
||||
fx_queue_entry *entry = fx_queue_first(&it->it_queue);
|
||||
|
||||
while (entry) {
|
||||
struct ivy_ast_node_iterator_entry *it_entry = b_unbox(
|
||||
struct ivy_ast_node_iterator_entry *it_entry = fx_unbox(
|
||||
struct ivy_ast_node_iterator_entry, entry, it_entry);
|
||||
node = b_unbox(struct ivy_ast_node, it_entry, n_it);
|
||||
node = fx_unbox(struct ivy_ast_node, it_entry, n_it);
|
||||
|
||||
if (!node) {
|
||||
/* this should never happen. */
|
||||
@@ -134,16 +134,16 @@ enum ivy_status ivy_ast_node_iterate(
|
||||
type->n_collect_children(node, it);
|
||||
}
|
||||
|
||||
entry = b_queue_next(entry);
|
||||
entry = fx_queue_next(entry);
|
||||
}
|
||||
|
||||
while (!b_queue_empty(&it->it_queue)) {
|
||||
b_queue_entry *entry = b_queue_pop_back(&it->it_queue);
|
||||
while (!fx_queue_empty(&it->it_queue)) {
|
||||
fx_queue_entry *entry = fx_queue_pop_back(&it->it_queue);
|
||||
if (!entry) {
|
||||
break;
|
||||
}
|
||||
|
||||
node = b_unbox(struct ivy_ast_node, entry, n_it);
|
||||
node = fx_unbox(struct ivy_ast_node, entry, n_it);
|
||||
|
||||
if (!node) {
|
||||
/* this should never happen. */
|
||||
@@ -165,10 +165,10 @@ void ast_node_iterator_enqueue_node(
|
||||
struct ivy_ast_node *node)
|
||||
{
|
||||
if (it->it_insert_after) {
|
||||
b_queue_insert_after(
|
||||
fx_queue_insert_after(
|
||||
&it->it_queue, &node->n_it.it_entry, it->it_insert_after);
|
||||
} else {
|
||||
b_queue_push_back(&it->it_queue, &node->n_it.it_entry);
|
||||
fx_queue_push_back(&it->it_queue, &node->n_it.it_entry);
|
||||
}
|
||||
|
||||
node->n_it.it_depth = parent->n_it.it_depth + 1;
|
||||
|
||||
@@ -11,7 +11,7 @@ struct lambda_parser_state {
|
||||
struct ivy_ast_node *s_prev_node;
|
||||
unsigned int s_prev;
|
||||
|
||||
b_queue s_args;
|
||||
fx_queue s_args;
|
||||
struct ivy_ast_node *s_body;
|
||||
};
|
||||
|
||||
@@ -56,7 +56,7 @@ static struct token_parse_result parse_ident(
|
||||
}
|
||||
|
||||
arg->n_content = tok;
|
||||
b_queue_push_back(&state->s_args, &arg->n_base.n_entry);
|
||||
fx_queue_push_back(&state->s_args, &arg->n_base.n_entry);
|
||||
state->s_prev = IVY_TOK_IDENT;
|
||||
|
||||
return PARSE_RESULT(IVY_OK, 0);
|
||||
@@ -101,7 +101,7 @@ static void finalise_lambda(struct lambda_parser_state *state)
|
||||
lambda->n_arg = state->s_args;
|
||||
lambda->n_body = state->s_body;
|
||||
|
||||
state->s_args = B_QUEUE_INIT;
|
||||
state->s_args = FX_QUEUE_INIT;
|
||||
state->s_body = NULL;
|
||||
}
|
||||
|
||||
@@ -147,12 +147,12 @@ static void collect_children(
|
||||
struct ivy_ast_node *node, struct ivy_ast_node_iterator *iterator)
|
||||
{
|
||||
struct ivy_ast_lambda_node *lambda = (struct ivy_ast_lambda_node *)node;
|
||||
b_queue_entry *entry = b_queue_first(&lambda->n_arg);
|
||||
fx_queue_entry *entry = fx_queue_first(&lambda->n_arg);
|
||||
while (entry) {
|
||||
struct ivy_ast_node *expr
|
||||
= b_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
= fx_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
ast_node_iterator_enqueue_node(iterator, node, expr);
|
||||
entry = b_queue_next(entry);
|
||||
entry = fx_queue_next(entry);
|
||||
}
|
||||
|
||||
if (lambda->n_body) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#include "ctx.h"
|
||||
#include "node.h"
|
||||
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/string.h>
|
||||
|
||||
static void to_string(struct ivy_ast_node *node, b_string *str)
|
||||
static void to_string(struct ivy_ast_node *node, fx_string *str)
|
||||
{
|
||||
b_string_append_cstrf(str, "%s", ivy_ast_node_type_to_string(node->n_type));
|
||||
fx_string_append_cstrf(str, "%s", ivy_ast_node_type_to_string(node->n_type));
|
||||
}
|
||||
|
||||
struct ast_node_type loop_break_node_ops = {
|
||||
|
||||
@@ -9,7 +9,7 @@ struct match_parser_state {
|
||||
struct ivy_ast_node *s_cond;
|
||||
|
||||
struct ivy_ast_cond_node *s_cur_branch;
|
||||
b_queue s_branches;
|
||||
fx_queue s_branches;
|
||||
|
||||
struct ivy_ast_node *s_prev_node;
|
||||
};
|
||||
@@ -52,7 +52,7 @@ static enum ivy_status flush_current_branch(struct match_parser_state *state)
|
||||
return IVY_ERR_INTERNAL_FAILURE;
|
||||
}
|
||||
|
||||
b_queue_push_back(&state->s_branches, &state->s_cur_branch->n_base.n_entry);
|
||||
fx_queue_push_back(&state->s_branches, &state->s_cur_branch->n_base.n_entry);
|
||||
|
||||
state->s_cur_branch
|
||||
= (struct ivy_ast_cond_node *)ast_node_create(IVY_AST_COND);
|
||||
@@ -107,7 +107,7 @@ static enum ivy_status finalise_match(struct match_parser_state *state)
|
||||
|
||||
match->n_cond = state->s_cond;
|
||||
match->n_branches = state->s_branches;
|
||||
state->s_branches = B_QUEUE_INIT;
|
||||
state->s_branches = FX_QUEUE_INIT;
|
||||
return IVY_OK;
|
||||
}
|
||||
|
||||
@@ -262,10 +262,10 @@ static void match_collect_children(
|
||||
|
||||
ast_node_iterator_enqueue_node(iterator, node, match->n_cond);
|
||||
|
||||
b_queue_entry *entry = b_queue_first(&match->n_branches);
|
||||
fx_queue_entry *entry = fx_queue_first(&match->n_branches);
|
||||
while (entry) {
|
||||
struct ivy_ast_node *branch
|
||||
= b_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
= fx_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
ast_node_iterator_enqueue_node(iterator, node, branch);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,12 +16,12 @@ static void collect_children(
|
||||
iterator, node, (struct ivy_ast_node *)msg->n_sel);
|
||||
}
|
||||
|
||||
b_queue_entry *entry = b_queue_first(&msg->n_arg);
|
||||
fx_queue_entry *entry = fx_queue_first(&msg->n_arg);
|
||||
while (entry) {
|
||||
struct ivy_ast_node *arg
|
||||
= b_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
= fx_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
ast_node_iterator_enqueue_node(iterator, node, arg);
|
||||
entry = b_queue_next(entry);
|
||||
entry = fx_queue_next(entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "ivy/status.h"
|
||||
#include "node.h"
|
||||
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/string.h>
|
||||
#include <ivy/lang/lex.h>
|
||||
|
||||
struct msgh_parser_state {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "node.h"
|
||||
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/string.h>
|
||||
#include <ivy/lang/ast.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -250,7 +250,7 @@ struct ivy_ast_node *ast_node_create(enum ivy_ast_node_type type)
|
||||
return node;
|
||||
}
|
||||
|
||||
void ivy_ast_node_to_string(struct ivy_ast_node *node, b_string *out)
|
||||
void ivy_ast_node_to_string(struct ivy_ast_node *node, fx_string *out)
|
||||
{
|
||||
const struct ast_node_type *type_info = get_ast_node_type(node->n_type);
|
||||
if (!type_info) {
|
||||
@@ -260,7 +260,7 @@ void ivy_ast_node_to_string(struct ivy_ast_node *node, b_string *out)
|
||||
if (type_info->n_to_string) {
|
||||
type_info->n_to_string(node, out);
|
||||
} else {
|
||||
b_string_append_cstr(
|
||||
fx_string_append_cstr(
|
||||
out, ivy_ast_node_type_to_string(node->n_type));
|
||||
}
|
||||
}
|
||||
@@ -301,15 +301,15 @@ void ivy_ast_node_extend_bounds_recursive(
|
||||
void ivy_ast_node_destroy(struct ivy_ast_node *node)
|
||||
{
|
||||
struct ivy_ast_node_iterator it = {};
|
||||
b_queue_push_back(&it.it_queue, &node->n_it.it_entry);
|
||||
fx_queue_push_back(&it.it_queue, &node->n_it.it_entry);
|
||||
node->n_it.it_depth = 0;
|
||||
|
||||
b_queue_entry *entry = b_queue_first(&it.it_queue);
|
||||
fx_queue_entry *entry = fx_queue_first(&it.it_queue);
|
||||
|
||||
while (entry) {
|
||||
struct ivy_ast_node_iterator_entry *it_entry = b_unbox(
|
||||
struct ivy_ast_node_iterator_entry *it_entry = fx_unbox(
|
||||
struct ivy_ast_node_iterator_entry, entry, it_entry);
|
||||
node = b_unbox(struct ivy_ast_node, it_entry, n_it);
|
||||
node = fx_unbox(struct ivy_ast_node, it_entry, n_it);
|
||||
|
||||
if (!node) {
|
||||
/* this should never happen. */
|
||||
@@ -322,16 +322,16 @@ void ivy_ast_node_destroy(struct ivy_ast_node *node)
|
||||
type->n_collect_children(node, &it);
|
||||
}
|
||||
|
||||
entry = b_queue_next(entry);
|
||||
entry = fx_queue_next(entry);
|
||||
}
|
||||
|
||||
while (!b_queue_empty(&it.it_queue)) {
|
||||
b_queue_entry *entry = b_queue_pop_back(&it.it_queue);
|
||||
while (!fx_queue_empty(&it.it_queue)) {
|
||||
fx_queue_entry *entry = fx_queue_pop_back(&it.it_queue);
|
||||
if (!entry) {
|
||||
break;
|
||||
}
|
||||
|
||||
node = b_unbox(struct ivy_ast_node, entry, n_it);
|
||||
node = fx_unbox(struct ivy_ast_node, entry, n_it);
|
||||
|
||||
const struct ast_node_type *type = get_ast_node_type(node->n_type);
|
||||
if (type && type->n_destroy) {
|
||||
@@ -397,15 +397,15 @@ const char *ivy_ast_node_type_to_string(enum ivy_ast_node_type v)
|
||||
|
||||
void ivy_ast_unit_add_node(struct ivy_ast_unit_node *unit, struct ivy_ast_node *child)
|
||||
{
|
||||
b_queue_push_back(&unit->n_children, &child->n_entry);
|
||||
fx_queue_push_back(&unit->n_children, &child->n_entry);
|
||||
}
|
||||
|
||||
struct ivy_ast_node *ivy_ast_unit_dequeue_node(struct ivy_ast_unit_node *unit)
|
||||
{
|
||||
b_queue_entry *entry = b_queue_pop_front(&unit->n_children);
|
||||
fx_queue_entry *entry = fx_queue_pop_front(&unit->n_children);
|
||||
if (!entry) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return b_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
return fx_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef _AST_NODE_H_
|
||||
#define _AST_NODE_H_
|
||||
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/string.h>
|
||||
#include <ivy/lang/ast.h>
|
||||
#include <ivy/lang/lex.h>
|
||||
|
||||
@@ -47,7 +47,7 @@ typedef struct token_parse_result (*token_parse_function)(
|
||||
struct ast_node_type {
|
||||
enum ivy_status (*n_add_child)(
|
||||
struct parser_state *, struct ivy_ast_node *);
|
||||
void (*n_to_string)(struct ivy_ast_node *, b_string *);
|
||||
void (*n_to_string)(struct ivy_ast_node *, fx_string *);
|
||||
void (*n_init_state)(struct ivy_parser *, struct parser_state *, uintptr_t);
|
||||
void (*n_collect_children)(
|
||||
struct ivy_ast_node *, struct ivy_ast_node_iterator *);
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
#include "iterate.h"
|
||||
#include "node.h"
|
||||
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/string.h>
|
||||
|
||||
static void to_string(struct ivy_ast_node *node, b_string *str)
|
||||
static void to_string(struct ivy_ast_node *node, fx_string *str)
|
||||
{
|
||||
struct ivy_ast_op_node *op = (struct ivy_ast_op_node *)node;
|
||||
|
||||
b_string_append_cstrf(
|
||||
fx_string_append_cstrf(
|
||||
str, "%s (%s)", ivy_ast_node_type_to_string(node->n_type),
|
||||
ivy_operator_id_to_string(op->n_op->op_id));
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "iterate.h"
|
||||
#include "node.h"
|
||||
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/string.h>
|
||||
#include <ivy/lang/lex.h>
|
||||
|
||||
enum package_type {
|
||||
@@ -23,7 +23,7 @@ struct package_parser_state {
|
||||
unsigned int s_prev;
|
||||
|
||||
/* only used for PACKAGE_STATIC */
|
||||
b_queue s_items;
|
||||
fx_queue s_items;
|
||||
struct ivy_ast_node *s_next_index;
|
||||
unsigned int s_next_implicit_index;
|
||||
|
||||
@@ -53,7 +53,7 @@ static enum ivy_status add_package_item(
|
||||
item->n_implicit_index = state->s_next_implicit_index++;
|
||||
}
|
||||
|
||||
b_queue_push_back(&state->s_items, &item->n_base.n_entry);
|
||||
fx_queue_push_back(&state->s_items, &item->n_base.n_entry);
|
||||
|
||||
state->s_next_index = NULL;
|
||||
state->s_prev_node = NULL;
|
||||
@@ -76,7 +76,7 @@ static struct ivy_ast_node *finalise_package(struct package_parser_state *state)
|
||||
}
|
||||
|
||||
s->n_items = state->s_items;
|
||||
state->s_items = B_QUEUE_INIT;
|
||||
state->s_items = FX_QUEUE_INIT;
|
||||
return (struct ivy_ast_node *)s;
|
||||
case PACKAGE_DYNAMIC:
|
||||
d = (struct ivy_ast_pkg_dynamic_node *)ast_node_create(
|
||||
@@ -374,24 +374,24 @@ static void pkg_static_collect_children(
|
||||
struct ivy_ast_pkg_static_node *pkg
|
||||
= (struct ivy_ast_pkg_static_node *)node;
|
||||
|
||||
b_queue_entry *entry = b_queue_first(&pkg->n_items);
|
||||
fx_queue_entry *entry = fx_queue_first(&pkg->n_items);
|
||||
while (entry) {
|
||||
struct ivy_ast_node *item
|
||||
= b_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
= fx_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
ast_node_iterator_enqueue_node(iterator, node, item);
|
||||
entry = b_queue_next(entry);
|
||||
entry = fx_queue_next(entry);
|
||||
}
|
||||
}
|
||||
|
||||
static void pkg_static_item_to_string(struct ivy_ast_node *node, b_string *str)
|
||||
static void pkg_static_item_to_string(struct ivy_ast_node *node, fx_string *str)
|
||||
{
|
||||
struct ivy_ast_pkg_static_item_node *item
|
||||
= (struct ivy_ast_pkg_static_item_node *)node;
|
||||
|
||||
b_string_append_cstr(str, ivy_ast_node_type_to_string(node->n_type));
|
||||
fx_string_append_cstr(str, ivy_ast_node_type_to_string(node->n_type));
|
||||
|
||||
if (!item->n_index) {
|
||||
b_string_append_cstrf(str, " (%u)", item->n_implicit_index);
|
||||
fx_string_append_cstrf(str, " (%u)", item->n_implicit_index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "ivy/status.h"
|
||||
#include "node.h"
|
||||
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/string.h>
|
||||
#include <ivy/lang/lex.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -371,28 +371,28 @@ static void collect_children(
|
||||
}
|
||||
}
|
||||
|
||||
static void to_string(struct ivy_ast_node *node, b_string *str)
|
||||
static void to_string(struct ivy_ast_node *node, fx_string *str)
|
||||
{
|
||||
struct ivy_ast_property_node *prop = (struct ivy_ast_property_node *)node;
|
||||
|
||||
b_string_append_cstrf(
|
||||
fx_string_append_cstrf(
|
||||
str, "%s (%s) [", ivy_ast_node_type_to_string(node->n_type),
|
||||
prop->n_ident->t_str);
|
||||
|
||||
if (prop->n_flags & IVY_AST_PROPERTY_GET) {
|
||||
b_string_append_cstr(str, "get");
|
||||
fx_string_append_cstr(str, "get");
|
||||
}
|
||||
|
||||
if ((prop->n_flags & IVY_AST_PROPERTY_GET)
|
||||
&& prop->n_flags & IVY_AST_PROPERTY_SET) {
|
||||
b_string_append_cstr(str, ", ");
|
||||
fx_string_append_cstr(str, ", ");
|
||||
}
|
||||
|
||||
if (prop->n_flags & IVY_AST_PROPERTY_SET) {
|
||||
b_string_append_cstr(str, "set");
|
||||
fx_string_append_cstr(str, "set");
|
||||
}
|
||||
|
||||
b_string_append_cstr(str, "]");
|
||||
fx_string_append_cstr(str, "]");
|
||||
}
|
||||
|
||||
struct ast_node_type property_node_ops = {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "ivy/status.h"
|
||||
#include "node.h"
|
||||
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/string.h>
|
||||
#include <ivy/lang/lex.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -75,7 +75,7 @@ static struct token_parse_result parse_ident(
|
||||
|
||||
if (state->s_prev == IVY_TOK_LABEL) {
|
||||
/* internal parameter name */
|
||||
b_queue_push_back(&sel->n_arg_names, &tok->t_entry);
|
||||
fx_queue_push_back(&sel->n_arg_names, &tok->t_entry);
|
||||
state->s_prev = IVY_TOK_IDENT;
|
||||
state->s_complete = true;
|
||||
return PARSE_RESULT(IVY_OK, 0);
|
||||
@@ -101,7 +101,7 @@ static struct token_parse_result parse_label(
|
||||
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
||||
}
|
||||
|
||||
b_queue_push_back(&sel->n_arg_labels, &tok->t_entry);
|
||||
fx_queue_push_back(&sel->n_arg_labels, &tok->t_entry);
|
||||
state->s_prev = IVY_TOK_LABEL;
|
||||
state->s_complete = false;
|
||||
|
||||
@@ -119,7 +119,7 @@ static struct token_parse_result parse_linefeed(
|
||||
|
||||
CHECK_SELECTOR_COMPLETE();
|
||||
|
||||
if (!b_queue_empty(&sel->n_arg_labels)
|
||||
if (!fx_queue_empty(&sel->n_arg_labels)
|
||||
&& state->s_prev != IVY_SYM_RIGHT_PAREN) {
|
||||
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
||||
}
|
||||
@@ -142,7 +142,7 @@ static struct token_parse_result parse_left_paren(
|
||||
struct ivy_ast_selector_node *sel
|
||||
= (struct ivy_ast_selector_node *)state->s_base.s_node;
|
||||
|
||||
if (state->s_prev != IVY_TOK_IDENT || !b_queue_empty(&sel->n_arg_labels)) {
|
||||
if (state->s_prev != IVY_TOK_IDENT || !fx_queue_empty(&sel->n_arg_labels)) {
|
||||
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ static struct token_parse_result parse_right_paren(
|
||||
struct ivy_ast_selector_node *sel
|
||||
= (struct ivy_ast_selector_node *)state->s_base.s_node;
|
||||
|
||||
if (state->s_prev != IVY_TOK_IDENT || b_queue_empty(&sel->n_arg_labels)) {
|
||||
if (state->s_prev != IVY_TOK_IDENT || fx_queue_empty(&sel->n_arg_labels)) {
|
||||
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
||||
}
|
||||
|
||||
@@ -181,8 +181,8 @@ static struct token_parse_result parse_pipe(
|
||||
switch (state->s_prev) {
|
||||
case IVY_SYM_RIGHT_PAREN:
|
||||
/* this looks like a complex message selector */
|
||||
if (b_queue_empty(&sel->n_arg_labels)
|
||||
|| b_queue_empty(&sel->n_arg_names)) {
|
||||
if (fx_queue_empty(&sel->n_arg_labels)
|
||||
|| fx_queue_empty(&sel->n_arg_names)) {
|
||||
/* no message args */
|
||||
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
||||
}
|
||||
@@ -194,8 +194,8 @@ static struct token_parse_result parse_pipe(
|
||||
break;
|
||||
case IVY_TOK_IDENT:
|
||||
/* this looks like a unary or keyword message. */
|
||||
if (!b_queue_empty(&sel->n_arg_labels)
|
||||
&& b_queue_empty(&sel->n_arg_names)) {
|
||||
if (!fx_queue_empty(&sel->n_arg_labels)
|
||||
&& fx_queue_empty(&sel->n_arg_names)) {
|
||||
/* keyword message with no arg names. */
|
||||
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
||||
}
|
||||
@@ -223,19 +223,19 @@ static struct token_parse_result parse_other(
|
||||
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
||||
}
|
||||
|
||||
static void to_string(struct ivy_ast_node *node, b_string *str)
|
||||
static void to_string(struct ivy_ast_node *node, fx_string *str)
|
||||
{
|
||||
struct ivy_ast_selector_node *sel = (struct ivy_ast_selector_node *)node;
|
||||
|
||||
b_string_append_cstrf(
|
||||
fx_string_append_cstrf(
|
||||
str, "%s [", ivy_ast_node_type_to_string(node->n_type));
|
||||
|
||||
switch (sel->n_recipient) {
|
||||
case IVY_SELECTOR_RECIPIENT_CLASS:
|
||||
b_string_append_cstr(str, "+");
|
||||
fx_string_append_cstr(str, "+");
|
||||
break;
|
||||
case IVY_SELECTOR_RECIPIENT_OBJECT:
|
||||
b_string_append_cstr(str, "-");
|
||||
fx_string_append_cstr(str, "-");
|
||||
break;
|
||||
default:
|
||||
/* this will occur if the selector is being used to send a
|
||||
@@ -245,50 +245,50 @@ static void to_string(struct ivy_ast_node *node, b_string *str)
|
||||
}
|
||||
|
||||
if (sel->n_msg_name) {
|
||||
b_string_append_cstr(str, sel->n_msg_name->t_str);
|
||||
fx_string_append_cstr(str, sel->n_msg_name->t_str);
|
||||
}
|
||||
|
||||
if (sel->n_msg_name && !b_queue_empty(&sel->n_arg_labels)) {
|
||||
b_string_append_cstr(str, "(");
|
||||
if (sel->n_msg_name && !fx_queue_empty(&sel->n_arg_labels)) {
|
||||
fx_string_append_cstr(str, "(");
|
||||
}
|
||||
|
||||
b_queue_entry *label_entry = b_queue_first(&sel->n_arg_labels);
|
||||
b_queue_entry *name_entry = b_queue_first(&sel->n_arg_names);
|
||||
fx_queue_entry *label_entry = fx_queue_first(&sel->n_arg_labels);
|
||||
fx_queue_entry *name_entry = fx_queue_first(&sel->n_arg_names);
|
||||
|
||||
int i = 0;
|
||||
while (label_entry) {
|
||||
if (i > 0) {
|
||||
b_string_append_cstr(str, " ");
|
||||
fx_string_append_cstr(str, " ");
|
||||
}
|
||||
|
||||
struct ivy_token *label, *name;
|
||||
|
||||
label = b_unbox(struct ivy_token, label_entry, t_entry);
|
||||
name = b_unbox(struct ivy_token, name_entry, t_entry);
|
||||
label = fx_unbox(struct ivy_token, label_entry, t_entry);
|
||||
name = fx_unbox(struct ivy_token, name_entry, t_entry);
|
||||
|
||||
if (label && label->t_type == IVY_TOK_LABEL && label->t_str) {
|
||||
b_string_append_cstrf(str, "%s:", label->t_str);
|
||||
fx_string_append_cstrf(str, "%s:", label->t_str);
|
||||
} else {
|
||||
b_string_append_cstrf(str, "_:");
|
||||
fx_string_append_cstrf(str, "_:");
|
||||
}
|
||||
|
||||
if (name) {
|
||||
b_string_append_cstrf(str, "%s", name->t_str);
|
||||
fx_string_append_cstrf(str, "%s", name->t_str);
|
||||
}
|
||||
|
||||
if (name) {
|
||||
i++;
|
||||
}
|
||||
|
||||
label_entry = b_queue_next(label_entry);
|
||||
name_entry = b_queue_next(name_entry);
|
||||
label_entry = fx_queue_next(label_entry);
|
||||
name_entry = fx_queue_next(name_entry);
|
||||
}
|
||||
|
||||
if (sel->n_msg_name && !b_queue_empty(&sel->n_arg_labels)) {
|
||||
b_string_append_cstr(str, ")");
|
||||
if (sel->n_msg_name && !fx_queue_empty(&sel->n_arg_labels)) {
|
||||
fx_string_append_cstr(str, ")");
|
||||
}
|
||||
|
||||
b_string_append_cstr(str, "]");
|
||||
fx_string_append_cstr(str, "]");
|
||||
}
|
||||
|
||||
static void init_state(struct ivy_parser *ctx, struct parser_state *sp, uintptr_t arg)
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
#include "iterate.h"
|
||||
#include "node.h"
|
||||
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/string.h>
|
||||
|
||||
static void to_string(struct ivy_ast_node *node, b_string *str)
|
||||
static void to_string(struct ivy_ast_node *node, fx_string *str)
|
||||
{
|
||||
struct ivy_ast_string_node *s = (struct ivy_ast_string_node *)node;
|
||||
b_string_append_cstrf(
|
||||
fx_string_append_cstrf(
|
||||
str, "%s (\"%s\")", ivy_ast_node_type_to_string(node->n_type),
|
||||
s->n_value->t_str);
|
||||
}
|
||||
@@ -26,7 +26,7 @@ struct token_parse_result parse_string(struct ivy_parser *ctx, struct ivy_token
|
||||
}
|
||||
|
||||
child->n_value = tok;
|
||||
b_queue_push_back(&parent->n_value, &child->n_base.n_entry);
|
||||
fx_queue_push_back(&parent->n_value, &child->n_base.n_entry);
|
||||
return PARSE_RESULT(IVY_OK, 0);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ static enum ivy_status add_child(
|
||||
struct ivy_ast_fstring_node *str
|
||||
= (struct ivy_ast_fstring_node *)parent->s_node;
|
||||
|
||||
b_queue_push_back(&str->n_value, &child->n_entry);
|
||||
fx_queue_push_back(&str->n_value, &child->n_entry);
|
||||
|
||||
return IVY_OK;
|
||||
}
|
||||
@@ -68,12 +68,12 @@ static void collect_children(
|
||||
struct ivy_ast_node *node, struct ivy_ast_node_iterator *iterator)
|
||||
{
|
||||
struct ivy_ast_fstring_node *str = (struct ivy_ast_fstring_node *)node;
|
||||
b_queue_entry *entry = b_queue_first(&str->n_value);
|
||||
fx_queue_entry *entry = fx_queue_first(&str->n_value);
|
||||
while (entry) {
|
||||
struct ivy_ast_node *child
|
||||
= b_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
= fx_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
ast_node_iterator_enqueue_node(iterator, node, child);
|
||||
entry = b_queue_next(entry);
|
||||
entry = fx_queue_next(entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,13 +10,13 @@ struct try_parser_state {
|
||||
|
||||
struct ivy_ast_block_node *s_try, *s_finally;
|
||||
|
||||
b_queue s_catch_branches;
|
||||
fx_queue s_catch_branches;
|
||||
struct ivy_ast_try_catch_node *s_cur_catch_branch;
|
||||
};
|
||||
|
||||
static enum ivy_status flush_catch_branch(struct try_parser_state *state)
|
||||
{
|
||||
b_queue_push_back(
|
||||
fx_queue_push_back(
|
||||
&state->s_catch_branches,
|
||||
&state->s_cur_catch_branch->n_base.n_entry);
|
||||
|
||||
@@ -41,7 +41,7 @@ static enum ivy_status finalise_try(struct try_parser_state *state)
|
||||
|
||||
state->s_try = NULL;
|
||||
state->s_finally = NULL;
|
||||
state->s_catch_branches = B_QUEUE_INIT;
|
||||
state->s_catch_branches = FX_QUEUE_INIT;
|
||||
|
||||
return IVY_OK;
|
||||
}
|
||||
@@ -236,12 +236,12 @@ static void try_collect_children(
|
||||
|
||||
ast_node_iterator_enqueue_node(iterator, node, try->n_try);
|
||||
|
||||
b_queue_entry *entry = b_queue_first(&try->n_catch);
|
||||
fx_queue_entry *entry = fx_queue_first(&try->n_catch);
|
||||
while (entry) {
|
||||
struct ivy_ast_node *catch
|
||||
= b_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
= fx_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
ast_node_iterator_enqueue_node(iterator, node, catch);
|
||||
entry = b_queue_next(entry);
|
||||
entry = fx_queue_next(entry);
|
||||
}
|
||||
|
||||
if (try->n_finally) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "ivy/status.h"
|
||||
#include "node.h"
|
||||
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/string.h>
|
||||
#include <ivy/lang/lex.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -14,7 +14,7 @@ struct tuple_parser_state {
|
||||
struct ivy_ast_node *s_prev_node;
|
||||
unsigned int s_prev;
|
||||
|
||||
b_queue s_items;
|
||||
fx_queue s_items;
|
||||
};
|
||||
|
||||
static void finalise_tuple(struct tuple_parser_state *state)
|
||||
@@ -23,7 +23,7 @@ static void finalise_tuple(struct tuple_parser_state *state)
|
||||
= (struct ivy_ast_tuple_node *)state->s_base.s_node;
|
||||
|
||||
tuple->n_members = state->s_items;
|
||||
state->s_items = B_QUEUE_INIT;
|
||||
state->s_items = FX_QUEUE_INIT;
|
||||
}
|
||||
|
||||
struct token_parse_result parse_comma(struct ivy_parser *ctx, struct ivy_token *tok)
|
||||
@@ -40,7 +40,7 @@ struct token_parse_result parse_comma(struct ivy_parser *ctx, struct ivy_token *
|
||||
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
||||
}
|
||||
|
||||
b_queue_push_back(&state->s_items, &state->s_prev_node->n_entry);
|
||||
fx_queue_push_back(&state->s_items, &state->s_prev_node->n_entry);
|
||||
state->s_prev_node = NULL;
|
||||
state->s_prev = IVY_SYM_COMMA;
|
||||
|
||||
@@ -69,7 +69,7 @@ struct token_parse_result parse_right_paren(
|
||||
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
||||
}
|
||||
|
||||
b_queue_push_back(&state->s_items, &state->s_prev_node->n_entry);
|
||||
fx_queue_push_back(&state->s_items, &state->s_prev_node->n_entry);
|
||||
state->s_prev_node = NULL;
|
||||
state->s_prev = IVY_SYM_RIGHT_PAREN;
|
||||
|
||||
@@ -100,7 +100,7 @@ static void init_state(struct ivy_parser *ctx, struct parser_state *sp, uintptr_
|
||||
if (arg) {
|
||||
/* arg is the first node in the tuple */
|
||||
struct ivy_ast_node *item = (struct ivy_ast_node *)arg;
|
||||
b_queue_push_back(&state->s_items, &item->n_entry);
|
||||
fx_queue_push_back(&state->s_items, &item->n_entry);
|
||||
state->s_prev = IVY_SYM_COMMA;
|
||||
}
|
||||
|
||||
@@ -117,12 +117,12 @@ static void collect_children(
|
||||
{
|
||||
struct ivy_ast_tuple_node *tuple = (struct ivy_ast_tuple_node *)node;
|
||||
|
||||
b_queue_entry *entry = b_queue_first(&tuple->n_members);
|
||||
fx_queue_entry *entry = fx_queue_first(&tuple->n_members);
|
||||
while (entry) {
|
||||
struct ivy_ast_node *item
|
||||
= b_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
= fx_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
ast_node_iterator_enqueue_node(iterator, node, item);
|
||||
entry = b_queue_next(entry);
|
||||
entry = fx_queue_next(entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "ctx.h"
|
||||
#include "node.h"
|
||||
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/string.h>
|
||||
#include <ivy/lang/lex.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -37,7 +37,7 @@ static struct token_parse_result parse_ident(
|
||||
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
||||
}
|
||||
|
||||
b_queue_push_back(&node->n_ident, &tok->t_entry);
|
||||
fx_queue_push_back(&node->n_ident, &tok->t_entry);
|
||||
|
||||
state->s_prev_token = IVY_TOK_IDENT;
|
||||
return PARSE_RESULT(IVY_OK, 0);
|
||||
@@ -57,31 +57,31 @@ static struct token_parse_result parse_linefeed(
|
||||
return PARSE_RESULT(IVY_OK, 0);
|
||||
}
|
||||
|
||||
static void to_string(struct ivy_ast_node *node, b_string *str)
|
||||
static void to_string(struct ivy_ast_node *node, fx_string *str)
|
||||
{
|
||||
struct ivy_ast_unit_import_node *unit_import
|
||||
= (struct ivy_ast_unit_import_node *)node;
|
||||
|
||||
b_string_append_cstr(str, ivy_ast_node_type_to_string(node->n_type));
|
||||
fx_string_append_cstr(str, ivy_ast_node_type_to_string(node->n_type));
|
||||
|
||||
b_string_append_cstr(str, " (");
|
||||
fx_string_append_cstr(str, " (");
|
||||
|
||||
int i = 0;
|
||||
|
||||
b_queue_entry *entry = b_queue_first(&unit_import->n_ident);
|
||||
fx_queue_entry *entry = fx_queue_first(&unit_import->n_ident);
|
||||
while (entry) {
|
||||
struct ivy_token *tok = b_unbox(struct ivy_token, entry, t_entry);
|
||||
struct ivy_token *tok = fx_unbox(struct ivy_token, entry, t_entry);
|
||||
|
||||
if (i > 0) {
|
||||
b_string_append_cstr(str, ".");
|
||||
fx_string_append_cstr(str, ".");
|
||||
}
|
||||
|
||||
b_string_append_cstr(str, tok->t_str);
|
||||
fx_string_append_cstr(str, tok->t_str);
|
||||
i++;
|
||||
entry = b_queue_next(entry);
|
||||
entry = fx_queue_next(entry);
|
||||
}
|
||||
|
||||
b_string_append_cstr(str, ")");
|
||||
fx_string_append_cstr(str, ")");
|
||||
}
|
||||
|
||||
static void init_state(struct ivy_parser *ctx, struct parser_state *sp, uintptr_t arg)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "ctx.h"
|
||||
#include "node.h"
|
||||
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/string.h>
|
||||
#include <ivy/lang/lex.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -37,7 +37,7 @@ static struct token_parse_result parse_ident(
|
||||
return PARSE_RESULT(IVY_ERR_BAD_SYNTAX, 0);
|
||||
}
|
||||
|
||||
b_queue_push_back(&node->n_ident, &tok->t_entry);
|
||||
fx_queue_push_back(&node->n_ident, &tok->t_entry);
|
||||
|
||||
state->s_prev_token = IVY_TOK_IDENT;
|
||||
return PARSE_RESULT(IVY_OK, 0);
|
||||
@@ -57,30 +57,30 @@ static struct token_parse_result parse_linefeed(
|
||||
return PARSE_RESULT(IVY_OK, 0);
|
||||
}
|
||||
|
||||
static void to_string(struct ivy_ast_node *node, b_string *str)
|
||||
static void to_string(struct ivy_ast_node *node, fx_string *str)
|
||||
{
|
||||
struct ivy_ast_unit_package_node *unit_package
|
||||
= (struct ivy_ast_unit_package_node *)node;
|
||||
b_string_append_cstr(str, ivy_ast_node_type_to_string(node->n_type));
|
||||
fx_string_append_cstr(str, ivy_ast_node_type_to_string(node->n_type));
|
||||
|
||||
b_string_append_cstr(str, " (");
|
||||
fx_string_append_cstr(str, " (");
|
||||
|
||||
int i = 0;
|
||||
b_queue_entry *entry = b_queue_first(&unit_package->n_ident);
|
||||
fx_queue_entry *entry = fx_queue_first(&unit_package->n_ident);
|
||||
while (entry) {
|
||||
struct ivy_token *tok = b_unbox(struct ivy_token, entry, t_entry);
|
||||
struct ivy_token *tok = fx_unbox(struct ivy_token, entry, t_entry);
|
||||
|
||||
if (i > 0) {
|
||||
b_string_append_cstr(str, ".");
|
||||
fx_string_append_cstr(str, ".");
|
||||
}
|
||||
|
||||
b_string_append_cstr(str, tok->t_str);
|
||||
fx_string_append_cstr(str, tok->t_str);
|
||||
i++;
|
||||
|
||||
entry = b_queue_next(entry);
|
||||
entry = fx_queue_next(entry);
|
||||
}
|
||||
|
||||
b_string_append_cstr(str, ")");
|
||||
fx_string_append_cstr(str, ")");
|
||||
}
|
||||
|
||||
static void init_state(struct ivy_parser *ctx, struct parser_state *sp, uintptr_t arg)
|
||||
|
||||
@@ -50,7 +50,7 @@ static enum ivy_status add_child(
|
||||
struct parser_state *parent, struct ivy_ast_node *child)
|
||||
{
|
||||
struct ivy_ast_unit_node *unit = (struct ivy_ast_unit_node *)parent->s_node;
|
||||
b_queue_push_back(&unit->n_children, &child->n_entry);
|
||||
fx_queue_push_back(&unit->n_children, &child->n_entry);
|
||||
return IVY_OK;
|
||||
}
|
||||
|
||||
@@ -58,12 +58,12 @@ static void collect_children(
|
||||
struct ivy_ast_node *node, struct ivy_ast_node_iterator *iterator)
|
||||
{
|
||||
struct ivy_ast_unit_node *unit = (struct ivy_ast_unit_node *)node;
|
||||
b_queue_entry *entry = b_queue_first(&unit->n_children);
|
||||
fx_queue_entry *entry = fx_queue_first(&unit->n_children);
|
||||
while (entry) {
|
||||
struct ivy_ast_node *child
|
||||
= b_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
= fx_unbox(struct ivy_ast_node, entry, n_entry);
|
||||
ast_node_iterator_enqueue_node(iterator, node, child);
|
||||
entry = b_queue_next(entry);
|
||||
entry = fx_queue_next(entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user