From 683420816b9e886d047f452ef52201251992ba1b Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 10 Jul 2024 04:13:17 -0400 Subject: whichbas: add left parens to is_arith_op(), is_string_exp_op(); rewrite DEC/HEX$ (op token 0x5c). --- whichbas.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/whichbas.c b/whichbas.c index 57e7098..586fd0b 100644 --- a/whichbas.c +++ b/whichbas.c @@ -180,6 +180,7 @@ int is_arith_op(unsigned char tok) { case OP_NUM_ASSIGN: case OP_UPLUS: case OP_UMINUS: + case OP_GRP_LPAR: /* yes, this belongs here, (((A$))) is a syntax error! */ return 1; default: return 0; @@ -228,6 +229,7 @@ int is_string_exp_op(unsigned char tok) { case OP_STR_LT: case OP_STR_GT: case OP_STR_EQ: + case OP_STR_LPAR: /* the ( in: A$(1)="A" */ return 1; default: return 0; @@ -713,7 +715,15 @@ CALLBACK(handle_op) { break; case 0x5c: /* DEC (function, takes str) in TB, HEX$ (function, takes num) in BXL/BXE */ + if(is_string_op(nexttok2)) { + remove_type(BT_BXL_BXE); + } else if(is_numeric_op(nexttok2)) { + remove_type(BT_TURBO); + } + + /* old implementation: */ /* PARTIAL: won't catch HEX$(ASC("A")) (or any other nested function call) */ + /* if(nexttok2 == OP_STRCONST) { remove_type(BT_BXL_BXE); } else if(nexttok2 == OP_NUMCONST) { @@ -725,6 +735,7 @@ CALLBACK(handle_op) { remove_type(BT_TURBO); } } + */ break; case 0x5e: /* FRAC (num func, 1 arg) or DPEEK (num func, 1 arg) in BXL... -- cgit v1.2.3