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