meta: replace bluelib with fx
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user