meta: replace bluelib with fx
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
#include "../line-ed/line-ed.h"
|
||||
#include "cmd.h"
|
||||
|
||||
#include <blue/cmd.h>
|
||||
#include <blue/term.h>
|
||||
#include <fx/cmd.h>
|
||||
#include <fx/term.h>
|
||||
#include <ivy/lang/ast.h>
|
||||
#include <ivy/lang/codegen.h>
|
||||
#include <ivy/lang/lex.h>
|
||||
@@ -180,26 +180,26 @@ static enum ivy_status repl_create(struct repl **out)
|
||||
return IVY_OK;
|
||||
}
|
||||
|
||||
int repl(const b_command *cmd, const b_arglist *args, const b_array *_)
|
||||
int repl(const fx_command *cmd, const fx_arglist *args, const fx_array *_)
|
||||
{
|
||||
#if 0
|
||||
b_printf(
|
||||
fx_printf(
|
||||
"[bold,bright_red]error[[E0384][reset,bold,white]: cannot "
|
||||
"assign twice to immutable variable `i`[reset]\n");
|
||||
b_printf("[bold,bright_blue] -->[reset] src/main.rs:7:3\n");
|
||||
b_printf("[bold,bright_blue] |[reset]\n");
|
||||
b_printf("[bold,bright_blue]4 |[reset] let i = 0;\n");
|
||||
b_printf("[bold,bright_blue] | -[reset]\n");
|
||||
b_printf("[bold,bright_blue] | |[reset]\n");
|
||||
b_printf(
|
||||
fx_printf("[bold,bright_blue] -->[reset] src/main.rs:7:3\n");
|
||||
fx_printf("[bold,bright_blue] |[reset]\n");
|
||||
fx_printf("[bold,bright_blue]4 |[reset] let i = 0;\n");
|
||||
fx_printf("[bold,bright_blue] | -[reset]\n");
|
||||
fx_printf("[bold,bright_blue] | |[reset]\n");
|
||||
fx_printf(
|
||||
"[bold,bright_blue] | first assignment to "
|
||||
"`i`[reset]\n");
|
||||
b_printf(
|
||||
fx_printf(
|
||||
"[bold,bright_blue] | help: make this binding "
|
||||
"mutable: `mut i`[reset]\n");
|
||||
b_printf("[bold,bright_blue]...[reset]\n");
|
||||
b_printf("[bold,bright_blue]7 |[reset] i += 1;\n");
|
||||
b_printf(
|
||||
fx_printf("[bold,bright_blue]...[reset]\n");
|
||||
fx_printf("[bold,bright_blue]7 |[reset] i += 1;\n");
|
||||
fx_printf(
|
||||
"[bold,bright_blue] |[bold,bright_red] ^^^^^^ cannot "
|
||||
"assign twice to immutable variable[reset]\n");
|
||||
#endif
|
||||
@@ -210,14 +210,14 @@ int repl(const b_command *cmd, const b_arglist *args, const b_array *_)
|
||||
return -1;
|
||||
}
|
||||
|
||||
repl->r_show_lex = b_arglist_get_count(
|
||||
args, OPT_SHOW_LEX_TOKENS, B_COMMAND_INVALID_ID)
|
||||
repl->r_show_lex = fx_arglist_get_count(
|
||||
args, OPT_SHOW_LEX_TOKENS, FX_COMMAND_INVALID_ID)
|
||||
> 0;
|
||||
repl->r_show_ast = b_arglist_get_count(
|
||||
args, OPT_SHOW_AST_NODES, B_COMMAND_INVALID_ID)
|
||||
repl->r_show_ast = fx_arglist_get_count(
|
||||
args, OPT_SHOW_AST_NODES, FX_COMMAND_INVALID_ID)
|
||||
> 0;
|
||||
repl->r_show_ir
|
||||
= b_arglist_get_count(args, OPT_SHOW_IR, B_COMMAND_INVALID_ID) > 0;
|
||||
= fx_arglist_get_count(args, OPT_SHOW_IR, FX_COMMAND_INVALID_ID) > 0;
|
||||
|
||||
while (true) {
|
||||
struct ivy_token *tok = ivy_lexer_read(repl->r_lex);
|
||||
@@ -227,7 +227,7 @@ int repl(const b_command *cmd, const b_arglist *args, const b_array *_)
|
||||
}
|
||||
|
||||
if (status != IVY_OK) {
|
||||
b_err("lex error (%s)",
|
||||
fx_err("lex error (%s)",
|
||||
ivy_status_to_string(
|
||||
ivy_lexer_get_status(repl->r_lex)));
|
||||
continue;
|
||||
@@ -240,7 +240,7 @@ int repl(const b_command *cmd, const b_arglist *args, const b_array *_)
|
||||
status = ivy_parser_push_token(repl->r_parse, tok);
|
||||
|
||||
if (status != IVY_OK) {
|
||||
b_err("parse error (%s)", ivy_status_to_string(status));
|
||||
fx_err("parse error (%s)", ivy_status_to_string(status));
|
||||
ivy_token_destroy(tok);
|
||||
skip_line(repl->r_lex);
|
||||
continue;
|
||||
@@ -273,33 +273,33 @@ int repl(const b_command *cmd, const b_arglist *args, const b_array *_)
|
||||
|
||||
B_COMMAND(CMD_REPL, CMD_ROOT)
|
||||
{
|
||||
B_COMMAND_NAME("shell");
|
||||
B_COMMAND_SHORT_NAME('S');
|
||||
B_COMMAND_DESC("start an interactive Ivy shell.");
|
||||
B_COMMAND_HELP_OPTION();
|
||||
B_COMMAND_FUNCTION(repl);
|
||||
FX_COMMAND_NAME("shell");
|
||||
FX_COMMAND_SHORT_NAME('S');
|
||||
FX_COMMAND_DESC("start an interactive Ivy shell.");
|
||||
FX_COMMAND_HELP_OPTION();
|
||||
FX_COMMAND_FUNCTION(repl);
|
||||
|
||||
B_COMMAND_OPTION(OPT_SHOW_LEX_TOKENS)
|
||||
FX_COMMAND_OPTION(OPT_SHOW_LEX_TOKENS)
|
||||
{
|
||||
B_OPTION_LONG_NAME("show-lex");
|
||||
B_OPTION_SHORT_NAME('l');
|
||||
B_OPTION_DESC(
|
||||
FX_OPTION_LONG_NAME("show-lex");
|
||||
FX_OPTION_SHORT_NAME('l');
|
||||
FX_OPTION_DESC(
|
||||
"print the lexical tokens generated from the input.");
|
||||
}
|
||||
|
||||
B_COMMAND_OPTION(OPT_SHOW_AST_NODES)
|
||||
FX_COMMAND_OPTION(OPT_SHOW_AST_NODES)
|
||||
{
|
||||
B_OPTION_LONG_NAME("show-ast");
|
||||
B_OPTION_SHORT_NAME('a');
|
||||
B_OPTION_DESC(
|
||||
FX_OPTION_LONG_NAME("show-ast");
|
||||
FX_OPTION_SHORT_NAME('a');
|
||||
FX_OPTION_DESC(
|
||||
"print the abstract syntax tree generated from the "
|
||||
"input.");
|
||||
}
|
||||
|
||||
B_COMMAND_OPTION(OPT_SHOW_IR)
|
||||
FX_COMMAND_OPTION(OPT_SHOW_IR)
|
||||
{
|
||||
B_OPTION_LONG_NAME("show-ir");
|
||||
B_OPTION_SHORT_NAME('i');
|
||||
B_OPTION_DESC("print the Mie IR generated from the input.");
|
||||
FX_OPTION_LONG_NAME("show-ir");
|
||||
FX_OPTION_SHORT_NAME('i');
|
||||
FX_OPTION_DESC("print the Mie IR generated from the input.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user