Rename newshell to rzshell and parser commands to statements

This commit is contained in:
Riccardo Schirone 2021-04-22 13:45:14 +02:00 committed by GitHub
parent 49a9817898
commit cad4e0ae0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 7652 additions and 7662 deletions

View file

@ -107,7 +107,7 @@ rules to make the git history more readable and consistent:
* ##refactor - improve code quality
* ##remote - rizin over tcp, http, rap, serial .. including collaboration
* ##search - rz-find, / command, ..
* ##shell - commandline, newshell, ..
* ##shell - commandline, rzshell, ..
* ##signatures-searching/generating them
* ##test - testing infrastructure fixes/changes
* ##tools - rz-pm, rz-run, rz-ax ... that don't fit in other categories

View file

@ -1,7 +1,7 @@
# Command parsing and command handling
Rizin has moved away from the default way of parsing radare2 commands and the
way commands were handled there. It enables by default what is called in r2
way commands were handled there. It enables by default what is/was called in r2
`cfg.newshell`, which enables a generated parser that parses rizin commands and
a new way of registering and developing commands.
@ -26,7 +26,7 @@ to easily register/unregister new commands at runtime (e.g. a new Core plugin
that wants to provide a new command) or the inconsistency between commands
actually available and commands shown to users in help messages.
## cfg.newshell
## Rizin shell
Not long ago, radare2 introduced the variable `cfg.newshell` that, when enabled,
allows you to use new features in the code. Rizin has chosen to enable this by
@ -194,4 +194,4 @@ Environment:
| RZ_BIN_LANG # assume this lang to demangle
| RZ_BIN_DEMANGLE # demangle or not
| RZ_BIN_PDBSERVER # e pdb.server
```
```

View file

@ -14,7 +14,7 @@
enum autocmplt_type_t {
AUTOCMPLT_UNKNOWN = 0, ///< Unknown, nothing will be autocompleted
AUTOCMPLT_CMD_ID, ///< A command identifier (aka command name) needs to be autocompleted
AUTOCMPLT_CMD_ARG, ///< The argument of an arged_command (see grammar.js) needs to be autocompleted
AUTOCMPLT_CMD_ARG, ///< The argument of an arged_stmt (see grammar.js) needs to be autocompleted
};
/**
@ -432,7 +432,7 @@ static RzCmdDesc *get_cd_from_arg(RzCore *core, const char *data, TSNode arg) {
parent_type = ts_node_type(parent);
} while (is_arg_type(parent_type));
if (strcmp(parent_type, "arged_command")) {
if (strcmp(parent_type, "arged_stmt")) {
return NULL;
}
@ -611,7 +611,7 @@ static bool find_autocmplt_type(struct autocmplt_data_t *ad, RzCore *core, TSNod
RZ_LOG_DEBUG("lstart = %d, lend = %d, type = %s\n", lstart, lend, root_type);
if (!strcmp(root_type, "cmd_identifier") && buf->data[lend - 1] != ' ') {
res = fill_autocmplt_data_cmdid(ad, lstart, lend);
} else if (!strcmp(root_type, "commands") && ts_node_named_child_count(root) == 0) {
} else if (!strcmp(root_type, "statements") && ts_node_named_child_count(root) == 0) {
res = fill_autocmplt_data_cmdid(ad, lend, lend);
} else if (!strcmp(root_type, "arg_identifier")) {
res = fill_autocmplt_data_cmdarg(ad, lstart, lend, buf->data, root, core);
@ -650,7 +650,7 @@ static bool find_autocmplt_type(struct autocmplt_data_t *ad, RzCore *core, TSNod
* Returns a \p RzLineNSCompletionResult structure containing all the info to
* autocomplete what is currently in \p buf.
*/
RZ_API RzLineNSCompletionResult *rz_core_autocomplete_newshell(RzCore *core, RzLineBuffer *buf, RzLinePromptType prompt_type) {
RZ_API RzLineNSCompletionResult *rz_core_autocomplete_rzshell(RzCore *core, RzLineBuffer *buf, RzLinePromptType prompt_type) {
RzLineNSCompletionResult *res = NULL;
if (prompt_type == RZ_LINE_PROMPT_OFFSET) {
res = rz_line_ns_completion_result_new(0, buf->length, NULL);

View file

@ -2112,17 +2112,17 @@ static bool cb_scrhtml(void *user, void *data) {
return true;
}
static bool cb_newshell(void *user, void *data) {
static bool cb_oldshell(void *user, void *data) {
RzConfigNode *node = (RzConfigNode *)data;
RzCore *core = (RzCore *)user;
core->use_tree_sitter_rzcmd = node->i_value;
core->use_tree_sitter_rzcmd = !node->i_value;
return true;
}
static bool cb_newshell_autocompletion(void *user, void *data) {
static bool cb_oldshell_autocompletion(void *user, void *data) {
RzConfigNode *node = (RzConfigNode *)data;
RzCore *core = (RzCore *)user;
core->use_newshell_autocompletion = node->i_value;
core->use_rzshell_autocompletion = !node->i_value;
return true;
}
@ -3220,9 +3220,9 @@ RZ_API int rz_core_config_init(RzCore *core) {
SETCB("cfg.seek.silent", "false", NULL, "When true, seek movements are not logged in seek history");
SETCB("cfg.bigendian", "false", &cb_bigendian, "Use little (false) or big (true) endianness");
p = rz_sys_getenv("RZ_CFG_OLDSHELL");
SETCB("cfg.newshell", p ? "false" : "true", &cb_newshell, "Use new commands parser");
SETCB("cfg.oldshell", p ? "true" : "false", &cb_oldshell, "Use old radare2 parser");
free(p);
SETCB("cfg.newshell.autocompletion", "false", &cb_newshell_autocompletion, "Use autocompletion based on newshell data");
SETCB("cfg.oldshell.autocompletion", "true", &cb_oldshell_autocompletion, "Use old radare2 autocompletion");
SETI("cfg.cpuaffinity", 0, "Run on cpuid");
/* log */

View file

@ -1,19 +1,6 @@
// SPDX-FileCopyrightText: 2009-2021 nibble <nibble.ds@gmail.com>
// SPDX-FileCopyrightText: 2009-2021 pancake <pancake@nopcode.org>
// SPDX-License-Identifier: LGPL-3.0-only
#if 0
* Use RzList
* Support callback for null command (why?)
* Show help of commands
- long commands not yet tested at all
- added interface to export command list into an autocompletable
argc, argv for dietline
* rz_cmd must provide a nesting char table indexing for commands
- this is already partially done
- this is pretty similar to rz_db
- every module can register their own commands
- commands can be listed like in a tree
#endif
#define INTERACTIVE_MAX_REP 1024
@ -4281,9 +4268,9 @@ static char *ts_node_sub_parent_string(TSNode parent, TSNode node, const char *c
goto label; \
}
static RzCmdStatus handle_ts_command(struct tsr2cmd_state *state, TSNode node);
static RzCmdStatus handle_ts_command_tmpseek(struct tsr2cmd_state *state, TSNode node);
static RzCmdStatus core_cmd_tsr2cmd(RzCore *core, const char *cstr, bool split_lines, bool log);
static RzCmdStatus handle_ts_stmt(struct tsr2cmd_state *state, TSNode node);
static RzCmdStatus handle_ts_stmt_tmpseek(struct tsr2cmd_state *state, TSNode node);
static RzCmdStatus core_cmd_tsrzcmd(RzCore *core, const char *cstr, bool split_lines, bool log);
DEFINE_IS_TS_FCN_AND_SYMBOL(fdn_redirect_operator)
DEFINE_IS_TS_FCN_AND_SYMBOL(fdn_append_operator)
@ -4302,7 +4289,7 @@ DEFINE_IS_TS_FCN_AND_SYMBOL(double_quoted_arg)
DEFINE_IS_TS_FCN_AND_SYMBOL(single_quoted_arg)
DEFINE_IS_TS_FCN_AND_SYMBOL(concatenation)
DEFINE_IS_TS_FCN_AND_SYMBOL(grep_specifier)
DEFINE_IS_TS_FCN_AND_SYMBOL(commands)
DEFINE_IS_TS_FCN_AND_SYMBOL(statements)
static struct tsr2cmd_edit *create_cmd_edit(struct tsr2cmd_state *state, TSNode arg, char *new_text) {
struct tsr2cmd_edit *e = RZ_NEW0(struct tsr2cmd_edit);
@ -4588,7 +4575,7 @@ static char *ts_node_handle_arg(struct tsr2cmd_state *state, TSNode command, TSN
return str;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(arged_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(arged_stmt) {
TSNode command = ts_node_child_by_field_name(node, "command", strlen("command"));
rz_return_val_if_fail(!ts_node_is_null(command), false);
@ -4606,7 +4593,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(arged_command) {
}
rz_str_unescape(command_str);
RZ_LOG_DEBUG("arged_command command: '%s'\n", command_str);
RZ_LOG_DEBUG("arged_stmt command: '%s'\n", command_str);
TSNode args = ts_node_child_by_field_name(node, "args", strlen("args"));
RzCmdStatus res = RZ_CMD_STATUS_INVALID;
@ -4617,7 +4604,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(arged_command) {
char *exec_string = rz_str_newf(".%s", cmd_str);
free(cmd_str);
free(command_str);
res = core_cmd_tsr2cmd(state->core, exec_string, state->split_lines, false);
res = core_cmd_tsrzcmd(state->core, exec_string, state->split_lines, false);
free(exec_string);
return res;
}
@ -4681,11 +4668,11 @@ err:
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(legacy_quoted_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(legacy_quoted_stmt) {
return rz_cmd_int2status(run_cmd_depth(state->core, node_string));
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(repeat_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(repeat_stmt) {
TSNode number = ts_node_child_by_field_name(node, "arg", strlen("arg"));
char *number_str = ts_node_sub_string(number, state->input);
int rep = atoi(number_str);
@ -4701,14 +4688,14 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(repeat_command) {
RzCmdStatus res = RZ_CMD_STATUS_OK;
size_t i;
for (i = 0; i < rep; i++) {
RzCmdStatus cmd_res = handle_ts_command(state, command);
RzCmdStatus cmd_res = handle_ts_stmt(state, command);
UPDATE_CMD_STATUS_RES(res, cmd_res, err);
}
err:
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(redirect_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(redirect_stmt) {
int pipecolor = rz_config_get_i(state->core->config, "scr.color.pipe");
int ocolor = rz_config_get_i(state->core->config, "scr.color");
int scr_html = -1;
@ -4752,7 +4739,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(redirect_command) {
if (arg_str[0] == '$') {
// redirect output of command to an alias variable
RZ_LOG_DEBUG("redirect_command: alias = '%s'\n", arg_str);
RZ_LOG_DEBUG("redirect_stmt: alias = '%s'\n", arg_str);
TSNode command = ts_node_child_by_field_name(node, "command", strlen("command"));
char *command_str = ts_node_sub_string(command, state->input);
@ -4772,14 +4759,14 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(redirect_command) {
res = RZ_CMD_STATUS_OK;
} else {
rz_cons_flush();
RZ_LOG_DEBUG("redirect_command: fdn = %d, is_append = %d\n", fdn, is_append);
RZ_LOG_DEBUG("redirect_stmt: fdn = %d, is_append = %d\n", fdn, is_append);
int pipefd = rz_cons_pipe_open(arg_str, fdn, is_append);
if (pipefd != -1) {
if (!pipecolor) {
rz_config_set_i(state->core->config, "scr.color", COLOR_MODE_DISABLED);
}
TSNode command = ts_node_child_by_field_name(node, "command", strlen("command"));
res = handle_ts_command(state, command);
res = handle_ts_stmt(state, command);
rz_cons_flush();
rz_cons_pipe_close(pipefd);
} else {
@ -4862,7 +4849,7 @@ exit_status:
return status;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(help_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(help_stmt) {
size_t node_str_len = strlen(node_string);
if (node_str_len >= 2 && !strcmp(node_string + node_str_len - 2, "?*")) {
node_string[node_str_len - 2] = 0;
@ -4909,7 +4896,7 @@ err_else:
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_seek_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_seek_stmt) {
TSNode command = ts_node_named_child(node, 0);
TSNode offset = ts_node_named_child(node, 1);
char *offset_string = ts_node_handle_arg(state, node, offset, 1);
@ -4925,28 +4912,28 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_seek_command) {
if (offset_string[0] == '-' || offset_string[0] == '+') {
offset_val += state->core->offset;
}
RZ_LOG_DEBUG("tmp_seek_command, changing offset to %" PFMT64x "\n", offset_val);
RZ_LOG_DEBUG("tmp_seek_stmt, changing offset to %" PFMT64x "\n", offset_val);
rz_core_seek(state->core, offset_val, true);
RzCmdStatus res = handle_ts_command_tmpseek(state, command);
RzCmdStatus res = handle_ts_stmt_tmpseek(state, command);
rz_core_seek(state->core, orig_offset, true);
free(offset_string);
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_blksz_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_blksz_stmt) {
TSNode command = ts_node_named_child(node, 0);
TSNode blksz = ts_node_named_child(node, 1);
char *blksz_string = ts_node_handle_arg(state, node, blksz, 1);
ut64 orig_blksz = state->core->blocksize;
RZ_LOG_DEBUG("tmp_blksz_command, changing blksz to %s\n", blksz_string);
RZ_LOG_DEBUG("tmp_blksz_stmt, changing blksz to %s\n", blksz_string);
rz_core_block_size(state->core, rz_num_math(state->core->num, blksz_string));
RzCmdStatus res = handle_ts_command(state, command);
RzCmdStatus res = handle_ts_stmt(state, command);
rz_core_block_size(state->core, orig_blksz);
free(blksz_string);
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_fromto_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_fromto_stmt) {
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
TSNode fromto = ts_node_named_child(node, 1);
@ -4965,7 +4952,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_fromto_command) {
"search.to", "zoom.to", NULL };
ut64 from_val = rz_num_math(core->num, from_str);
ut64 to_val = rz_num_math(core->num, to_str);
RZ_LOG_DEBUG("tmp_fromto_command, changing fromto to (%" PFMT64x ", %" PFMT64x ")\n", from_val, to_val);
RZ_LOG_DEBUG("tmp_fromto_stmt, changing fromto to (%" PFMT64x ", %" PFMT64x ")\n", from_val, to_val);
RzConfigHold *hc = rz_config_hold_new(core->config);
int i;
@ -4978,7 +4965,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_fromto_command) {
rz_config_set_i(core->config, tovars[i], to_val);
}
RzCmdStatus res = handle_ts_command(state, command);
RzCmdStatus res = handle_ts_stmt(state, command);
rz_config_hold_restore(hc);
@ -4987,7 +4974,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_fromto_command) {
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_arch_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_arch_stmt) {
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
TSNode arg = ts_node_named_child(node, 1);
@ -5007,7 +4994,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_arch_command) {
is_arch_set = set_tmp_arch(core, arg_str, &tmparch);
// execute command with changed settings
RzCmdStatus res = handle_ts_command(state, command);
RzCmdStatus res = handle_ts_stmt(state, command);
// restore original settings
if (is_arch_set) {
@ -5027,7 +5014,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_arch_command) {
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_bits_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_bits_stmt) {
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
TSNode arg = ts_node_named_child(node, 1);
@ -5039,7 +5026,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_bits_command) {
int bits = rz_num_math(core->num, arg_str);
set_tmp_bits(core, bits, &tmpbits, &cmd_ignbithints);
RzCmdStatus res = handle_ts_command(state, command);
RzCmdStatus res = handle_ts_stmt(state, command);
rz_config_set(core->config, "asm.bits", tmpbits);
core->fixedbits = oldfixedbits;
@ -5050,7 +5037,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_bits_command) {
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_nthi_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_nthi_stmt) {
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
TSNode arg = ts_node_named_child(node, 1);
@ -5075,7 +5062,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_nthi_command) {
eprintf("Can't find a basic block for 0x%08" PFMT64x "\n", core->offset);
}
RzCmdStatus res = handle_ts_command_tmpseek(state, command);
RzCmdStatus res = handle_ts_stmt_tmpseek(state, command);
rz_core_seek(core, orig_offset, true);
@ -5083,7 +5070,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_nthi_command) {
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_eval_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_eval_stmt) {
// TODO: support cmd_substitution in tmp_eval_args
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
@ -5105,26 +5092,26 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_eval_command) {
free(arg_str);
}
RzCmdStatus res = handle_ts_command(state, command);
RzCmdStatus res = handle_ts_stmt(state, command);
rz_config_hold_restore(hc);
rz_config_hold_free(hc);
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_fs_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_fs_stmt) {
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
TSNode arg = ts_node_named_child(node, 1);
char *arg_str = ts_node_handle_arg(state, node, arg, 1);
rz_flag_space_push(core->flags, arg_str);
RzCmdStatus res = handle_ts_command(state, command);
RzCmdStatus res = handle_ts_stmt(state, command);
rz_flag_space_pop(core->flags);
free(arg_str);
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_reli_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_reli_stmt) {
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
TSNode arg = ts_node_named_child(node, 1);
@ -5134,13 +5121,13 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_reli_command) {
if (addr) {
rz_core_seek_opcode(core, addr, false);
}
RzCmdStatus res = handle_ts_command_tmpseek(state, command);
RzCmdStatus res = handle_ts_stmt_tmpseek(state, command);
rz_core_seek(state->core, orig_offset, true);
free(arg_str);
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_kuery_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_kuery_stmt) {
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
TSNode arg = ts_node_named_child(node, 1);
@ -5151,26 +5138,26 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_kuery_command) {
rz_core_seek(core, rz_num_math(core->num, out), true);
free(out);
}
RzCmdStatus res = handle_ts_command_tmpseek(state, command);
RzCmdStatus res = handle_ts_stmt_tmpseek(state, command);
rz_core_seek(state->core, orig_offset, true);
free(arg_str);
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_fd_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_fd_stmt) {
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
TSNode arg = ts_node_named_child(node, 1);
char *arg_str = ts_node_handle_arg(state, node, arg, 1);
int tmpfd = core->io->desc ? core->io->desc->fd : -1;
rz_io_use_fd(core->io, atoi(arg_str));
RzCmdStatus res = handle_ts_command(state, command);
RzCmdStatus res = handle_ts_stmt(state, command);
rz_io_use_fd(core->io, tmpfd);
free(arg_str);
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_reg_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_reg_stmt) {
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
TSNode arg = ts_node_named_child(node, 1);
@ -5179,7 +5166,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_reg_command) {
// TODO: add support for operations (e.g. @r:PC+10)
ut64 regval = rz_debug_reg_get(core->dbg, arg_str);
rz_core_seek(core, regval, true);
RzCmdStatus res = handle_ts_command_tmpseek(state, command);
RzCmdStatus res = handle_ts_stmt_tmpseek(state, command);
rz_core_seek(core, orig_offset, true);
free(arg_str);
return res;
@ -5205,7 +5192,7 @@ static bool handle_tmp_desc(struct tsr2cmd_state *state, TSNode command, const u
core->fixedblock = true;
rz_core_block_read(core);
res = handle_ts_command(state, command);
res = handle_ts_stmt(state, command);
core->fixedblock = o_fixedblock;
if (pamode) {
@ -5220,7 +5207,7 @@ out_buf:
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_file_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_file_stmt) {
TSNode command = ts_node_named_child(node, 0);
TSNode arg = ts_node_named_child(node, 1);
char *arg_str = ts_node_handle_arg(state, node, arg, 1);
@ -5241,7 +5228,7 @@ out:
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_string_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_string_stmt) {
TSNode command = ts_node_named_child(node, 0);
TSNode arg = ts_node_named_child(node, 1);
char *arg_str = ts_node_handle_arg(state, node, arg, 1);
@ -5256,7 +5243,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_string_command) {
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_value_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_value_stmt) {
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
TSNode arg = ts_node_named_child(node, 1);
@ -5276,7 +5263,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_value_command) {
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_hex_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_hex_stmt) {
TSNode command = ts_node_named_child(node, 0);
TSNode arg = ts_node_named_child(node, 1);
char *arg_str = ts_node_handle_arg(state, node, arg, 1);
@ -5293,7 +5280,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(tmp_hex_command) {
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_flags_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_flags_stmt) {
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
TSNode arg = ts_node_named_child(node, 1);
@ -5325,9 +5312,9 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_flags_command) {
break;
}
RZ_LOG_DEBUG("iter_flags_command: seek to %" PFMT64x "\n", flag->offset);
RZ_LOG_DEBUG("iter_flags_stmt: seek to %" PFMT64x "\n", flag->offset);
rz_core_seek(core, flag->offset, true);
RzCmdStatus cmd_res = handle_ts_command_tmpseek(state, command);
RzCmdStatus cmd_res = handle_ts_stmt_tmpseek(state, command);
rz_core_task_yield(&core->tasks);
UPDATE_CMD_STATUS_RES(ret, cmd_res, err);
}
@ -5368,7 +5355,7 @@ static bool iter_dbt_commands(struct tsr2cmd_state *state, TSNode node, enum dbt
rz_warn_if_reached();
return RZ_CMD_STATUS_INVALID;
}
RzCmdStatus cmd_res = handle_ts_command_tmpseek(state, command);
RzCmdStatus cmd_res = handle_ts_stmt_tmpseek(state, command);
rz_cons_newline();
UPDATE_CMD_STATUS_RES(res, cmd_res, err);
}
@ -5378,19 +5365,19 @@ err:
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_dbta_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_dbta_stmt) {
return iter_dbt_commands(state, node, DBT_COMMANDS_MODE_ADDR);
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_dbtb_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_dbtb_stmt) {
return iter_dbt_commands(state, node, DBT_COMMANDS_MODE_BP);
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_dbts_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_dbts_stmt) {
return iter_dbt_commands(state, node, DBT_COMMANDS_MODE_SP);
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_file_lines_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_file_lines_stmt) {
RzCore *core = state->core;
RzCmdStatus res = RZ_CMD_STATUS_OK;
TSNode command = ts_node_named_child(node, 0);
@ -5412,7 +5399,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_file_lines_command) {
}
ut64 addr = rz_num_math(core->num, buf);
rz_core_seek(core, addr, true);
RzCmdStatus cmd_res = handle_ts_command_tmpseek(state, command);
RzCmdStatus cmd_res = handle_ts_stmt_tmpseek(state, command);
core->rcmd->macro.counter++;
UPDATE_CMD_STATUS_RES(res, cmd_res, err);
}
@ -5442,7 +5429,7 @@ static RzCmdStatus do_iter_offsets(RzCore *core, struct tsr2cmd_state *state, TS
if (has_size) {
rz_core_block_size(core, blk_sz);
}
RzCmdStatus cmd_res = handle_ts_command_tmpseek(state, *command);
RzCmdStatus cmd_res = handle_ts_stmt_tmpseek(state, *command);
rz_cons_flush();
UPDATE_CMD_STATUS_RES(res, cmd_res, err);
}
@ -5477,15 +5464,15 @@ static RzCmdStatus iter_offsets_common(struct tsr2cmd_state *state, TSNode node,
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_offsets_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_offsets_stmt) {
return iter_offsets_common(state, node, false);
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_offsetssizes_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_offsetssizes_stmt) {
return iter_offsets_common(state, node, true);
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_instrs_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_instrs_stmt) {
TSNode command = ts_node_named_child(node, 0);
RzCore *core = state->core;
RzCmdStatus res = RZ_CMD_STATUS_OK;
@ -5506,7 +5493,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_instrs_command) {
int sz = rz_analysis_block_get_op_size(bb, i);
rz_core_block_size(core, sz);
rz_core_seek(core, i_addr, true);
RzCmdStatus cmd_res = handle_ts_command_tmpseek(state, command);
RzCmdStatus cmd_res = handle_ts_stmt_tmpseek(state, command);
UPDATE_CMD_STATUS_RES(res, cmd_res, err);
if (rz_cons_is_breaked()) {
break;
@ -5520,7 +5507,7 @@ err:
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_step_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_step_stmt) {
TSNode command = ts_node_named_child(node, 0);
TSNode args = ts_node_named_child(node, 1);
RzCmdParsedArgs *a = ts_node_handle_arg_prargs(state, node, args, 1, true);
@ -5545,7 +5532,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_step_command) {
for (cur = from; cur < to; cur += step) {
rz_core_seek(core, cur, true);
rz_core_block_size(core, step);
RzCmdStatus cmd_res = handle_ts_command_tmpseek(state, command);
RzCmdStatus cmd_res = handle_ts_stmt_tmpseek(state, command);
UPDATE_CMD_STATUS_RES(res, cmd_res, err);
if (rz_cons_is_breaked()) {
break;
@ -5559,20 +5546,20 @@ err:
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_hit_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_hit_stmt) {
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
TSNode search_cmd = ts_node_named_child(node, 1);
char *command_str = ts_node_sub_string(command, state->input);
char *cmdhit = strdup(rz_config_get(core->config, "cmd.hit"));
rz_config_set(core->config, "cmd.hit", command_str);
RzCmdStatus res = handle_ts_command(state, search_cmd);
RzCmdStatus res = handle_ts_stmt(state, search_cmd);
rz_config_set(core->config, "cmd.hit", cmdhit);
free(command_str);
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_bbs_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_bbs_stmt) {
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, core->offset, 0);
@ -5589,7 +5576,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_bbs_command) {
rz_list_foreach (fcn->bbs, iter, bb) {
rz_core_seek(core, bb->addr, true);
rz_core_block_size(core, bb->size);
RzCmdStatus cmd_res = handle_ts_command_tmpseek(state, command);
RzCmdStatus cmd_res = handle_ts_stmt_tmpseek(state, command);
UPDATE_CMD_STATUS_RES(ret, cmd_res, err);
}
err:
@ -5598,7 +5585,7 @@ err:
return ret;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_interpret_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_interpret_stmt) {
// convert @@c: command into a @@= one, by using the output of the
// in_cmd as addr of @@=
RzCmdStatus res = RZ_CMD_STATUS_INVALID;
@ -5628,7 +5615,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_interpret_command) {
if (!substitute_args_do(state, edits, &new_command)) {
goto err;
}
res = handle_ts_command(state, new_command);
res = handle_ts_stmt(state, new_command);
err:
rz_list_free(edits);
edits_err:
@ -5636,7 +5623,7 @@ edits_err:
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_interpret_offsetssizes_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_interpret_offsetssizes_stmt) {
// convert @@@c: command into a @@@= one, by using the output of the
// in_cmd as addr/blksz of @@@=
RzCmdStatus res = RZ_CMD_STATUS_INVALID;
@ -5666,7 +5653,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_interpret_offsetssizes_command) {
if (!substitute_args_do(state, edits, &new_command)) {
goto err;
}
res = handle_ts_command(state, new_command);
res = handle_ts_stmt(state, new_command);
err:
rz_list_free(edits);
edits_err:
@ -5674,7 +5661,7 @@ edits_err:
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_comment_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_comment_stmt) {
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
TSNode filter_node = ts_node_named_child(node, 1);
@ -5691,7 +5678,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_comment_command) {
}
if (!glob || (meta->str && rz_str_glob(meta->str, glob))) {
rz_core_seek(core, rz_interval_tree_iter_get(&it)->start, true);
RzCmdStatus cmd_res = handle_ts_command_tmpseek(state, command);
RzCmdStatus cmd_res = handle_ts_stmt_tmpseek(state, command);
UPDATE_CMD_STATUS_RES(res, cmd_res, err);
}
}
@ -5701,7 +5688,7 @@ err:
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_import_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_import_stmt) {
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
RzBinSymbol *imp;
@ -5727,7 +5714,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_import_command) {
ut64 addr = *naddr;
if (addr != UT64_MAX) {
rz_core_seek(core, addr, true);
RzCmdStatus cmd_res = handle_ts_command_tmpseek(state, command);
RzCmdStatus cmd_res = handle_ts_stmt_tmpseek(state, command);
UPDATE_CMD_STATUS_RES(res, cmd_res, err);
}
}
@ -5737,7 +5724,7 @@ err:
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_register_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_register_stmt) {
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
ut64 offorig = core->offset;
@ -5766,7 +5753,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_register_command) {
value = rz_reg_getv(core->dbg->reg, item_name);
rz_core_seek(core, value, true);
rz_cons_printf("%s: ", item_name);
RzCmdStatus cmd_res = handle_ts_command_tmpseek(state, command);
RzCmdStatus cmd_res = handle_ts_stmt_tmpseek(state, command);
UPDATE_CMD_STATUS_RES(res, cmd_res, err);
}
err:
@ -5776,7 +5763,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_register_command) {
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_symbol_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_symbol_stmt) {
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
RzBinSymbol *sym;
@ -5797,7 +5784,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_symbol_command) {
}
rz_core_block_size(core, sym->size);
rz_core_seek(core, sym->vaddr, true);
RzCmdStatus cmd_res = handle_ts_command_tmpseek(state, command);
RzCmdStatus cmd_res = handle_ts_stmt_tmpseek(state, command);
UPDATE_CMD_STATUS_RES(res, cmd_res, err);
}
err:
@ -5808,7 +5795,7 @@ err:
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_string_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_string_stmt) {
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
RzList *list = rz_bin_get_strings(core->bin);
@ -5826,7 +5813,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_string_command) {
rz_list_foreach (lost, iter, s) {
rz_core_block_size(core, s->size);
rz_core_seek(core, s->vaddr, true);
RzCmdStatus cmd_res = handle_ts_command_tmpseek(state, command);
RzCmdStatus cmd_res = handle_ts_stmt_tmpseek(state, command);
UPDATE_CMD_STATUS_RES(res, cmd_res, err);
}
err:
@ -5855,7 +5842,7 @@ static RzCmdStatus do_iter_sections(struct tsr2cmd_state *state, TSNode node, bo
}
rz_core_seek(core, sec->vaddr, true);
rz_core_block_size(core, sec->vsize);
RzCmdStatus cmd_res = handle_ts_command_tmpseek(state, command);
RzCmdStatus cmd_res = handle_ts_stmt_tmpseek(state, command);
UPDATE_CMD_STATUS_RES(res, cmd_res, err);
}
err:
@ -5864,15 +5851,15 @@ err:
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_sections_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_sections_stmt) {
return do_iter_sections(state, node, true);
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_segments_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_segments_stmt) {
return do_iter_sections(state, node, false);
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_iomap_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_iomap_stmt) {
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
int fd = rz_io_fd_get_current(core->io);
@ -5885,7 +5872,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_iomap_command) {
rz_list_foreach (maps, iter, map) {
rz_core_seek(core, map->itv.addr, true);
rz_core_block_size(core, map->itv.size);
RzCmdStatus cmd_res = handle_ts_command_tmpseek(state, command);
RzCmdStatus cmd_res = handle_ts_stmt_tmpseek(state, command);
UPDATE_CMD_STATUS_RES(res, cmd_res, err);
}
err:
@ -5894,7 +5881,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_iomap_command) {
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_dbgmap_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_dbgmap_stmt) {
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
RzDebug *dbg = core->dbg;
@ -5904,7 +5891,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_dbgmap_command) {
RzListIter *iter;
rz_list_foreach (dbg->maps, iter, map) {
rz_core_seek(core, map->addr, true);
RzCmdStatus cmd_res = handle_ts_command_tmpseek(state, command);
RzCmdStatus cmd_res = handle_ts_stmt_tmpseek(state, command);
UPDATE_CMD_STATUS_RES(res, cmd_res, err);
}
}
@ -5912,7 +5899,7 @@ err:
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_function_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_function_stmt) {
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
TSNode filter_node = ts_node_named_child(node, 1);
@ -5934,7 +5921,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_function_command) {
if (!filter || rz_str_glob(fcn->name, filter)) {
rz_core_seek(core, fcn->addr, true);
rz_core_block_size(core, rz_analysis_function_linear_size(fcn));
RzCmdStatus cmd_res = handle_ts_command_tmpseek(state, command);
RzCmdStatus cmd_res = handle_ts_stmt_tmpseek(state, command);
UPDATE_CMD_STATUS_RES(res, cmd_res, err);
}
}
@ -5946,7 +5933,7 @@ err:
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_threads_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_threads_stmt) {
RzCore *core = state->core;
TSNode command = ts_node_named_child(node, 0);
RzDebug *dbg = core->dbg;
@ -5962,7 +5949,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_threads_command) {
rz_list_foreach (list, iter, p) {
rz_debug_select(dbg, dbg->pid, p->pid);
rz_cons_printf("PID %d\n", p->pid);
RzCmdStatus cmd_res = handle_ts_command(state, command);
RzCmdStatus cmd_res = handle_ts_stmt(state, command);
UPDATE_CMD_STATUS_RES(res, cmd_res, err);
}
err:
@ -5972,30 +5959,30 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(iter_threads_command) {
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(grep_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(grep_stmt) {
TSNode command = ts_node_child_by_field_name(node, "command", strlen("command"));
TSNode arg = ts_node_child_by_field_name(node, "specifier", strlen("specifier"));
char *arg_str = ts_node_handle_arg(state, node, arg, 1);
RzCmdStatus res = handle_ts_command(state, command);
RZ_LOG_DEBUG("grep_command specifier: '%s'\n", arg_str);
RzCmdStatus res = handle_ts_stmt(state, command);
RZ_LOG_DEBUG("grep_stmt specifier: '%s'\n", arg_str);
RzStrBuf *sb = rz_strbuf_new(arg_str);
rz_strbuf_prepend(sb, "~");
char *specifier_str_es = rz_cons_grep_strip(rz_strbuf_get(sb), "`");
rz_strbuf_free(sb);
char *specifier_str = rz_cmd_unescape_arg(specifier_str_es, true);
RZ_LOG_DEBUG("grep_command processed specifier: '%s'\n", specifier_str);
RZ_LOG_DEBUG("grep_stmt processed specifier: '%s'\n", specifier_str);
rz_cons_grep_process(specifier_str);
free(arg_str);
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(html_disable_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(html_disable_stmt) {
TSNode command = ts_node_child_by_field_name(node, "command", strlen("command"));
int scr_html = rz_config_get_i(state->core->config, "scr.html");
rz_config_set_i(state->core->config, "scr.html", 0);
int scr_color = rz_config_get_i(state->core->config, "scr.color");
rz_config_set_i(state->core->config, "scr.color", COLOR_MODE_DISABLED);
RzCmdStatus res = handle_ts_command(state, command);
RzCmdStatus res = handle_ts_stmt(state, command);
if (scr_html != -1) {
rz_cons_flush();
rz_config_set_i(state->core->config, "scr.html", scr_html);
@ -6006,11 +5993,11 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(html_disable_command) {
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(html_enable_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(html_enable_stmt) {
TSNode command = ts_node_child_by_field_name(node, "command", strlen("command"));
int scr_html = rz_config_get_i(state->core->config, "scr.html");
rz_config_set_i(state->core->config, "scr.html", true);
RzCmdStatus res = handle_ts_command(state, command);
RzCmdStatus res = handle_ts_stmt(state, command);
if (scr_html != -1) {
rz_cons_flush();
rz_config_set_i(state->core->config, "scr.html", scr_html);
@ -6018,7 +6005,7 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(html_enable_command) {
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(pipe_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(pipe_stmt) {
TSNode first_cmd = ts_node_named_child(node, 0);
rz_return_val_if_fail(!ts_node_is_null(first_cmd), false);
TSNode second_cmd = ts_node_named_child(node, 1);
@ -6033,13 +6020,13 @@ DEFINE_HANDLE_TS_FCN_AND_SYMBOL(pipe_command) {
return res;
}
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(number_command) {
DEFINE_HANDLE_TS_FCN_AND_SYMBOL(number_stmt) {
ut64 addr = rz_num_math(state->core->num, node_string);
rz_core_seek(state->core, addr, true);
return RZ_CMD_STATUS_OK;
}
static RzCmdStatus handle_ts_command(struct tsr2cmd_state *state, TSNode node) {
static RzCmdStatus handle_ts_stmt(struct tsr2cmd_state *state, TSNode node) {
RzCmdStatus ret = RZ_CMD_STATUS_INVALID;
RzCore *core = state->core;
RzCmd *cmd = core->rcmd;
@ -6084,17 +6071,17 @@ static RzCmdStatus handle_ts_command(struct tsr2cmd_state *state, TSNode node) {
return ret;
}
static RzCmdStatus handle_ts_command_tmpseek(struct tsr2cmd_state *state, TSNode node) {
static RzCmdStatus handle_ts_stmt_tmpseek(struct tsr2cmd_state *state, TSNode node) {
// TODO: remove tmpseek when no commands will change behaviour based on `@` (tmpseek)
RzCore *core = state->core;
bool saved_tmpseek = core->tmpseek;
core->tmpseek = true;
RzCmdStatus ret = handle_ts_command(state, node);
RzCmdStatus ret = handle_ts_stmt(state, node);
core->tmpseek = saved_tmpseek;
return ret;
}
DEFINE_HANDLE_TS_FCN(commands) {
DEFINE_HANDLE_TS_FCN(statements) {
RzCore *core = state->core;
RzCmdStatus res = RZ_CMD_STATUS_OK;
ut32 child_count = ts_node_named_child_count(node);
@ -6116,7 +6103,7 @@ DEFINE_HANDLE_TS_FCN(commands) {
}
for (i = 0; i < child_count; i++) {
if (core->cons->context->cmd_depth < 1) {
RZ_LOG_ERROR("handle_ts_commands: That was too deep...\n");
RZ_LOG_ERROR("handle_ts_statements: That was too deep...\n");
return RZ_CMD_STATUS_INVALID;
}
core->cons->context->cmd_depth--;
@ -6129,7 +6116,7 @@ DEFINE_HANDLE_TS_FCN(commands) {
return res;
}
TSNode command = ts_node_named_child(node, i);
RzCmdStatus cmd_res = handle_ts_command(state, command);
RzCmdStatus cmd_res = handle_ts_stmt(state, command);
if (state->split_lines) {
rz_cons_flush();
rz_core_task_yield(&core->tasks);
@ -6160,7 +6147,7 @@ err:
#define HANDLER_RULE_OP(name) { #name, handle_ts_##name },
#define RULE_OP(name)
struct ts_data_symbol_map map_ts_command_handlers[] = {
struct ts_data_symbol_map map_ts_stmt_handlers[] = {
#include "rz-shell-parser-cmds.inc"
{ NULL, NULL },
};
@ -6180,7 +6167,7 @@ static void ts_symbols_init(RzCmd *cmd) {
TSLanguage *lang = tree_sitter_rzcmd();
cmd->language = lang;
cmd->ts_symbols_ht = ht_up_new0();
struct ts_data_symbol_map *entry = map_ts_command_handlers;
struct ts_data_symbol_map *entry = map_ts_stmt_handlers;
while (entry->name) {
TSSymbol symbol = ts_language_symbol_for_name(lang, entry->name, strlen(entry->name), true);
ht_up_insert(cmd->ts_symbols_ht, symbol, entry->data);
@ -6195,7 +6182,7 @@ static void ts_symbols_init(RzCmd *cmd) {
}
}
static RzCmdStatus core_cmd_tsr2cmd(RzCore *core, const char *cstr, bool split_lines, bool log) {
static RzCmdStatus core_cmd_tsrzcmd(RzCore *core, const char *cstr, bool split_lines, bool log) {
ts_symbols_init(core->rcmd);
TSParser *parser = ts_parser_new();
@ -6230,8 +6217,8 @@ static RzCmdStatus core_cmd_tsr2cmd(RzCore *core, const char *cstr, bool split_l
RZ_LOG_DEBUG("s-expr %s\n", ts_str);
free(ts_str);
if (is_ts_commands(root) && !ts_node_has_error(root)) {
res = handle_ts_commands(&state, root);
if (is_ts_statements(root) && !ts_node_has_error(root)) {
res = handle_ts_statements(&state, root);
} else {
// TODO: print a more meaningful error message and use the ERROR
// tokens to indicate where, probably, the error is.
@ -6272,13 +6259,13 @@ static int run_cmd_depth(RzCore *core, char *cmd) {
return ret;
}
RZ_API RzCmdStatus rz_core_cmd_newshell(RzCore *core, const char *cstr, int log) {
return core_cmd_tsr2cmd(core, cstr, false, log);
RZ_API RzCmdStatus rz_core_cmd_rzshell(RzCore *core, const char *cstr, int log) {
return core_cmd_tsrzcmd(core, cstr, false, log);
}
RZ_API int rz_core_cmd(RzCore *core, const char *cstr, int log) {
if (core->use_tree_sitter_rzcmd) {
return rz_cmd_status2int(core_cmd_tsr2cmd(core, cstr, false, log));
return rz_cmd_status2int(core_cmd_tsrzcmd(core, cstr, false, log));
}
int ret = false, i;
@ -6352,13 +6339,13 @@ beach:
return ret;
}
RZ_API RzCmdStatus rz_core_cmd_lines_newshell(RzCore *core, const char *lines) {
return core_cmd_tsr2cmd(core, lines, true, false);
RZ_API RzCmdStatus rz_core_cmd_lines_rzshell(RzCore *core, const char *lines) {
return core_cmd_tsrzcmd(core, lines, true, false);
}
RZ_API int rz_core_cmd_lines(RzCore *core, const char *lines) {
if (core->use_tree_sitter_rzcmd) {
RzCmdStatus status = core_cmd_tsr2cmd(core, lines, true, false);
RzCmdStatus status = core_cmd_tsrzcmd(core, lines, true, false);
return status == RZ_CMD_STATUS_OK;
}
int r, ret = true;
@ -6495,8 +6482,8 @@ RZ_API int rz_core_cmdf(RzCore *core, const char *fmt, ...) {
return ret;
}
RZ_API RzCmdStatus rz_core_cmd0_newshell(RzCore *core, const char *cmd) {
return rz_core_cmd_newshell(core, cmd, 0);
RZ_API RzCmdStatus rz_core_cmd0_rzshell(RzCore *core, const char *cmd) {
return rz_core_cmd_rzshell(core, cmd, 0);
}
RZ_API int rz_core_cmd0(RzCore *core, const char *cmd) {
@ -6697,5 +6684,5 @@ RZ_API void rz_core_cmd_init(RzCore *core) {
DEPRECATED_DEFINE_CMD_DESCRIPTOR(core, u);
DEPRECATED_DEFINE_CMD_DESCRIPTOR(core, y);
cmd_descriptor_init(core);
newshell_cmddescs_init(core);
rzshell_cmddescs_init(core);
}

View file

@ -3942,7 +3942,7 @@ static const RzCmdDescHelp specifiers_help = {
.details = specifiers_details,
};
RZ_IPI void newshell_cmddescs_init(RzCore *core) {
RZ_IPI void rzshell_cmddescs_init(RzCore *core) {
RzCmdDesc *root_cd = rz_cmd_get_root(core->rcmd);
rz_cmd_batch_start(core->rcmd);

View file

@ -273,4 +273,4 @@ RZ_IPI RzCmdStatus rz_zign_info_handler(RzCore *core, int argc, const char **arg
RZ_IPI RzCmdStatus rz_zign_info_range_handler(RzCore *core, int argc, const char **argv);
// Main function that initialize the entire commands tree
RZ_IPI void newshell_cmddescs_init(RzCore *core);
RZ_IPI void rzshell_cmddescs_init(RzCore *core);

View file

@ -20,7 +20,7 @@ CMDDESCS_C_TEMPLATE = """// SPDX-FileCopyrightText: 2020 RizinOrg <info@rizin.re
{helps_declarations}
{helps}
RZ_IPI void newshell_cmddescs_init(RzCore *core) {{
RZ_IPI void rzshell_cmddescs_init(RzCore *core) {{
\tRzCmdDesc *root_cd = rz_cmd_get_root(core->rcmd);
\trz_cmd_batch_start(core->rcmd);
{init_code}
@ -42,7 +42,7 @@ CMDDESCS_H_TEMPLATE = """// SPDX-License-Identifier: LGPL-3.0-only
{handlers_declarations}
// Main function that initialize the entire commands tree
RZ_IPI void newshell_cmddescs_init(RzCore *core);
RZ_IPI void rzshell_cmddescs_init(RzCore *core);
"""
DESC_HELP_DETAIL_ENTRY_TEMPLATE = (

View file

@ -1697,8 +1697,8 @@ static int autocomplete(RzLineCompletion *completion, RzLineBuffer *buf, RzLineP
return true;
}
static RzLineNSCompletionResult *newshell_autocomplete(RzLineBuffer *buf, RzLinePromptType prompt_type, void *user) {
return rz_core_autocomplete_newshell((RzCore *)user, buf, prompt_type);
static RzLineNSCompletionResult *rzshell_autocomplete(RzLineBuffer *buf, RzLinePromptType prompt_type, void *user) {
return rz_core_autocomplete_rzshell((RzCore *)user, buf, prompt_type);
}
RZ_API int rz_core_fgets(char *buf, int len, void *user) {
@ -1708,8 +1708,8 @@ RZ_API int rz_core_fgets(char *buf, int len, void *user) {
bool prompt = cons->context->is_interactive;
buf[0] = '\0';
if (prompt) {
if (core->use_newshell_autocompletion) {
rzli->ns_completion.run = newshell_autocomplete;
if (core->use_rzshell_autocompletion) {
rzli->ns_completion.run = rzshell_autocomplete;
rzli->ns_completion.run_user = core;
rzli->completion.run = NULL;
} else {
@ -2367,7 +2367,7 @@ RZ_API bool rz_core_init(RzCore *core) {
core->config = NULL;
core->http_up = false;
core->use_tree_sitter_rzcmd = false;
core->use_newshell_autocompletion = false;
core->use_rzshell_autocompletion = false;
ZERO_FILL(core->root_cmd_descriptor);
core->print = rz_print_new();
core->ropchain = rz_list_newf((RzListFree)free);

View file

@ -23,7 +23,7 @@ static int rz_cmd_example_init(void *user /* RzCmd* */, const char *unused /* un
(void)cmd;
/* Here you can initialize any aspect of the
* core plugin (like allocate memory or register
* the core plugin on newshell or create a socket) */
* the core plugin on rzshell or create a socket) */
eprintf("This init was called!\n");
return true;
}

View file

@ -1,59 +1,59 @@
// SPDX-FileCopyrightText: 2020 ret2libc <sirmy15@gmail.com>
// SPDX-License-Identifier: LGPL-3.0-only
//
// mark with HANDLER_RULE_OP every rule that is a _command
// mark with HANDLER_RULE_OP every rule that is a _stmt
// mark with RULE_OP every rule that you use with DEFINE_IS_TS_FCN or with its TSSymbol (e.g. ts_##name##_symbol)
HANDLER_RULE_OP(number_command)
HANDLER_RULE_OP(commands)
HANDLER_RULE_OP(arged_command)
HANDLER_RULE_OP(legacy_quoted_command)
HANDLER_RULE_OP(repeat_command)
HANDLER_RULE_OP(redirect_command)
HANDLER_RULE_OP(help_command)
HANDLER_RULE_OP(tmp_seek_command)
HANDLER_RULE_OP(tmp_blksz_command)
HANDLER_RULE_OP(tmp_fromto_command)
HANDLER_RULE_OP(tmp_arch_command)
HANDLER_RULE_OP(tmp_bits_command)
HANDLER_RULE_OP(tmp_nthi_command)
HANDLER_RULE_OP(tmp_eval_command)
HANDLER_RULE_OP(tmp_fs_command)
HANDLER_RULE_OP(tmp_reli_command)
HANDLER_RULE_OP(tmp_kuery_command)
HANDLER_RULE_OP(tmp_fd_command)
HANDLER_RULE_OP(tmp_reg_command)
HANDLER_RULE_OP(tmp_file_command)
HANDLER_RULE_OP(tmp_string_command)
HANDLER_RULE_OP(tmp_value_command)
HANDLER_RULE_OP(tmp_hex_command)
HANDLER_RULE_OP(grep_command)
HANDLER_RULE_OP(iter_file_lines_command)
HANDLER_RULE_OP(iter_offsets_command)
HANDLER_RULE_OP(iter_offsetssizes_command)
HANDLER_RULE_OP(iter_hit_command)
HANDLER_RULE_OP(iter_interpret_command)
HANDLER_RULE_OP(iter_interpret_offsetssizes_command)
HANDLER_RULE_OP(iter_comment_command)
HANDLER_RULE_OP(iter_dbta_command)
HANDLER_RULE_OP(iter_dbtb_command)
HANDLER_RULE_OP(iter_dbts_command)
HANDLER_RULE_OP(iter_threads_command)
HANDLER_RULE_OP(iter_bbs_command)
HANDLER_RULE_OP(iter_instrs_command)
HANDLER_RULE_OP(iter_import_command)
HANDLER_RULE_OP(iter_sections_command)
HANDLER_RULE_OP(iter_segments_command)
HANDLER_RULE_OP(iter_symbol_command)
HANDLER_RULE_OP(iter_string_command)
HANDLER_RULE_OP(iter_flags_command)
HANDLER_RULE_OP(iter_function_command)
HANDLER_RULE_OP(iter_iomap_command)
HANDLER_RULE_OP(iter_dbgmap_command)
HANDLER_RULE_OP(iter_register_command)
HANDLER_RULE_OP(iter_step_command)
HANDLER_RULE_OP(html_disable_command)
HANDLER_RULE_OP(html_enable_command)
HANDLER_RULE_OP(pipe_command)
HANDLER_RULE_OP(number_stmt)
HANDLER_RULE_OP(statements)
HANDLER_RULE_OP(arged_stmt)
HANDLER_RULE_OP(legacy_quoted_stmt)
HANDLER_RULE_OP(repeat_stmt)
HANDLER_RULE_OP(redirect_stmt)
HANDLER_RULE_OP(help_stmt)
HANDLER_RULE_OP(tmp_seek_stmt)
HANDLER_RULE_OP(tmp_blksz_stmt)
HANDLER_RULE_OP(tmp_fromto_stmt)
HANDLER_RULE_OP(tmp_arch_stmt)
HANDLER_RULE_OP(tmp_bits_stmt)
HANDLER_RULE_OP(tmp_nthi_stmt)
HANDLER_RULE_OP(tmp_eval_stmt)
HANDLER_RULE_OP(tmp_fs_stmt)
HANDLER_RULE_OP(tmp_reli_stmt)
HANDLER_RULE_OP(tmp_kuery_stmt)
HANDLER_RULE_OP(tmp_fd_stmt)
HANDLER_RULE_OP(tmp_reg_stmt)
HANDLER_RULE_OP(tmp_file_stmt)
HANDLER_RULE_OP(tmp_string_stmt)
HANDLER_RULE_OP(tmp_value_stmt)
HANDLER_RULE_OP(tmp_hex_stmt)
HANDLER_RULE_OP(grep_stmt)
HANDLER_RULE_OP(iter_file_lines_stmt)
HANDLER_RULE_OP(iter_offsets_stmt)
HANDLER_RULE_OP(iter_offsetssizes_stmt)
HANDLER_RULE_OP(iter_hit_stmt)
HANDLER_RULE_OP(iter_interpret_stmt)
HANDLER_RULE_OP(iter_interpret_offsetssizes_stmt)
HANDLER_RULE_OP(iter_comment_stmt)
HANDLER_RULE_OP(iter_dbta_stmt)
HANDLER_RULE_OP(iter_dbtb_stmt)
HANDLER_RULE_OP(iter_dbts_stmt)
HANDLER_RULE_OP(iter_threads_stmt)
HANDLER_RULE_OP(iter_bbs_stmt)
HANDLER_RULE_OP(iter_instrs_stmt)
HANDLER_RULE_OP(iter_import_stmt)
HANDLER_RULE_OP(iter_sections_stmt)
HANDLER_RULE_OP(iter_segments_stmt)
HANDLER_RULE_OP(iter_symbol_stmt)
HANDLER_RULE_OP(iter_string_stmt)
HANDLER_RULE_OP(iter_flags_stmt)
HANDLER_RULE_OP(iter_function_stmt)
HANDLER_RULE_OP(iter_iomap_stmt)
HANDLER_RULE_OP(iter_dbgmap_stmt)
HANDLER_RULE_OP(iter_register_stmt)
HANDLER_RULE_OP(iter_step_stmt)
HANDLER_RULE_OP(html_disable_stmt)
HANDLER_RULE_OP(html_enable_stmt)
HANDLER_RULE_OP(pipe_stmt)
RULE_OP(fdn_redirect_operator)
RULE_OP(fdn_append_operator)
RULE_OP(html_redirect_operator)

View file

@ -349,7 +349,7 @@ struct rz_core_t {
bool log_events; // core.c:cb_event_handler : log actions from events if cfg.log.events is set
RzList *ropchain;
bool use_tree_sitter_rzcmd;
bool use_newshell_autocompletion;
bool use_rzshell_autocompletion;
RzCoreSeekHistory seek_history;
bool marks_init;
@ -425,7 +425,7 @@ RZ_API int rz_core_prompt_exec(RzCore *core);
RZ_API void rz_core_prompt_loop(RzCore *core);
RZ_API ut64 rz_core_pava(RzCore *core, ut64 addr);
RZ_API int rz_core_cmd(RzCore *core, const char *cmd, int log);
RZ_API RzCmdStatus rz_core_cmd_newshell(RzCore *core, const char *cmd, int log);
RZ_API RzCmdStatus rz_core_cmd_rzshell(RzCore *core, const char *cmd, int log);
RZ_API char *rz_core_editor(const RzCore *core, const char *file, const char *str);
RZ_API int rz_core_fgets(char *buf, int len, void *user);
RZ_API RzFlagItem *rz_core_flag_get_by_spaces(RzFlag *f, ut64 off);
@ -439,7 +439,7 @@ RZ_API char *rz_core_cmd_strf(RzCore *core, const char *fmt, ...) RZ_PRINTF_CHEC
RZ_API char *rz_core_cmd_str_pipe(RzCore *core, const char *cmd);
RZ_API int rz_core_cmd_file(RzCore *core, const char *file);
RZ_API int rz_core_cmd_lines(RzCore *core, const char *lines);
RZ_API RzCmdStatus rz_core_cmd_lines_newshell(RzCore *core, const char *lines);
RZ_API RzCmdStatus rz_core_cmd_lines_rzshell(RzCore *core, const char *lines);
RZ_API int rz_core_cmd_command(RzCore *core, const char *command);
RZ_API bool rz_core_run_script(RzCore *core, const char *file);
RZ_API void rz_core_seek_item_free(RzCoreSeekItem *item);
@ -470,7 +470,7 @@ RZ_API int rz_core_write_hexpair(RzCore *core, ut64 addr, const char *pairs);
RZ_API int rz_core_write_assembly(RzCore *core, ut64 addr, const char *instructions, bool pretend, bool pad);
RZ_API int rz_core_shift_block(RzCore *core, ut64 addr, ut64 b_size, st64 dist);
RZ_API void rz_core_autocomplete(RZ_NULLABLE RzCore *core, RzLineCompletion *completion, RzLineBuffer *buf, RzLinePromptType prompt_type);
RZ_API RzLineNSCompletionResult *rz_core_autocomplete_newshell(RzCore *core, RzLineBuffer *buf, RzLinePromptType prompt_type);
RZ_API RzLineNSCompletionResult *rz_core_autocomplete_rzshell(RzCore *core, RzLineBuffer *buf, RzLinePromptType prompt_type);
RZ_API void rz_core_print_scrollbar(RzCore *core);
RZ_API void rz_core_print_scrollbar_bottom(RzCore *core);
RZ_API void rz_core_help_vars_print(RzCore *core);
@ -598,7 +598,7 @@ RZ_API int rz_core_loadlibs(RzCore *core, int where, const char *path);
RZ_API int rz_core_cmd_buffer(RzCore *core, const char *buf);
RZ_API int rz_core_cmdf(RzCore *core, const char *fmt, ...) RZ_PRINTF_CHECK(2, 3);
RZ_API int rz_core_cmd0(RzCore *core, const char *cmd);
RZ_API RzCmdStatus rz_core_cmd0_newshell(RzCore *core, const char *cmd);
RZ_API RzCmdStatus rz_core_cmd0_rzshell(RzCore *core, const char *cmd);
RZ_API char *rz_core_cmd_str(RzCore *core, const char *cmd);
RZ_API int rz_core_cmd_foreach(RzCore *core, const char *cmd, char *each);
RZ_API int rz_core_cmd_foreach3(RzCore *core, const char *cmd, char *each);

View file

@ -154,7 +154,7 @@ static int main_help(int line) {
" RZ_LIBR_PLUGINS " RZ_JOIN_2_PATHS("%s", RZ_PLUGINS) "\n"
" RZ_USER_ZIGNS " RZ_JOIN_2_PATHS("~", RZ_HOME_ZIGNS) "\n"
"Environment:\n"
" RZ_CFG_OLDSHELL sets cfg.newshell=false\n"
" RZ_CFG_OLDSHELL sets cfg.oldshell=true\n"
" RZ_DEBUG if defined, show error messages and crash signal\n"
" RZ_DEBUG_ASSERT=1 set a breakpoint when hitting an assert\n"
" RZ_MAGICPATH " RZ_JOIN_2_PATHS("%s", RZ_SDB_MAGIC) "\n"

View file

@ -119,7 +119,7 @@ To enter visual mode use the 'V' command. Then press '?' for help
.Sh DEBUGGER
In rizin the debugger commands are implemented under the 'd' command. Type 'd?' for help
.Sh ENVIRONMENT
RZ_CFG_OLDSHELL sets cfg.newshell=false
RZ_CFG_OLDSHELL sets cfg.oldshell=true
RZ_DEBUG if defined, show error messages and crash signal
RZ_DEBUG_ASSERT=1 set a breakpoint when hitting an assert
RZ_MAGICPATH /Users/pancake/.local/share/rizin/share/rizin/4.5.0-git/magic

View file

@ -6,8 +6,8 @@ afbt:c1/sort/inc
---
(commands
(arged_command
(statements
(arged_stmt
command: (cmd_identifier
extra: (specifiers
(arg_identifier)))))
@ -20,8 +20,8 @@ afbt:*/page/1/10
---
(commands
(arged_command
(statements
(arged_stmt
command: (cmd_identifier
extra: (specifiers
(arg_identifier)))))
@ -34,8 +34,8 @@ afbt:c1/sort/inc:json
---
(commands
(arged_command
(statements
(arged_stmt
command: (cmd_identifier
extra: (specifiers
(arg_identifier)

View file

@ -6,29 +6,29 @@ Command substitution used as simple arg $(
---
(commands
(arged_command command: (cmd_identifier)
(statements
(arged_stmt command: (cmd_identifier)
args: (args
(arg (cmd_substitution_arg
(arged_command command: (cmd_identifier)
(arged_stmt command: (cmd_identifier)
args: (args (arg (arg_identifier)))))))))
=======================================
Command substitution with multiple commands
Command substitution with multiple statements
=======================================
?e $(p8 10; p8 4 @ 0xdeadbeef)
---
(commands
(arged_command command: (cmd_identifier)
(statements
(arged_stmt command: (cmd_identifier)
args: (args
(arg (cmd_substitution_arg
(arged_command command: (cmd_identifier)
(arged_stmt command: (cmd_identifier)
args: (args (arg (arg_identifier))))
(tmp_seek_command
(arged_command command: (cmd_identifier)
(tmp_seek_stmt
(arged_stmt command: (cmd_identifier)
args: (args (arg (arg_identifier))))
(args (arg (arg_identifier)))))))))
@ -42,11 +42,11 @@ Command substitution used as simple arg `
---
(commands
(arged_command command: (cmd_identifier)
(statements
(arged_stmt command: (cmd_identifier)
args: (args
(arg (cmd_substitution_arg
(arged_command command: (cmd_identifier)
(arged_stmt command: (cmd_identifier)
args: (args (arg (arg_identifier)))))))))
@ -58,12 +58,12 @@ Nested command substitution
---
(commands
(arged_command command: (cmd_identifier)
(statements
(arged_stmt command: (cmd_identifier)
args: (args (arg (cmd_substitution_arg
(arged_command command: (cmd_identifier)
(arged_stmt command: (cmd_identifier)
args: (args (arg (cmd_substitution_arg
(arged_command command: (cmd_identifier)
(arged_stmt command: (cmd_identifier)
args: (args (arg (arg_identifier)))))))))))))
@ -75,14 +75,14 @@ Nested command substitution 2
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(args (arg (concatenation
(arg_identifier)
(cmd_substitution_arg
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (concatenation
(arg_identifier)
(cmd_substitution_arg
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier)))))))))))))))

View file

@ -6,8 +6,8 @@ afl # af is not going to be parsed
---
(commands
(arged_command (cmd_identifier)))
(statements
(arged_stmt (cmd_identifier)))
==================
@ -20,11 +20,11 @@ Begin with comment
---
(commands)
(statements)
====================================
Multiple commands multiple comments
Multiple statements multiple comments
====================================
afl # first comment
@ -33,11 +33,11 @@ p8 10# third comment
---
(commands
(arged_command (cmd_identifier))
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier)))))
==================================
@ -48,8 +48,8 @@ p8 4 # something
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier)))))
@ -63,7 +63,7 @@ p8 4 # something
---
(commands
(arged_command (cmd_identifier))
(arged_command (cmd_identifier))
(arged_command (cmd_identifier)))
(statements
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier)))

View file

@ -6,8 +6,8 @@ pd 10\@test\>name
---
(commands
(arged_command
(statements
(arged_stmt
command: (cmd_identifier)
args: (args (arg (arg_identifier)))))
@ -20,8 +20,8 @@ Use newlines in echo
---
(commands
(arged_command
(statements
(arged_stmt
command: (cmd_identifier)
args: (args (arg (double_quoted_arg)))))
@ -34,7 +34,7 @@ Escape hash
---
(commands
(arged_command
(statements
(arged_stmt
command: (cmd_identifier)
args: (args (arg (arg_identifier)))))

View file

@ -8,19 +8,19 @@ afl~$
---
(commands
(grep_command
command: (arged_command
(statements
(grep_stmt
command: (arged_stmt
command: (cmd_identifier)
args: (args (arg (arg_identifier))))
specifier: (grep_specifier (grep_specifier_identifier)))
(grep_command
command: (arged_command
(grep_stmt
command: (arged_stmt
command: (cmd_identifier)
args: (args (arg (arg_identifier))))
specifier: (grep_specifier (grep_specifier_identifier)))
(grep_command
command: (arged_command command: (cmd_identifier))
(grep_stmt
command: (arged_stmt command: (cmd_identifier))
specifier: (grep_specifier (grep_specifier_identifier))))
@ -34,27 +34,27 @@ pd 10~mo$(?e v)
---
(commands
(grep_command
(arged_command (cmd_identifier)
(statements
(grep_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(grep_specifier
(cmd_substitution_arg
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier)))))))
(grep_command
(arged_command (cmd_identifier)
(grep_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(grep_specifier
(grep_specifier_identifier)
(cmd_substitution_arg
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier)))))))
(grep_command
(arged_command (cmd_identifier)
(grep_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(grep_specifier
(grep_specifier_identifier)
(cmd_substitution_arg
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))))))

View file

@ -6,9 +6,9 @@ p8 @@.file
---
(commands
(iter_file_lines_command
(arged_command (cmd_identifier))
(statements
(iter_file_lines_stmt
(arged_stmt (cmd_identifier))
(arg (arg_identifier))))
@ -20,9 +20,9 @@ p8 @@=off1 off2
---
(commands
(iter_offsets_command
(arged_command (cmd_identifier))
(statements
(iter_offsets_stmt
(arged_stmt (cmd_identifier))
(args
(arg (arg_identifier))
(arg (arg_identifier)))))
@ -36,9 +36,9 @@ p8 @@@=off1 sz1 off2 sz2
---
(commands
(iter_offsetssizes_command
(arged_command (cmd_identifier))
(statements
(iter_offsetssizes_stmt
(arged_stmt (cmd_identifier))
(args
(arg (arg_identifier))
(arg (arg_identifier))
@ -54,10 +54,10 @@ p8 @@/x 9090
---
(commands
(iter_hit_command
(arged_command (cmd_identifier))
(arged_command (cmd_identifier)
(statements
(iter_hit_stmt
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier)
(args
(arg (arg_identifier))))))
@ -70,10 +70,10 @@ p8 @@c:?e hello
---
(commands
(iter_interpret_command
(arged_command (cmd_identifier))
(arged_command (cmd_identifier)
(statements
(iter_interpret_stmt
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))))
@ -85,10 +85,10 @@ p8 @@@c:?e hello 10
---
(commands
(iter_interpret_offsetssizes_command
(arged_command (cmd_identifier))
(arged_command (cmd_identifier)
(statements
(iter_interpret_offsetssizes_stmt
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier)
(args
(arg (arg_identifier))
(arg (arg_identifier))))))
@ -103,11 +103,11 @@ pd @@C:mycomm*
---
(commands
(iter_comment_command
(arged_command (cmd_identifier)))
(iter_comment_command
(arged_command (cmd_identifier))
(statements
(iter_comment_stmt
(arged_stmt (cmd_identifier)))
(iter_comment_stmt
(arged_stmt (cmd_identifier))
(arg (arg_identifier))))
@ -122,18 +122,18 @@ p8 4 @@dbts
---
(commands
(iter_dbta_command
(arged_command (cmd_identifier)
(statements
(iter_dbta_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier)))))
(iter_dbta_command
(arged_command (cmd_identifier)
(iter_dbta_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier)))))
(iter_dbtb_command
(arged_command (cmd_identifier)
(iter_dbtb_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier)))))
(iter_dbts_command
(arged_command (cmd_identifier)
(iter_dbts_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))))
@ -145,9 +145,9 @@ p8 @@t
---
(commands
(iter_threads_command
(arged_command (cmd_identifier))))
(statements
(iter_threads_stmt
(arged_stmt (cmd_identifier))))
===============
@ -158,9 +158,9 @@ p8 @@b
---
(commands
(iter_bbs_command
(arged_command (cmd_identifier))))
(statements
(iter_bbs_stmt
(arged_stmt (cmd_identifier))))
===============
@ -171,9 +171,9 @@ p8 @@i
---
(commands
(iter_instrs_command
(arged_command (cmd_identifier))))
(statements
(iter_instrs_stmt
(arged_stmt (cmd_identifier))))
===============
@ -184,9 +184,9 @@ p8 @@ii
---
(commands
(iter_import_command
(arged_command (cmd_identifier))))
(statements
(iter_import_stmt
(arged_stmt (cmd_identifier))))
===============
@ -197,9 +197,9 @@ p8 @@iS
---
(commands
(iter_sections_command
(arged_command (cmd_identifier))))
(statements
(iter_sections_stmt
(arged_stmt (cmd_identifier))))
===============
@ -210,9 +210,9 @@ p8 @@iSS
---
(commands
(iter_segments_command
(arged_command (cmd_identifier))))
(statements
(iter_segments_stmt
(arged_stmt (cmd_identifier))))
===============
@ -223,9 +223,9 @@ p8 @@is
---
(commands
(iter_symbol_command
(arged_command (cmd_identifier))))
(statements
(iter_symbol_stmt
(arged_stmt (cmd_identifier))))
===============
@ -236,9 +236,9 @@ p8 @@iz
---
(commands
(iter_string_command
(arged_command (cmd_identifier))))
(statements
(iter_string_stmt
(arged_stmt (cmd_identifier))))
============
@ -250,12 +250,12 @@ p8 4 @@f:sym.*
---
(commands
(iter_flags_command
(arged_command (cmd_identifier)
(statements
(iter_flags_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier)))))
(iter_flags_command
(arged_command (cmd_identifier)
(iter_flags_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(arg (arg_identifier))))
@ -269,11 +269,11 @@ p8 @@F:lib*
---
(commands
(iter_function_command
(arged_command (cmd_identifier)))
(iter_function_command
(arged_command (cmd_identifier))
(statements
(iter_function_stmt
(arged_stmt (cmd_identifier)))
(iter_function_stmt
(arged_stmt (cmd_identifier))
(arg (arg_identifier))))
@ -285,9 +285,9 @@ pd @@om
---
(commands
(iter_iomap_command
(arged_command (cmd_identifier))))
(statements
(iter_iomap_stmt
(arged_stmt (cmd_identifier))))
==========
@ -298,9 +298,9 @@ pd @@dm
---
(commands
(iter_dbgmap_command
(arged_command (cmd_identifier))))
(statements
(iter_dbgmap_stmt
(arged_stmt (cmd_identifier))))
=============
@ -311,9 +311,9 @@ pd @@r
---
(commands
(iter_register_command
(arged_command (cmd_identifier))))
(statements
(iter_register_stmt
(arged_stmt (cmd_identifier))))
===============
@ -324,9 +324,9 @@ p8 @@s:0xd000 0xe000 0x100
---
(commands
(iter_step_command
(arged_command (cmd_identifier))
(statements
(iter_step_stmt
(arged_stmt (cmd_identifier))
(args
(arg (arg_identifier))
(arg (arg_identifier))

View file

@ -11,18 +11,18 @@ pfs fmt_name
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(pf_args (pf_arg (pf_arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(pf_args (pf_arg (pf_arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(pf_args (pf_arg (pf_arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(pf_args (pf_arg (pf_arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(pf_args (pf_arg (pf_arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(pf_args (pf_arg (pf_arg_identifier)))))
@ -39,33 +39,33 @@ pfs 3xi foo bar
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(pf_args
(pf_arg (pf_arg_identifier))
(pf_arg (pf_arg_identifier))
(pf_arg (pf_arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(pf_args
(pf_arg (pf_arg_identifier))
(pf_arg (pf_arg_identifier))
(pf_arg (pf_arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(pf_args
(pf_arg (pf_arg_identifier))
(pf_arg (pf_arg_identifier))
(pf_arg (pf_arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(pf_args
(pf_arg (pf_arg_identifier))
(pf_arg (pf_arg_identifier))
(pf_arg (pf_arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(pf_args
(pf_arg (pf_arg_identifier))
(pf_arg (pf_arg_identifier))
(pf_arg (pf_arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(pf_args
(pf_arg (pf_arg_identifier))
(pf_arg (pf_arg_identifier))
@ -80,8 +80,8 @@ pf.fmt_name
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(pf_dot_cmd_args (pf_args (pf_arg (pf_arg_identifier))))))
@ -95,20 +95,20 @@ pf.fmt_name.field_name[3]
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(pf_dot_cmd_args
(pf_args
(pf_arg (pf_arg_identifier))
(pf_arg (pf_arg_identifier)))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(pf_dot_cmd_args
(pf_args
(pf_arg (pf_arg_identifier))
(pf_arg (pf_arg_identifier)))
(pf_arg_identifier)
(pf_args (pf_arg (pf_arg_identifier)))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(pf_dot_cmd_args
(pf_args
(pf_arg (pf_arg_identifier))
@ -125,17 +125,17 @@ pfv.fmt_name.field_name=0xdeadbeef
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(pf_dot_cmd_args
(pf_args
(pf_arg (pf_arg_identifier)))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(pf_dot_cmd_args
(pf_args
(pf_arg (pf_arg_identifier))
(pf_arg (pf_arg_identifier)))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(pf_dot_cmd_args
(pf_args
(pf_arg (pf_arg_identifier))
@ -151,8 +151,8 @@ pf.obj xxdz prev next size name
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(pf_new_args
(pf_arg (pf_arg_identifier))
(pf_args
@ -171,8 +171,8 @@ pf.
---
(commands
(arged_command (cmd_identifier)))
(statements
(arged_stmt (cmd_identifier)))
=================
Pf load from file
@ -183,10 +183,10 @@ pfo
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(arged_command (cmd_identifier)))
(arged_stmt (cmd_identifier)))
==========================
@ -197,8 +197,8 @@ pf B (BitFldType)arg_name
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(pf_args
(pf_arg (pf_arg_identifier))
(pf_arg
@ -218,8 +218,8 @@ Cf-
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(args
(arg (arg_identifier))
(pf_args
@ -229,4 +229,4 @@ Cf-
(pf_arg (pf_arg_identifier))
(pf_arg (pf_arg_identifier))
(pf_arg (pf_arg_identifier)))))
(arged_command (cmd_identifier)))
(arged_stmt (cmd_identifier)))

View file

@ -6,9 +6,9 @@ p8 10 |
---
(commands
(html_disable_command
(arged_command (cmd_identifier)
(statements
(html_disable_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))))
======================
@ -19,9 +19,9 @@ p8 10 |H
---
(commands
(html_enable_command
(arged_command (cmd_identifier)
(statements
(html_enable_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))))
======================
@ -32,11 +32,11 @@ p8 10 | grep 10
---
(commands
(pipe_command
(arged_command (cmd_identifier)
(statements
(pipe_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(pipe_second_command)))
(pipe_second_stmt)))
===========
Double pipe
@ -46,13 +46,13 @@ pd 10 | cat | grep mov
---
(commands
(pipe_command
(pipe_command
(arged_command (cmd_identifier)
(statements
(pipe_stmt
(pipe_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(pipe_second_command))
(pipe_second_command)))
(pipe_second_stmt))
(pipe_second_stmt)))
===================================
Pipe to another command with no arg
@ -62,10 +62,10 @@ f | grep main
---
(commands
(pipe_command
(arged_command (cmd_identifier))
(pipe_second_command)))
(statements
(pipe_stmt
(arged_stmt (cmd_identifier))
(pipe_second_stmt)))
=======================
Pipe to interpreter "."
@ -75,7 +75,7 @@ p8 10 |.
---
(commands
(arged_command
(arged_command (cmd_identifier)
(statements
(arged_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))))

View file

@ -6,8 +6,8 @@ Echo with (double) quoted args
---
(commands
(arged_command command: (cmd_identifier)
(statements
(arged_stmt command: (cmd_identifier)
args: (args (arg (double_quoted_arg)))))
==============================
@ -18,8 +18,8 @@ Echo with (single) quoted args
---
(commands
(arged_command command: (cmd_identifier)
(statements
(arged_stmt command: (cmd_identifier)
args: (args (arg (single_quoted_arg)))))
@ -31,8 +31,8 @@ Legacy command - all quoted
---
(commands
(legacy_quoted_command))
(statements
(legacy_quoted_stmt))
=======================================
@ -43,12 +43,12 @@ Double quoted arg with cmd substitution
---
(commands
(arged_command command: (cmd_identifier)
(statements
(arged_stmt command: (cmd_identifier)
args: (args
(arg (double_quoted_arg
(cmd_substitution_arg
(arged_command command: (cmd_identifier)
(arged_stmt command: (cmd_identifier)
args: (args
(arg (double_quoted_arg))))))))))
@ -62,13 +62,13 @@ Quoted hash
---
(commands
(arged_command command: (cmd_identifier)
(statements
(arged_stmt command: (cmd_identifier)
args: (args (arg (double_quoted_arg))))
(arged_command command: (cmd_identifier)
(arged_stmt command: (cmd_identifier)
args: (args
(arg (double_quoted_arg
(cmd_substitution_arg
(arged_command command: (cmd_identifier)))))))
(arged_command command: (cmd_identifier)
(arged_stmt command: (cmd_identifier)))))))
(arged_stmt command: (cmd_identifier)
args: (args (arg (single_quoted_arg)))))

View file

@ -6,9 +6,9 @@ afl > /tmp/test.txt
---
(commands
(redirect_command
(arged_command (cmd_identifier))
(statements
(redirect_stmt
(arged_stmt (cmd_identifier))
(fdn_redirect_operator)
(arg (arg_identifier))))
@ -21,9 +21,9 @@ afl 2> /tmp/test.txt
---
(commands
(redirect_command
(arged_command (cmd_identifier))
(statements
(redirect_stmt
(arged_stmt (cmd_identifier))
(fdn_redirect_operator (file_descriptor))
(arg (arg_identifier))))
@ -36,9 +36,9 @@ afl H> /tmp/test.txt
---
(commands
(redirect_command
(arged_command (cmd_identifier))
(statements
(redirect_stmt
(arged_stmt (cmd_identifier))
(html_redirect_operator)
(arg (arg_identifier))))
@ -51,9 +51,9 @@ afl >> /tmp/test.txt
---
(commands
(redirect_command
(arged_command (cmd_identifier))
(statements
(redirect_stmt
(arged_stmt (cmd_identifier))
(fdn_append_operator)
(arg (arg_identifier))))
@ -66,8 +66,8 @@ afl 2>> /tmp/test.txt
---
(commands
(redirect_command
(arged_command (cmd_identifier))
(statements
(redirect_stmt
(arged_stmt (cmd_identifier))
(fdn_append_operator (file_descriptor))
(arg (arg_identifier))))

View file

@ -1,30 +1,30 @@
=========================
One digit repeat commands
One digit repeat statements
=========================
7/x 90
---
(commands
(repeat_command
(statements
(repeat_stmt
(number)
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))))
=========================
Multiple digits repeat commands
Multiple digits repeat statements
=========================
17/x 90
---
(commands
(repeat_command
(statements
(repeat_stmt
(number)
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))))
@ -36,11 +36,11 @@ Repeat with redirection
---
(commands
(redirect_command
(repeat_command
(statements
(redirect_stmt
(repeat_stmt
(number)
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier)))))
(fdn_redirect_operator)
(arg (arg_identifier))))
@ -54,10 +54,10 @@ Repeat with tmp seek
---
(commands
(tmp_seek_command
(repeat_command
(statements
(tmp_seek_stmt
(repeat_stmt
(number)
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier)))))
(args (arg (arg_identifier)))))

View file

@ -6,8 +6,8 @@ Simple search
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(args (arg (double_quoted_arg)))))
@ -20,10 +20,10 @@ Not matching
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier)))))
@ -35,8 +35,8 @@ Reg exp
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier)))))
@ -48,6 +48,6 @@ Search with nibbles
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier)))))

View file

@ -7,9 +7,9 @@ afl
---
(commands
(arged_command (cmd_identifier))
(arged_command (cmd_identifier)))
(statements
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier)))
=============
One argument
@ -19,28 +19,28 @@ af 0xdeadbeef
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier)))))
==============================
Semi-colon separated commands
Semi-colon separated statements
==============================
afl;af 0xdeadbeef ; afl
---
(commands
(arged_command (cmd_identifier))
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(arged_command (cmd_identifier)))
(arged_stmt (cmd_identifier)))
=========================
Newline separate commands
Newline separate statements
=========================
afl
@ -48,14 +48,14 @@ af 0xdeadbeef
---
(commands
(arged_command (cmd_identifier))
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier)))))
======================
Question mark commands
Question mark statements
======================
? x
@ -63,25 +63,25 @@ Question mark commands
???
?t cmd
?x hello
e? cfg.newshell
e? cfg.oldshell
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(arged_command (cmd_identifier))
(help_command (cmd_identifier))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier))
(help_stmt (cmd_identifier))
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier)))))
===============
Search commands
Search statements
===============
/x 90
@ -89,10 +89,10 @@ Search commands
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier)))))
@ -106,14 +106,14 @@ aflj
---
(commands
(arged_command (cmd_identifier))
(arged_command (cmd_identifier))
(arged_command (cmd_identifier)))
(statements
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier)))
=============
Help commands
Help statements
=============
?
@ -142,30 +142,30 @@ pf???
---
(commands
(help_command (cmd_identifier))
(help_command (cmd_identifier))
(help_command (cmd_identifier))
(help_command (cmd_identifier))
(help_command (cmd_identifier))
(help_command (cmd_identifier))
(help_command (cmd_identifier))
(help_command (cmd_identifier))
(help_command (cmd_identifier))
(help_command (cmd_identifier))
(help_command (cmd_identifier))
(help_command (cmd_identifier))
(help_command (cmd_identifier))
(help_command (cmd_identifier))
(help_command (cmd_identifier))
(help_command (cmd_identifier))
(arged_command (cmd_identifier))
(help_command (cmd_identifier))
(help_command (cmd_identifier))
(help_command (cmd_identifier))
(help_command (cmd_identifier))
(help_command (cmd_identifier))
(help_command (cmd_identifier)))
(statements
(help_stmt (cmd_identifier))
(help_stmt (cmd_identifier))
(help_stmt (cmd_identifier))
(help_stmt (cmd_identifier))
(help_stmt (cmd_identifier))
(help_stmt (cmd_identifier))
(help_stmt (cmd_identifier))
(help_stmt (cmd_identifier))
(help_stmt (cmd_identifier))
(help_stmt (cmd_identifier))
(help_stmt (cmd_identifier))
(help_stmt (cmd_identifier))
(help_stmt (cmd_identifier))
(help_stmt (cmd_identifier))
(help_stmt (cmd_identifier))
(help_stmt (cmd_identifier))
(arged_stmt (cmd_identifier))
(help_stmt (cmd_identifier))
(help_stmt (cmd_identifier))
(help_stmt (cmd_identifier))
(help_stmt (cmd_identifier))
(help_stmt (cmd_identifier))
(help_stmt (cmd_identifier)))
===============================
@ -176,8 +176,8 @@ Command with concatenation args
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(args
(arg
(concatenation
@ -200,12 +200,12 @@ Number command
---
(commands
(number_command)
(number_command)
(number_command) (ERROR)
(number_command)
(number_command) (ERROR))
(statements
(number_stmt)
(number_stmt)
(number_stmt) (ERROR)
(number_stmt)
(number_stmt) (ERROR))
=============
@ -219,15 +219,15 @@ Tasks command
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(args
(arg (arg_identifier))
(arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(arged_command (cmd_identifier))
(arged_command (cmd_identifier)))
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier)))
==============
@ -238,8 +238,8 @@ Arg with (...)
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(args
(arg
(concatenation
@ -258,8 +258,8 @@ Expressions with (...)
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(args
(arg (args
(arg_identifier)
@ -292,22 +292,22 @@ s $
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args
(arg (arg_identifier))
(arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier)))))
@ -321,12 +321,12 @@ md /root/
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier)))))
@ -339,10 +339,10 @@ md /root/
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(help_command (cmd_identifier)))
(help_stmt (cmd_identifier)))
=============================
@ -357,12 +357,12 @@ pd\@0xdeadbeef
---
(commands
(arged_command (cmd_identifier))
(arged_command (cmd_identifier))
(arged_command (cmd_identifier))
(arged_command (cmd_identifier))
(arged_command (cmd_identifier)))
(statements
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier)))
===========
UTF-8 chars
@ -372,8 +372,8 @@ rz-find -S واسع bins/pe/testapp-msvc64.exe
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(args
(arg (arg_identifier))
(arg (arg_identifier))

View file

@ -1,5 +1,5 @@
======================
Pointer type commands
Pointer type statements
======================
*entry0
@ -8,15 +8,15 @@ Pointer type commands
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(args
(arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args
(arg (arg_identifier))
(arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args
(arg (arg_identifier))
(arg (arg_identifier)))))
@ -34,26 +34,26 @@ Environment variable command
---
(commands
(arged_command (cmd_identifier))
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier)
(args
(arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args
(arg (arg_identifier))
(arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args
(arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args
(arg (arg_identifier))
(arg (arg_identifier)))))
===============
Macro commands
Macro statements
===============
(_foo x y; p8 $0 @ $1)
@ -66,31 +66,31 @@ Macro commands
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(macro_args
(macro_content
(arg (arg_identifier))
(args
(arg (arg_identifier))
(arg (arg_identifier)))
(tmp_seek_command
(arged_command (cmd_identifier)
(tmp_seek_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(args (arg (arg_identifier)))))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(macro_args
(macro_content
(arg (arg_identifier)))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(macro_args
(macro_content
(arg (arg_identifier))
(args
(arg (arg_identifier))
(arg (arg_identifier)))
(tmp_seek_command
(arged_command (cmd_identifier)
(tmp_seek_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(args (arg (arg_identifier)))))
(macro_call_full_content
@ -98,42 +98,42 @@ Macro commands
(args
(arg (arg_identifier))
(arg (arg_identifier)))))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(macro_args
(macro_content
(arg (arg_identifier))
(args (arg (arg_identifier)))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(macro_call_content
(args
(arg (arg_identifier))
(arg (arg_identifier)))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(macro_call_content
(args
(arg (arg_identifier))
(arg (arg_identifier)))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(macro_call_content
(args
(arg (arg_identifier))
(arg (arg_identifier))))))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(macro_args
(macro_content
(arg (arg_identifier))
(grep_command
(arged_command (cmd_identifier)
(grep_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(grep_specifier (grep_specifier_identifier))))))
(arged_command (cmd_identifier))
(arged_command (cmd_identifier)))
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier)))
===============
System commands
System statements
===============
!
@ -144,14 +144,14 @@ System commands
---
(commands
(arged_command (system_identifier))
(arged_command (system_identifier)
(statements
(arged_stmt (system_identifier))
(arged_stmt (system_identifier)
(args (arg (arg_identifier))))
(arged_command (system_identifier))
(arged_command (system_identifier)
(arged_stmt (system_identifier))
(arged_stmt (system_identifier)
(args (arg (arg_identifier))))
(arged_command (system_identifier)
(arged_stmt (system_identifier)
(args
(arg (arg_identifier))
(arg (arg_identifier))
@ -160,7 +160,7 @@ System commands
===================
Interpret r2 commands
Interpret r2 statements
===================
.cmd a1
@ -174,24 +174,24 @@ pd 10 |.
---
(commands
(arged_command
(statements
(arged_stmt
command: (cmd_identifier)
args: (arged_command command: (cmd_identifier)
args: (arged_stmt command: (cmd_identifier)
args: (args (arg (arg_identifier)))))
(arged_command
(arged_stmt
command: (cmd_identifier)
args: (args (arg (arg_identifier))))
(arged_command
(arged_stmt
command: (cmd_identifier)
args: (args (arg (arg_identifier))))
(arged_command
(arged_stmt
command: (cmd_identifier)
args: (args (arg (arg_identifier))))
(arged_command
(arged_stmt
command: (cmd_identifier)
args: (interpret_arg))
(arged_command
(arged_stmt
command: (cmd_identifier)
args: (macro_call_content
(args
@ -199,11 +199,11 @@ pd 10 |.
(arg (arg_identifier))
(arg (arg_identifier))
(arg (arg_identifier)))))
(arged_command
(arged_stmt
command: (cmd_identifier)
args: (args (arg (arg_identifier))))
(arged_command
args: (arged_command command: (cmd_identifier)
(arged_stmt
args: (arged_stmt command: (cmd_identifier)
args: (args (arg (arg_identifier)))))
)
@ -217,12 +217,12 @@ Last cmd
---
(commands
(arged_command (cmd_identifier))
(arged_command (cmd_identifier)))
(statements
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier)))
===================
Interpreter commands
Interpreter statements
===================
#!
@ -232,38 +232,38 @@ Interpreter commands
---
(commands
(arged_command (cmd_identifier))
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier)
(args
(arg (arg_identifier))
(arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args
(arg (arg_identifier))))
(help_command (cmd_identifier)))
(help_stmt (cmd_identifier)))
=======================================
Pointer type commands with substitution
Pointer type statements with substitution
=======================================
*entr$(?e y0)=$(?v $$)
---
(commands
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier)
(args
(arg
(concatenation
(arg_identifier)
(cmd_substitution_arg
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier)))))))
(arg
(cmd_substitution_arg
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier)))))))))
========
@ -274,8 +274,8 @@ editor -
---
(commands
(arged_command (cmd_identifier)))
(statements
(arged_stmt (cmd_identifier)))
=========
\ command
@ -285,12 +285,12 @@ editor -
---
(commands
(arged_command (cmd_identifier)))
(statements
(arged_stmt (cmd_identifier)))
==============
R commands
R statements
==============
R
@ -307,31 +307,31 @@ R&r 3000
---
(commands
(arged_command (cmd_identifier))
(arged_command (cmd_identifier))
(arged_command (cmd_identifier)
(statements
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier)
(args
(arg (arg_identifier))
(arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args
(arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args
(arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args
(arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args
(arg (arg_identifier))))
(arged_command (cmd_identifier))
(arged_command (cmd_identifier))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier))
(arged_stmt (cmd_identifier)
(args
(arg (arg_identifier))
(arg (arg_identifier))))
(arged_command (cmd_identifier)
(arged_stmt (cmd_identifier)
(args
(arg (arg_identifier)))))

View file

@ -6,8 +6,8 @@ Temporary changes help
---
(commands
(help_command (cmd_identifier)))
(statements
(help_stmt (cmd_identifier)))
==============
Temporary seek
@ -18,13 +18,13 @@ p8 10 @ flag
---
(commands
(tmp_seek_command
(arged_command (cmd_identifier)
(statements
(tmp_seek_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(args (arg (arg_identifier))))
(tmp_seek_command
(arged_command (cmd_identifier)
(tmp_seek_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(args (arg (arg_identifier)))))
@ -37,9 +37,9 @@ p8 10 @! 30
---
(commands
(tmp_blksz_command
(arged_command (cmd_identifier)
(statements
(tmp_blksz_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(args (arg (arg_identifier)))))
@ -52,9 +52,9 @@ Temporary from/to
---
(commands
(tmp_fromto_command
(arged_command (cmd_identifier)
(statements
(tmp_fromto_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(args
(arg (arg_identifier))
@ -69,9 +69,9 @@ pd 2 @a:x86
---
(commands
(tmp_arch_command
(arged_command (cmd_identifier)
(statements
(tmp_arch_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(arg (arg_identifier))))
@ -83,9 +83,9 @@ pd 2 @b:16
---
(commands
(tmp_bits_command
(arged_command (cmd_identifier)
(statements
(tmp_bits_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(args (arg (arg_identifier)))))
@ -97,9 +97,9 @@ pd 2 @B:3
---
(commands
(tmp_nthi_command
(arged_command (cmd_identifier)
(statements
(tmp_nthi_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(arg (arg_identifier))))
@ -112,13 +112,13 @@ pd 2 @e:asm.arch=x86,scr.utf8=true
---
(commands
(tmp_eval_command
(arged_command command: (cmd_identifier)
(statements
(tmp_eval_stmt
(arged_stmt command: (cmd_identifier)
args: (args (arg (arg_identifier))))
(tmp_eval_args (tmp_eval_arg)))
(tmp_eval_command
(arged_command command: (cmd_identifier)
(tmp_eval_stmt
(arged_stmt command: (cmd_identifier)
args: (args (arg (arg_identifier))))
(tmp_eval_args
(tmp_eval_arg)
@ -132,9 +132,9 @@ f @F:symbols
---
(commands
(tmp_fs_command
(arged_command (cmd_identifier))
(statements
(tmp_fs_stmt
(arged_stmt (cmd_identifier))
(arg (arg_identifier))))
=================
@ -145,9 +145,9 @@ pd 2 @i:4
---
(commands
(tmp_reli_command
(arged_command (cmd_identifier)
(statements
(tmp_reli_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(args (arg (arg_identifier)))))
@ -159,9 +159,9 @@ pd @k:key
---
(commands
(tmp_kuery_command
(arged_command (cmd_identifier))
(statements
(tmp_kuery_stmt
(arged_stmt (cmd_identifier))
(arg (arg_identifier))))
=================
@ -172,9 +172,9 @@ pd @o:3
---
(commands
(tmp_fd_command
(arged_command (cmd_identifier))
(statements
(tmp_fd_stmt
(arged_stmt (cmd_identifier))
(args (arg (arg_identifier)))))
=================
@ -185,9 +185,9 @@ pd @r:rax
---
(commands
(tmp_reg_command
(arged_command (cmd_identifier))
(statements
(tmp_reg_stmt
(arged_stmt (cmd_identifier))
(arg (arg_identifier))))
=================
@ -198,9 +198,9 @@ pd @f:myfile
---
(commands
(tmp_file_command
(arged_command (cmd_identifier))
(statements
(tmp_file_stmt
(arged_stmt (cmd_identifier))
(arg (arg_identifier))))
@ -212,9 +212,9 @@ pd @s:mystring
---
(commands
(tmp_string_command
(arged_command (cmd_identifier))
(statements
(tmp_string_stmt
(arged_stmt (cmd_identifier))
(arg (arg_identifier))))
@ -226,9 +226,9 @@ pd @x:90deadbeef
---
(commands
(tmp_hex_command
(arged_command (cmd_identifier))
(statements
(tmp_hex_stmt
(arged_stmt (cmd_identifier))
(arg (arg_identifier))))
@ -240,11 +240,11 @@ p8 4 @ 0xdead @a:x86 > /tmp/out.txt
---
(commands
(redirect_command
(tmp_arch_command
(tmp_seek_command
(arged_command (cmd_identifier)
(statements
(redirect_stmt
(tmp_arch_stmt
(tmp_seek_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(args (arg (arg_identifier))))
(arg (arg_identifier)))
@ -257,9 +257,9 @@ Spaces after tmp_seek
=====================
wx 0x68a0a@entry0
---
(commands
(tmp_seek_command
(arged_command (cmd_identifier)
(statements
(tmp_seek_stmt
(arged_stmt (cmd_identifier)
(args (arg (arg_identifier))))
(args (arg (arg_identifier)))))
@ -272,9 +272,9 @@ pd @ entry0 + 2
---
(commands
(tmp_seek_command
(arged_command (cmd_identifier))
(statements
(tmp_seek_stmt
(arged_stmt (cmd_identifier))
(args
(arg (arg_identifier))
(arg (arg_identifier))
@ -288,7 +288,7 @@ pv4 @v:0xdeadbeef
---
(commands
(tmp_value_command
(arged_command (cmd_identifier))
(statements
(tmp_value_stmt
(arged_stmt (cmd_identifier))
(arg (arg_identifier))))

View file

@ -50,7 +50,7 @@ module.exports = grammar({
externals: ($) => [
$._cmd_identifier,
$._help_command,
$._help_stmt,
$.file_descriptor,
$._eq_sep_concat,
$._concat,
@ -58,96 +58,96 @@ module.exports = grammar({
$._spec_sep,
],
inline: ($) => [$.cmd_delimiter, $.cmd_delimiter_singleline, $._comment],
inline: ($) => [$.stmt_delimiter, $.stmt_delimiter_singleline, $._comment],
rules: {
commands: ($) =>
statements: ($) =>
choice(
seq(),
seq(repeat($.cmd_delimiter)),
seq(repeat($.cmd_delimiter), $._command, repeat(seq($.cmd_delimiter, optional($._command))))
seq(repeat($.stmt_delimiter)),
seq(repeat($.stmt_delimiter), $._statement, repeat(seq($.stmt_delimiter, optional($._statement))))
),
_commands_singleline: ($) =>
_statements_singleline: ($) =>
prec(
1,
seq(
repeat($.cmd_delimiter_singleline),
$._command,
repeat(seq($.cmd_delimiter_singleline, optional($._command)))
repeat($.stmt_delimiter_singleline),
$._statement,
repeat(seq($.stmt_delimiter_singleline, optional($._statement)))
)
),
_command: ($) => choice($.redirect_command, $._simple_command),
_statement: ($) => choice($.redirect_stmt, $._simple_stmt),
legacy_quoted_command: ($) => seq('"', field("string", token(prec(-1, /([^"\\]|\\(.|\n))+/))), '"'),
legacy_quoted_stmt: ($) => seq('"', field("string", token(prec(-1, /([^"\\]|\\(.|\n))+/))), '"'),
_simple_command: ($) =>
_simple_stmt: ($) =>
choice(
$.help_command,
$.repeat_command,
$.arged_command,
$.number_command,
$._tmp_command,
$._iter_command,
$._pipe_command,
$.grep_command,
$.legacy_quoted_command,
$._pf_commands
$.help_stmt,
$.repeat_stmt,
$.arged_stmt,
$.number_stmt,
$._tmp_stmt,
$._iter_stmt,
$._pipe_stmt,
$.grep_stmt,
$.legacy_quoted_stmt,
$._pf_stmts
),
_tmp_command: ($) =>
_tmp_stmt: ($) =>
choice(
$.tmp_seek_command,
$.tmp_blksz_command,
$.tmp_fromto_command,
$.tmp_arch_command,
$.tmp_bits_command,
$.tmp_nthi_command,
$.tmp_eval_command,
$.tmp_fs_command,
$.tmp_reli_command,
$.tmp_kuery_command,
$.tmp_fd_command,
$.tmp_reg_command,
$.tmp_file_command,
$.tmp_string_command,
$.tmp_value_command,
$.tmp_hex_command
$.tmp_seek_stmt,
$.tmp_blksz_stmt,
$.tmp_fromto_stmt,
$.tmp_arch_stmt,
$.tmp_bits_stmt,
$.tmp_nthi_stmt,
$.tmp_eval_stmt,
$.tmp_fs_stmt,
$.tmp_reli_stmt,
$.tmp_kuery_stmt,
$.tmp_fd_stmt,
$.tmp_reg_stmt,
$.tmp_file_stmt,
$.tmp_string_stmt,
$.tmp_value_stmt,
$.tmp_hex_stmt
),
_iter_command: ($) =>
_iter_stmt: ($) =>
choice(
$.iter_file_lines_command,
$.iter_offsets_command,
$.iter_offsetssizes_command,
$.iter_hit_command,
$.iter_interpret_command,
$.iter_interpret_offsetssizes_command,
$.iter_comment_command,
$.iter_dbta_command,
$.iter_dbtb_command,
$.iter_dbts_command,
$.iter_threads_command,
$.iter_bbs_command,
$.iter_instrs_command,
$.iter_import_command,
$.iter_sections_command,
$.iter_segments_command,
$.iter_symbol_command,
$.iter_string_command,
$.iter_flags_command,
$.iter_function_command,
$.iter_iomap_command,
$.iter_dbgmap_command,
$.iter_register_command,
$.iter_step_command
$.iter_file_lines_stmt,
$.iter_offsets_stmt,
$.iter_offsetssizes_stmt,
$.iter_hit_stmt,
$.iter_interpret_stmt,
$.iter_interpret_offsetssizes_stmt,
$.iter_comment_stmt,
$.iter_dbta_stmt,
$.iter_dbtb_stmt,
$.iter_dbts_stmt,
$.iter_threads_stmt,
$.iter_bbs_stmt,
$.iter_instrs_stmt,
$.iter_import_stmt,
$.iter_sections_stmt,
$.iter_segments_stmt,
$.iter_symbol_stmt,
$.iter_string_stmt,
$.iter_flags_stmt,
$.iter_function_stmt,
$.iter_iomap_stmt,
$.iter_dbgmap_stmt,
$.iter_register_stmt,
$.iter_step_stmt
),
_pipe_command: ($) => choice($.html_disable_command, $.html_enable_command, $.pipe_command),
_pipe_stmt: ($) => choice($.html_disable_stmt, $.html_enable_stmt, $.pipe_stmt),
grep_command: ($) => seq(field("command", $._simple_command), "~", field("specifier", $.grep_specifier)),
grep_stmt: ($) => seq(field("command", $._simple_stmt), "~", field("specifier", $.grep_specifier)),
// FIXME: improve parser for grep specifier
// grep_specifier_identifier also includes ~ because r2 does not support nested grep commands yet
// grep_specifier_identifier also includes ~ because r2 does not support nested grep statements yet
grep_specifier_identifier: ($) => token(seq(repeat1(choice(/[^\n\r;#@>|`$()]+/, /\\./, /\$[^(\r\n;#>|`]/)))),
grep_specifier: ($) =>
prec.left(
@ -160,92 +160,90 @@ module.exports = grammar({
)
),
html_disable_command: ($) => prec.right(1, seq(field("command", $._simple_command), "|")),
html_enable_command: ($) => prec.right(1, seq(field("command", $._simple_command), "|H")),
pipe_command: ($) => seq($._simple_command, "|", $.pipe_second_command),
pipe_second_command: ($) => /[^|\r\n;]+/,
html_disable_stmt: ($) => prec.right(1, seq(field("command", $._simple_stmt), "|")),
html_enable_stmt: ($) => prec.right(1, seq(field("command", $._simple_stmt), "|H")),
pipe_stmt: ($) => seq($._simple_stmt, "|", $.pipe_second_stmt),
pipe_second_stmt: ($) => /[^|\r\n;]+/,
iter_file_lines_command: ($) => prec.right(1, seq($._simple_command, "@@.", $.arg)),
iter_offsets_command: ($) => prec.right(1, seq($._simple_command, "@@=", optional($.args))),
iter_offsetssizes_command: ($) => prec.right(1, seq($._simple_command, "@@@=", optional($.args))),
iter_hit_command: ($) =>
prec.right(1, seq($._simple_command, "@@", $._concat, alias($._search_command, $.arged_command))),
iter_interpret_command: ($) => prec.right(1, seq($._simple_command, "@@c:", $._simple_command)),
iter_interpret_offsetssizes_command: ($) => prec.right(1, seq($._simple_command, "@@@c:", $._simple_command)),
iter_comment_command: ($) => prec.right(1, seq($._simple_command, "@@C", optional(seq(":", $.arg)))),
iter_dbta_command: ($) => prec.right(1, seq($._simple_command, choice("@@dbt", "@@dbta"))),
iter_dbtb_command: ($) => prec.right(1, seq($._simple_command, "@@dbtb")),
iter_dbts_command: ($) => prec.right(1, seq($._simple_command, "@@dbts")),
iter_threads_command: ($) => prec.right(1, seq($._simple_command, "@@t")),
iter_bbs_command: ($) => prec.right(1, seq($._simple_command, "@@b")),
iter_instrs_command: ($) => prec.right(1, seq($._simple_command, "@@i")),
iter_import_command: ($) => prec.right(1, seq($._simple_command, "@@ii")),
iter_sections_command: ($) => prec.right(1, seq($._simple_command, "@@iS")),
iter_segments_command: ($) => prec.right(1, seq($._simple_command, "@@iSS")),
iter_symbol_command: ($) => prec.right(1, seq($._simple_command, "@@is")),
iter_string_command: ($) => prec.right(1, seq($._simple_command, "@@iz")),
iter_flags_command: ($) => prec.right(1, seq($._simple_command, "@@f", optional(seq(":", $.arg)))),
iter_function_command: ($) => prec.right(1, seq($._simple_command, "@@F", optional(seq(":", $.arg)))),
iter_iomap_command: ($) => prec.right(1, seq($._simple_command, "@@om")),
iter_dbgmap_command: ($) => prec.right(1, seq($._simple_command, "@@dm")),
iter_register_command: ($) => prec.right(1, seq($._simple_command, "@@r")),
iter_step_command: ($) => prec.right(1, seq($._simple_command, "@@s:", $.args)),
iter_file_lines_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@.", $.arg)),
iter_offsets_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@=", optional($.args))),
iter_offsetssizes_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@@=", optional($.args))),
iter_hit_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@", $._concat, alias($._search_stmt, $.arged_stmt))),
iter_interpret_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@c:", $._simple_stmt)),
iter_interpret_offsetssizes_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@@c:", $._simple_stmt)),
iter_comment_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@C", optional(seq(":", $.arg)))),
iter_dbta_stmt: ($) => prec.right(1, seq($._simple_stmt, choice("@@dbt", "@@dbta"))),
iter_dbtb_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@dbtb")),
iter_dbts_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@dbts")),
iter_threads_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@t")),
iter_bbs_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@b")),
iter_instrs_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@i")),
iter_import_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@ii")),
iter_sections_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@iS")),
iter_segments_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@iSS")),
iter_symbol_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@is")),
iter_string_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@iz")),
iter_flags_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@f", optional(seq(":", $.arg)))),
iter_function_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@F", optional(seq(":", $.arg)))),
iter_iomap_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@om")),
iter_dbgmap_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@dm")),
iter_register_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@r")),
iter_step_stmt: ($) => prec.right(1, seq($._simple_stmt, "@@s:", $.args)),
// tmp changes commands
tmp_seek_command: ($) => prec.right(1, seq($._simple_command, "@", $.args)),
tmp_blksz_command: ($) => prec.right(1, seq($._simple_command, "@!", $.args)),
tmp_fromto_command: ($) => prec.right(1, seq($._simple_command, "@(", $.args, ")")),
tmp_arch_command: ($) => prec.right(1, seq($._simple_command, "@a:", $.arg)),
tmp_bits_command: ($) => prec.right(1, seq($._simple_command, "@b:", $.args)),
tmp_nthi_command: ($) => prec.right(1, seq($._simple_command, "@B:", $.arg)),
tmp_eval_command: ($) => prec.right(1, seq($._simple_command, "@e:", $.tmp_eval_args)),
tmp_fs_command: ($) => prec.right(1, seq($._simple_command, "@F:", $.arg)),
tmp_reli_command: ($) => prec.right(1, seq($._simple_command, "@i:", $.args)),
tmp_kuery_command: ($) => prec.right(1, seq($._simple_command, "@k:", $.arg)),
tmp_fd_command: ($) => prec.right(1, seq($._simple_command, "@o:", $.args)),
tmp_reg_command: ($) => prec.right(1, seq($._simple_command, "@r:", $.arg)),
tmp_file_command: ($) => prec.right(1, seq($._simple_command, "@f:", $.arg)),
tmp_string_command: ($) => prec.right(1, seq($._simple_command, "@s:", $.arg)),
tmp_value_command: ($) => prec.right(1, seq($._simple_command, "@v:", $.arg)),
tmp_hex_command: ($) => prec.right(1, seq($._simple_command, "@x:", $.arg)),
// tmp changes statements
tmp_seek_stmt: ($) => prec.right(1, seq($._simple_stmt, "@", $.args)),
tmp_blksz_stmt: ($) => prec.right(1, seq($._simple_stmt, "@!", $.args)),
tmp_fromto_stmt: ($) => prec.right(1, seq($._simple_stmt, "@(", $.args, ")")),
tmp_arch_stmt: ($) => prec.right(1, seq($._simple_stmt, "@a:", $.arg)),
tmp_bits_stmt: ($) => prec.right(1, seq($._simple_stmt, "@b:", $.args)),
tmp_nthi_stmt: ($) => prec.right(1, seq($._simple_stmt, "@B:", $.arg)),
tmp_eval_stmt: ($) => prec.right(1, seq($._simple_stmt, "@e:", $.tmp_eval_args)),
tmp_fs_stmt: ($) => prec.right(1, seq($._simple_stmt, "@F:", $.arg)),
tmp_reli_stmt: ($) => prec.right(1, seq($._simple_stmt, "@i:", $.args)),
tmp_kuery_stmt: ($) => prec.right(1, seq($._simple_stmt, "@k:", $.arg)),
tmp_fd_stmt: ($) => prec.right(1, seq($._simple_stmt, "@o:", $.args)),
tmp_reg_stmt: ($) => prec.right(1, seq($._simple_stmt, "@r:", $.arg)),
tmp_file_stmt: ($) => prec.right(1, seq($._simple_stmt, "@f:", $.arg)),
tmp_string_stmt: ($) => prec.right(1, seq($._simple_stmt, "@s:", $.arg)),
tmp_value_stmt: ($) => prec.right(1, seq($._simple_stmt, "@v:", $.arg)),
tmp_hex_stmt: ($) => prec.right(1, seq($._simple_stmt, "@x:", $.arg)),
// basic commands
number_command: ($) => choice($._dec_number, "0", /(0x[0-9A-Fa-f]+|0b[0-1]+)/),
help_command: ($) =>
// basic statements
number_stmt: ($) => choice($._dec_number, "0", /(0x[0-9A-Fa-f]+|0b[0-1]+)/),
help_stmt: ($) =>
prec.left(
1,
choice(
field("command", alias($.question_mark_identifier, $.cmd_identifier)),
field("command", alias($._help_command, $.cmd_identifier))
field("command", alias($._help_stmt, $.cmd_identifier))
)
),
arged_command: ($) =>
arged_stmt: ($) =>
choice(
$._simple_arged_command,
$._math_arged_command,
$._pointer_arged_command,
$._macro_arged_command,
$._system_command,
$._interpret_command,
$._env_command,
$._pf_arged_command,
$._last_command,
$._simple_arged_command_question
$._simple_arged_stmt,
$._math_arged_stmt,
$._pointer_arged_stmt,
$._macro_arged_stmt,
$._system_stmt,
$._interpret_stmt,
$._env_stmt,
$._pf_arged_stmt,
$._last_stmt,
$._simple_arged_stmt_question
),
_simple_arged_command_question: ($) =>
prec.left(1, seq(field("command", alias($._help_command, $.cmd_identifier)), field("args", $.args))),
_simple_arged_stmt_question: ($) =>
prec.left(1, seq(field("command", alias($._help_stmt, $.cmd_identifier)), field("args", $.args))),
_simple_arged_command: ($) =>
prec.left(1, seq(field("command", $.cmd_identifier), field("args", optional($.args)))),
_search_command: ($) =>
_simple_arged_stmt: ($) => prec.left(1, seq(field("command", $.cmd_identifier), field("args", optional($.args)))),
_search_stmt: ($) =>
prec.left(
1,
seq(field("command", alias(/\/[A-Za-z0-9+!\/*]*/, $.cmd_identifier)), field("args", optional($.args)))
),
_math_arged_command: ($) =>
_math_arged_stmt: ($) =>
prec.left(1, seq(field("command", alias($.question_mark_identifier, $.cmd_identifier)), field("args", $.args))),
_pointer_arged_command: ($) =>
_pointer_arged_stmt: ($) =>
prec.left(
1,
seq(
@ -253,44 +251,44 @@ module.exports = grammar({
field("args", alias($.eq_sep_args, $.args))
)
),
_macro_arged_command: ($) =>
_macro_arged_stmt: ($) =>
prec.left(
1,
seq(field("command", alias($.macro_identifier, $.cmd_identifier)), field("args", optional($.macro_args)))
),
_system_command: ($) => prec.left(1, seq(field("command", $.system_identifier), optional(field("args", $.args)))),
_interpret_command: ($) =>
_system_stmt: ($) => prec.left(1, seq(field("command", $.system_identifier), optional(field("args", $.args)))),
_interpret_stmt: ($) =>
prec.left(
1,
choice(
seq(field("command", alias(".", $.cmd_identifier)), field("args", $._simple_command)),
seq(field("command", alias(".", $.cmd_identifier)), field("args", $._simple_stmt)),
seq(field("command", alias(/\.[\.:\-*]+/, $.cmd_identifier)), /[ ]+/, field("args", optional($.args))),
seq(field("command", alias(/\.[ ]+/, $.cmd_identifier)), field("args", optional($.args))),
seq(field("command", alias(".!", $.cmd_identifier)), field("args", $.interpret_arg)),
seq(field("command", alias(".(", $.cmd_identifier)), field("args", $.macro_call_content)),
seq(field("command", alias($._interpret_search_identifier, $.cmd_identifier)), field("args", $.args)),
prec.right(1, seq(field("args", $._simple_command), field("command", "|.")))
prec.right(1, seq(field("args", $._simple_stmt), field("command", "|.")))
)
),
_interpret_search_identifier: ($) => seq("./"),
_pf_arged_command: ($) =>
_pf_arged_stmt: ($) =>
choice(
seq(field("command", alias($.pf_dot_cmd_identifier, $.cmd_identifier))),
seq(field("command", alias("pfo", $.cmd_identifier)), field("args", $.args))
),
_pf_commands: ($) =>
_pf_stmts: ($) =>
prec.left(
1,
choice(
// pf fmt, pf* fmt_name|fmt, pfc fmt_name|fmt, pfd.fmt_name, pfj fmt_name|fmt, pfq fmt, pfs.struct_name, pfs format
alias($.pf_cmd, $.arged_command),
alias($.pf_cmd, $.arged_stmt),
// pf.fmt_name.field_name, pf.fmt_name.field_name[i], pf.fmt_name.field_name=33, pfv.fmt_name[.field]
alias($.pf_dot_cmd, $.arged_command),
alias($.pf_dot_cmd, $.arged_stmt),
// pf.name [0|cnt]fmt
alias($.pf_new_cmd, $.arged_command),
alias($.pf_new_cmd, $.arged_stmt),
// Cf [sz] [fmt]
alias($.Cf_cmd, $.arged_command)
// pf., pfo fdf_name: will be handled as regular arged_command
alias($.Cf_cmd, $.arged_stmt)
// pf., pfo fdf_name: will be handled as regular arged_stmt
)
),
Cf_cmd: ($) =>
@ -337,23 +335,23 @@ module.exports = grammar({
repeat(seq($._concat_pf_dot, ".", $._concat_pf_dot, alias($.pf_dot_arg, $.pf_arg)))
)
),
_env_command: ($) =>
_env_stmt: ($) =>
prec.left(
seq(
field("command", alias($._env_command_identifier, $.cmd_identifier)),
field("command", alias($._env_stmt_identifier, $.cmd_identifier)),
field("args", optional(alias($.eq_sep_args, $.args)))
)
),
_env_command_identifier: ($) => choice("%", "env"),
_last_command: ($) => seq(field("command", alias($.last_command_identifier, $.cmd_identifier))),
_env_stmt_identifier: ($) => choice("%", "env"),
_last_stmt: ($) => seq(field("command", alias($.last_stmt_identifier, $.cmd_identifier))),
last_command_identifier: ($) => choice(".", "..."),
interpret_arg: ($) => $._any_command,
last_stmt_identifier: ($) => choice(".", "..."),
interpret_arg: ($) => $._any_stmt,
system_identifier: ($) => /![\*!-=]*/,
question_mark_identifier: ($) => "?",
repeat_command: ($) =>
prec.left(1, seq(field("arg", alias($._dec_number, $.number)), field("command", $._simple_command))),
repeat_stmt: ($) =>
prec.left(1, seq(field("arg", alias($._dec_number, $.number)), field("command", $._simple_stmt))),
pointer_identifier: ($) => "*",
eq_sep_args: ($) => seq(alias($._eq_sep_key, $.arg), optional(seq("=", alias($._eq_sep_val, $.arg)))),
@ -363,14 +361,19 @@ module.exports = grammar({
macro_content: ($) =>
prec(
1,
seq(field("name", $.arg), optional($.args), optional(seq(";", $._command, repeat(seq(";", $._command)))), ")")
seq(
field("name", $.arg),
optional($.args),
optional(seq(";", $._statement, repeat(seq(";", $._statement)))),
")"
)
),
macro_args: ($) => seq($.macro_content, optional(seq(optional($.macro_call_full_content)))),
redirect_command: ($) =>
redirect_stmt: ($) =>
prec.right(
2,
seq(field("command", $._simple_command), field("redirect_operator", $._redirect_operator), field("arg", $.arg))
seq(field("command", $._simple_stmt), field("redirect_operator", $._redirect_operator), field("arg", $.arg))
),
_redirect_operator: ($) =>
choice($.fdn_redirect_operator, $.fdn_append_operator, $.html_redirect_operator, $.html_append_operator),
@ -418,7 +421,7 @@ module.exports = grammar({
),
_eq_sep_val_concatenation: ($) => prec.left(1, seq($.arg, repeat1(seq($._eq_sep_concat, $.arg)))),
_eq_sep_val: ($) => choice($._arg, alias($._eq_sep_val_concatenation, $.concatenation)),
_any_command: ($) => /[^\r\n;~|]+/,
_any_stmt: ($) => /[^\r\n;~|]+/,
arg_identifier: ($) => argIdentifier(ARG_IDENTIFIER_BASE),
spec_arg_identifier: ($) => argIdentifier(SPEC_ARG_IDENTIFIER_BASE),
@ -431,14 +434,14 @@ module.exports = grammar({
),
single_quoted_arg: ($) => seq("'", repeat(choice(token.immediate(prec(1, /[^\\'\n]+/)), /\\[\\'\n]?/)), "'"),
cmd_substitution_arg: ($) =>
choice(seq("$(", $._commands_singleline, ")"), prec(1, seq("`", $._commands_singleline, "`"))),
choice(seq("$(", $._statements_singleline, ")"), prec(1, seq("`", $._statements_singleline, "`"))),
concatenation: ($) => prec(-1, seq($._arg, repeat1(prec(-1, seq($._concat, $._arg))))),
_dec_number: ($) => choice(/[1-9][0-9]*/, /[0-9][0-9]+/),
_comment: ($) => token(choice(/#[^\r\n]*/)),
cmd_delimiter: ($) => choice("\n", "\r", $.cmd_delimiter_singleline),
cmd_delimiter_singleline: ($) => choice(";"),
stmt_delimiter: ($) => choice("\n", "\r", $.stmt_delimiter_singleline),
stmt_delimiter_singleline: ($) => choice(";"),
specifiers: ($) => repeat1(seq($._spec_sep, $._concat, alias($.spec_arg_identifier, $.arg_identifier))),
cmd_identifier: ($) => seq(field("id", $._cmd_identifier), field("extra", optional($.specifiers))),

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -12,7 +12,7 @@
enum TokenType {
CMD_IDENTIFIER,
HELP_COMMAND,
HELP_STMT,
FILE_DESCRIPTOR,
EQ_SEP_CONCAT,
CONCAT,
@ -156,7 +156,7 @@ bool tree_sitter_rzcmd_external_scanner_scan(void *payload, TSLexer *lexer, cons
lexer->result_symbol = EQ_SEP_CONCAT;
return true;
}
if (valid_symbols[CMD_IDENTIFIER] || valid_symbols[HELP_COMMAND]) {
if (valid_symbols[CMD_IDENTIFIER] || valid_symbols[HELP_STMT]) {
char res[CMD_IDENTIFIER_MAX_LENGTH + 1];
int i_res = 0;
@ -188,7 +188,7 @@ bool tree_sitter_rzcmd_external_scanner_scan(void *payload, TSLexer *lexer, cons
if (i_res == 1) {
return false;
}
lexer->result_symbol = HELP_COMMAND;
lexer->result_symbol = HELP_STMT;
} else {
if ((is_special_start(res[0]) && strcmp(res, "R=!")) || is_pf_cmd(res) || is_env_cmd(res) || is_at_cmd(res) || !valid_symbols[CMD_IDENTIFIER]) {
return false;

View file

@ -42,7 +42,7 @@ $foo
$foo
?e --
$-*
e cfg.newshell=true
e cfg.oldshell=false
$foo=\#!pipe echo hello
$foo
?e --

View file

@ -1388,7 +1388,7 @@ EOF
RUN
NAME=pdJ string - oldshell
ARGS=-ecfg.newshell=false
ARGS=-ecfg.oldshell=true
FILE=malloc://128
CMDS=<<EOF
w Snoo"ping as" usual,
@ -1400,8 +1400,8 @@ EXPECT=<<EOF
EOF
RUN
NAME=pdJ string - newshell
ARGS=-ecfg.newshell=true
NAME=pdJ string - rzshell
ARGS=-ecfg.oldshell=false
FILE=malloc://128
CMDS=<<EOF
w "Snoo\"ping as\" usual,"

View file

@ -14,7 +14,7 @@ EOF
RUN
NAME=& + grep
ARGS=-e cfg.newshell=true
ARGS=-e cfg.oldshell=false
FILE==
CMDS=<<EOF
& "?e Hello\nfrom\na task!~task"

View file

@ -322,7 +322,7 @@ EOF
RUN
NAME=w_escape
ARGS=-ecfg.newshell=true
ARGS=-ecfg.oldshell=false
FILE==
CMDS=<<EOF
wv8\@10

View file

@ -705,8 +705,8 @@ EXPECT=<<EOF
EOF
RUN
NAME=af ; af ; zfs libc-v7.sig - newshell
ARGS=-ecfg.newshell=true
NAME=af ; af ; zfs libc-v7.sig - rzshell
ARGS=-ecfg.oldshell=false
FILE=bins/elf/analysis/pid_stripped
CMDS=s 0x4e2420 ; af ; s 0x4e25c7 ; af ; zfs bins/other/sigs/libc-v7.sig ; afl ~4e2420
EXPECT=<<EOF
@ -748,8 +748,8 @@ EXPECT=<<EOF
EOF
RUN
NAME=af ; af ; zfs libc-v10.sig - newshell
ARGS=-ecfg.newshell=true
NAME=af ; af ; zfs libc-v10.sig - rzshell
ARGS=-ecfg.oldshell=false
FILE=bins/elf/analysis/pid_stripped
CMDS=s 0x4e2420 ; af ; s 0x4e25c7 ; af ; zfs bins/other/sigs/libc-v10.sig ; afl ~4e2420
EXPECT=<<EOF

View file

@ -335,7 +335,7 @@ RUN
NAME=multi-command single-line grep
FILE==
ARGS=-ecfg.newshell=true
ARGS=-ecfg.oldshell=false
CMDS=<<EOF
?e Hello World; ?e 4e2420~4e2420
EOF

View file

@ -1,5 +1,5 @@
NAME=Double quotes - newshell
ARGS=-e cfg.newshell=true
NAME=Double quotes - rzshell
ARGS=-e cfg.oldshell=false
FILE==
CMDS=<<EOF
w "Hello World"
@ -22,8 +22,8 @@ Hello@World
EOF
RUN
NAME=Single quotes - newshell
ARGS=-e cfg.newshell=true
NAME=Single quotes - rzshell
ARGS=-e cfg.oldshell=false
FILE==
CMDS=<<EOF
w 'Hello World'
@ -50,8 +50,8 @@ Hello@World
EOF
RUN
NAME=Quotes and substitution - newshell
ARGS=-e cfg.newshell=true
NAME=Quotes and substitution - rzshell
ARGS=-e cfg.oldshell=false
FILE==
CMDS=<<EOF
w "Hello $(?e World)"

View file

@ -2,7 +2,7 @@ NAME=load with file without moving anything
FILE=bins/elf/crackme0x05
CMDS=<<EOF
e asm.bytes=true
e cfg.newshell=1
e cfg.oldshell=false
f i_do_hope_that_no_entity_knocks_over_my_beverage @ 0x080483d8
Ps .tmp_load_no_move.rzdb
o--
@ -21,7 +21,7 @@ RUN
NAME=load with file using saved absolute file path after project file was moved
FILE=bins/elf/crackme0x05
CMDS=<<EOF
e cfg.newshell=1
e cfg.oldshell=false
e asm.bytes=true
f i_do_hope_that_no_entity_knocks_over_my_beverage @ 0x080483d8
Ps .tmp_load_move_project.rzdb
@ -47,7 +47,7 @@ NAME=load with file using saved relative file path after project file and binary
FILE=--
CMDS=<<EOF
e asm.bytes=true
e cfg.newshell=1
e cfg.oldshell=false
cp bins/elf/crackme0x05 .tmp_load_move_both.bin
o .tmp_load_move_both.bin
f i_do_hope_that_no_entity_knocks_over_my_beverage @ 0x080483d8
@ -74,7 +74,7 @@ RUN
NAME=load with file using saved relative file path after project file and binary were moved together with different relation
FILE=--
CMDS=<<EOF
e cfg.newshell=1
e cfg.oldshell=false
e asm.bytes=true
mkdir -p .tmp_load_move_both2/.tmp_load_move_both2
cp bins/elf/crackme0x05 .tmp_load_move_both2/somebin
@ -104,7 +104,7 @@ NAME=load with file using saved raw file path after everything has been messed u
FILE=--
CMDS=<<EOF
e asm.bytes=true
e cfg.newshell=1
e cfg.oldshell=false
mkdir -p .tmp_load_move_bin
cp bins/elf/crackme0x05 .tmp_load_move_bin.bin
o .tmp_load_move_bin.bin
@ -133,7 +133,7 @@ NAME=load without file
FILE=bins/elf/crackme0x05
CMDS=<<EOF
e asm.bytes=true
e cfg.newshell=1
e cfg.oldshell=false
f a_nice_refreshing_un-moisten @ 0x080483d8
Ps .tmp_load_without_file.rzdb
o
@ -167,7 +167,7 @@ RUN
NAME=load on top of file
FILE=bins/elf/crackme0x05
CMDS=<<EOF
e cfg.newshell=1
e cfg.oldshell=false
e asm.bytes=true
f a_nice_refreshing_un-moisten @ 0x080483d8
Ps .tmp_load_on_top_of_file.rzdb
@ -202,7 +202,7 @@ RUN
NAME=flags
FILE=bins/elf/crackme0x05
CMDS=<<EOF
e cfg.newshell=1
e cfg.oldshell=false
fr sym.main sym.renamedmain
f~?
f~main
@ -235,7 +235,7 @@ RUN
NAME=config
FILE==
CMDS=<<EOF
e cfg.newshell=1
e cfg.oldshell=false
e asm.describe=1
e asm.describe
e asm.indentspace=8
@ -275,7 +275,7 @@ RUN
NAME=seek
FILE==
CMDS=<<EOF
e cfg.newshell=1
e cfg.oldshell=false
s 0x1337
s
Ps .tmp_seek.rzdb
@ -294,7 +294,7 @@ RUN
NAME=analysis
FILE==
CMDS=<<EOF
e cfg.newshell=1
e cfg.oldshell=false
af+ 0x100 windowpane
afb+ windowpane 0x100 0x30
afl
@ -319,7 +319,7 @@ NAME=remember saved project file during session
FILE=bins/elf/crackme0x05
CMDS=<<EOF
e asm.bytes=true
e cfg.newshell=1
e cfg.oldshell=false
Ps .tmp_remember.rzdb
e prj.file
f cashews @ 0x080483d8
@ -344,7 +344,7 @@ RUN
NAME=raw file permissions after reload
FILE=bins/other/0x3
CMDS=<<EOF
e cfg.newshell=1
e cfg.oldshell=false
om
Ps .tmp_perms.rzdb
o--

View file

@ -30,7 +30,7 @@ EOF
RUN
NAME="/e /t\wst\d\d\d\s\w\w/i" - oldshell
ARGS=-ecfg.newshell=false
ARGS=-ecfg.oldshell=true
FILE=malloc://1024
CMDS=<<EOF
w "test123 ab"
@ -47,8 +47,8 @@ EXPECT=<<EOF
EOF
RUN
NAME="/e /t\wst\d\d\d\s\w\w/i" - newshell
ARGS=-ecfg.newshell=true
NAME="/e /t\wst\d\d\d\s\w\w/i" - rzshell
ARGS=-ecfg.oldshell=false
FILE=malloc://1024
CMDS=<<EOF
w '"test123 ab"'

View file

@ -100,7 +100,7 @@ static bool test_autocmplt_cmdid(void) {
strcpy(buf->data, "x");
buf->length = strlen("x");
buf->index = 1;
RzLineNSCompletionResult *r = rz_core_autocomplete_newshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
RzLineNSCompletionResult *r = rz_core_autocomplete_rzshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
mu_assert_eq(r->start, 0, "should autocomplete starting from 0");
mu_assert_eq(r->end, 1, "should autocomplete ending at 1");
@ -112,7 +112,7 @@ static bool test_autocmplt_cmdid(void) {
strcpy(buf->data, "p @@c:x");
buf->length = strlen("p @@c:x");
buf->index = buf->length;
r = rz_core_autocomplete_newshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
r = rz_core_autocomplete_rzshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
mu_assert_notnull(r, "r should be returned");
mu_assert_eq(r->start, buf->length - 1, "start is ok");
@ -134,7 +134,7 @@ static bool test_autocmplt_newcommand(void) {
strcpy(buf->data, "");
buf->length = strlen("");
buf->index = 0;
RzLineNSCompletionResult *r = rz_core_autocomplete_newshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
RzLineNSCompletionResult *r = rz_core_autocomplete_rzshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
mu_assert_notnull(r, "r should be returned");
mu_assert_eq(r->start, 0, "should autocomplete starting from 0");
@ -149,7 +149,7 @@ static bool test_autocmplt_newcommand(void) {
strcpy(buf->data, "p @@c:");
buf->length = strlen("p @@c:");
buf->index = buf->length;
r = rz_core_autocomplete_newshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
r = rz_core_autocomplete_rzshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
mu_assert_notnull(r, "result should be there");
mu_assert_eq(r->start, buf->length, "start should be ok");
@ -174,7 +174,7 @@ static bool test_autocmplt_argid(void) {
strcpy(buf->data, s);
buf->length = strlen(s);
buf->index = buf->length;
RzLineNSCompletionResult *r = rz_core_autocomplete_newshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
RzLineNSCompletionResult *r = rz_core_autocomplete_rzshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
mu_assert_notnull(r, "r should not be null");
mu_assert_eq(r->start, 3, "should autocomplete starting from ./...");
@ -196,7 +196,7 @@ static bool test_autocmplt_quotedarg(void) {
strcpy(buf->data, s);
buf->length = strlen(s);
buf->index = buf->length;
RzLineNSCompletionResult *r = rz_core_autocomplete_newshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
RzLineNSCompletionResult *r = rz_core_autocomplete_rzshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
mu_assert_notnull(r, "r should not be null");
mu_assert_eq(r->start, 4, "should autocomplete starting from ./...");
@ -210,7 +210,7 @@ static bool test_autocmplt_quotedarg(void) {
strcpy(buf->data, s);
buf->length = strlen(s);
buf->index = buf->length;
r = rz_core_autocomplete_newshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
r = rz_core_autocomplete_rzshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
mu_assert_notnull(r, "r should not be null");
mu_assert_eq(r->start, 4, "should autocomplete starting from ./...");
@ -240,7 +240,7 @@ static bool test_autocmplt_newarg(void) {
strcpy(buf->data, s);
buf->length = strlen(s);
buf->index = buf->length;
RzLineNSCompletionResult *r = rz_core_autocomplete_newshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
RzLineNSCompletionResult *r = rz_core_autocomplete_rzshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
mu_assert_notnull(r, "r should not be null");
mu_assert_eq(r->start, buf->length, "should autocomplete starting after space");
@ -281,7 +281,7 @@ static bool test_autocmplt_fcn(void) {
strcpy(buf->data, s);
buf->length = strlen(s);
buf->index = buf->length;
RzLineNSCompletionResult *r = rz_core_autocomplete_newshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
RzLineNSCompletionResult *r = rz_core_autocomplete_rzshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
mu_assert_notnull(r, "r should not be null");
mu_assert_eq(r->start, strlen("unittest ./file1 "), "should autocomplete starting after space");
@ -301,25 +301,25 @@ static bool test_autocmplt_eval(void) {
mu_assert_notnull(core, "core should be created");
RzLineBuffer *buf = &core->cons->line->buffer;
const char *s = "xd 1 2 3 4 cfg.newsh";
const char *s = "xd 1 2 3 4 cfg.oldsh";
strcpy(buf->data, s);
buf->length = strlen(s);
buf->index = buf->length;
RzLineNSCompletionResult *r = rz_core_autocomplete_newshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
RzLineNSCompletionResult *r = rz_core_autocomplete_rzshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
mu_assert_notnull(r, "r should not be null");
mu_assert_eq(r->start, strlen("xd 1 2 3 4 "), "should autocomplete the last arg");
mu_assert_eq(r->end, buf->length, "should autocomplete ending at end of buffer");
mu_assert_eq(rz_pvector_len(&r->options), 2, "there are 2 config evals starting with cfg.newsh");
mu_assert_streq(rz_pvector_at(&r->options, 0), "cfg.newshell", "cfg.newshell found");
mu_assert_streq(rz_pvector_at(&r->options, 1), "cfg.newshell.autocompletion", "cfg.newshell found");
mu_assert_eq(rz_pvector_len(&r->options), 2, "there are 2 config evals starting with cfg.oldsh");
mu_assert_streq(rz_pvector_at(&r->options, 0), "cfg.oldshell", "cfg.oldshell found");
mu_assert_streq(rz_pvector_at(&r->options, 1), "cfg.oldshell.autocompletion", "cfg.oldshell.autocompletion found");
rz_line_ns_completion_result_free(r);
s = "xd 1 2 3 4 search.in=io.maps.r";
strcpy(buf->data, s);
buf->length = strlen(s);
buf->index = buf->length;
r = rz_core_autocomplete_newshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
r = rz_core_autocomplete_rzshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
mu_assert_notnull(r, "r should not be null");
mu_assert_eq(r->start, strlen("xd 1 2 3 4 search.in="), "should autocomplete the last arg");
@ -341,7 +341,7 @@ static bool test_autocmplt_seek(void) {
strcpy(buf->data, s);
buf->length = strlen(s);
buf->index = buf->length;
RzLineNSCompletionResult *r = rz_core_autocomplete_newshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
RzLineNSCompletionResult *r = rz_core_autocomplete_rzshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
mu_assert_notnull(r, "r should not be null");
mu_assert_eq(r->start, strlen("s "), "should autocomplete the last arg");
@ -358,7 +358,7 @@ static bool test_autocmplt_seek(void) {
strcpy(buf->data, s);
buf->length = strlen(s);
buf->index = buf->length;
r = rz_core_autocomplete_newshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
r = rz_core_autocomplete_rzshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
mu_assert_notnull(r, "r should not be null");
mu_assert_eq(r->start, strlen("s "), "should autocomplete the last arg");
@ -372,7 +372,7 @@ static bool test_autocmplt_seek(void) {
strcpy(buf->data, s);
buf->length = strlen(s);
buf->index = buf->length;
r = rz_core_autocomplete_newshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
r = rz_core_autocomplete_rzshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
mu_assert_notnull(r, "r should not be null");
mu_assert_eq(r->start, strlen("s flag1 + "), "should autocomplete the last arg");
@ -386,7 +386,7 @@ static bool test_autocmplt_seek(void) {
strcpy(buf->data, s);
buf->length = strlen(s);
buf->index = buf->length;
r = rz_core_autocomplete_newshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
r = rz_core_autocomplete_rzshell(core, buf, RZ_LINE_PROMPT_DEFAULT);
mu_assert_notnull(r, "r should not be null");
mu_assert_eq(r->start, strlen("s flag1+"), "should autocomplete the last arg");

View file

@ -62,7 +62,7 @@ static RzCmdStatus cmd_last_opt_handler(RzCore *core, int argc, const char **arg
}
if (argc == 3) {
mu_assert_streq(argv[2], "cmd string\\ hello", "second cmd, optional, should be cmd");
RzCmdStatus s = rz_core_cmd0_newshell(core, argv[2]);
RzCmdStatus s = rz_core_cmd0_rzshell(core, argv[2]);
mu_assert_eq(s, RZ_CMD_STATUS_OK, "cmd_last second arg should be executed well");
}
return RZ_CMD_STATUS_OK;
@ -84,7 +84,7 @@ static RzCore *fake_core_new(void) {
static bool test_arg_cmd(void) {
RzCore *core = fake_core_new();
RzCmdStatus s = rz_core_cmd0_newshell(core, "cmd \"string hello\"");
RzCmdStatus s = rz_core_cmd0_rzshell(core, "cmd \"string hello\"");
mu_assert_eq(s, RZ_CMD_STATUS_OK, "argument cmd is passed");
rz_core_free(core);
mu_end;
@ -92,7 +92,7 @@ static bool test_arg_cmd(void) {
static bool test_arg_cmd_last(void) {
RzCore *core = fake_core_new();
RzCmdStatus s = rz_core_cmd0_newshell(core, "cmd_last string hello");
RzCmdStatus s = rz_core_cmd0_rzshell(core, "cmd_last string hello");
mu_assert_eq(s, RZ_CMD_STATUS_OK, "argument cmd is passed as a single arg");
rz_core_free(core);
mu_end;
@ -100,7 +100,7 @@ static bool test_arg_cmd_last(void) {
static bool test_arg_cmd_last_with_at(void) {
RzCore *core = fake_core_new();
RzCmdStatus s = rz_core_cmd0_newshell(core, "cmd_last_with_at string hello \\@ 0xdeadbeef");
RzCmdStatus s = rz_core_cmd0_rzshell(core, "cmd_last_with_at string hello \\@ 0xdeadbeef");
mu_assert_eq(s, RZ_CMD_STATUS_OK, "argument cmd is passed as a single arg");
rz_core_free(core);
mu_end;
@ -108,9 +108,9 @@ static bool test_arg_cmd_last_with_at(void) {
static bool test_arg_cmd_last_opt(void) {
RzCore *core = fake_core_new();
RzCmdStatus s = rz_core_cmd0_newshell(core, "cmd_last_opt \"string 'hello everybody'\" cmd 'string hello'");
RzCmdStatus s = rz_core_cmd0_rzshell(core, "cmd_last_opt \"string 'hello everybody'\" cmd 'string hello'");
mu_assert_eq(s, RZ_CMD_STATUS_OK, "argument cmd is passed as a single arg");
s = rz_core_cmd0_newshell(core, "cmd_last_opt \"string 'hello everybody'\"");
s = rz_core_cmd0_rzshell(core, "cmd_last_opt \"string 'hello everybody'\"");
mu_assert_eq(s, RZ_CMD_STATUS_OK, "argument cmd is passed as a single arg");
rz_core_free(core);
mu_end;

View file

@ -29,8 +29,8 @@ fi
if [ "${RZ_SYS_OPENSSL}" != "" ] ; then
OPTS="${OPTS} -D use_sys_openssl=${RZ_SYS_OPENSSL}"
fi
if [ "${RZ_NEWSHELL}" != "" ] ; then
OPTS="${OPTS} -D use_treesitter=${RZ_NEWSHELL}"
if [ "${RZ_RZSHELL}" != "" ] ; then
OPTS="${OPTS} -D use_treesitter=${RZ_RZSHELL}"
fi
if [ "${COVERAGE}" == "1" ] ; then
OPTS="${OPTS} -Db_coverage=true"