aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-07-10 04:13:17 -0400
committerB. Watson <urchlay@slackware.uk>2024-07-10 04:13:17 -0400
commit683420816b9e886d047f452ef52201251992ba1b (patch)
treee58f347707048f90b1c4cbcd1c6c1e16f3e78d2a
parent9e49ae687d56f33bb3d47e9f939265bafe44f4f4 (diff)
downloadbw-atari8-tools-683420816b9e886d047f452ef52201251992ba1b.tar.gz
whichbas: add left parens to is_arith_op(), is_string_exp_op(); rewrite DEC/HEX$ (op token 0x5c).
-rw-r--r--whichbas.c11
1 files changed, 11 insertions, 0 deletions
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...