mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-23 22:36:27 +00:00
Simplify rcc_mathop and fix a bug when operation starts with bit operation
This commit is contained in:
parent
0adb01dcb8
commit
590d855f78
@ -321,23 +321,22 @@ static void rcc_internal_mathop(REgg *egg, char *ptr, char *ep, char op) {
|
|||||||
static void rcc_mathop(REgg *egg, char **pos, int level) {
|
static void rcc_mathop(REgg *egg, char **pos, int level) {
|
||||||
REggEmit *e = egg->remit;
|
REggEmit *e = egg->remit;
|
||||||
int op_ret = level;
|
int op_ret = level;
|
||||||
char op, *next_pos, *p;
|
char op, *next_pos;
|
||||||
|
|
||||||
while (**pos && is_space (**pos)) (*pos)++;
|
while (**pos && is_space (**pos)) (*pos)++;
|
||||||
next_pos = *pos + 1;
|
next_pos = *pos + 1;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
op = (is_op (**pos) && !(is_var (*pos)))? **pos: '=';
|
op = (is_op (**pos) && !(is_var (*pos)))? **pos: '=';
|
||||||
p = (is_op (**pos) && !(is_var (*pos)))? *pos + 1: *pos;
|
*pos = (is_op (**pos) && !(is_var (*pos)))? *pos + 1: *pos;
|
||||||
op_ret = get_op (&next_pos);
|
op_ret = get_op (&next_pos);
|
||||||
if (op_ret > level) {
|
if (op_ret > level) {
|
||||||
(*pos)++;
|
|
||||||
rcc_mathop (egg, pos, op_ret);
|
rcc_mathop (egg, pos, op_ret);
|
||||||
rcc_internal_mathop (egg, strdup (e->regs (egg, op_ret - 1))
|
rcc_internal_mathop (egg, strdup (e->regs (egg, op_ret - 1))
|
||||||
, strdup (e->regs (egg, level - 1)), op);
|
, strdup (e->regs (egg, level - 1)), op);
|
||||||
next_pos = *pos + 1;
|
next_pos = *pos + 1;
|
||||||
} else {
|
} else {
|
||||||
rcc_internal_mathop (egg, p, strdup (e->regs (egg, level - 1)), op);
|
rcc_internal_mathop (egg, *pos, strdup (e->regs (egg, level - 1)), op);
|
||||||
*pos = next_pos;
|
*pos = next_pos;
|
||||||
next_pos++;
|
next_pos++;
|
||||||
}
|
}
|
||||||
@ -1336,7 +1335,7 @@ R_API int r_egg_lang_parsechar(REgg *egg, char c) {
|
|||||||
elem_n = 0;
|
elem_n = 0;
|
||||||
R_FREE (ifelse_table[CTX][nestedi[CTX] - 1])
|
R_FREE (ifelse_table[CTX][nestedi[CTX] - 1])
|
||||||
ifelse_table[CTX][nestedi[CTX] - 1] =
|
ifelse_table[CTX][nestedi[CTX] - 1] =
|
||||||
r_str_newf (" __end_%d_%d_%d:",
|
r_str_newf (" __end_%d_%d_%d",
|
||||||
nfunctions, CTX, nestedi[CTX]);
|
nfunctions, CTX, nestedi[CTX]);
|
||||||
}
|
}
|
||||||
r_egg_printf (egg, " __begin_%d_%d_%d:\n",
|
r_egg_printf (egg, " __begin_%d_%d_%d:\n",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user