aboutsummaryrefslogtreecommitdiff
path: root/whichbas.c
diff options
context:
space:
mode:
Diffstat (limited to 'whichbas.c')
-rw-r--r--whichbas.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/whichbas.c b/whichbas.c
index c040950..6d7fbf4 100644
--- a/whichbas.c
+++ b/whichbas.c
@@ -495,21 +495,27 @@ CALLBACK(handle_op) {
break;
case 0x5a: /* EXOR (infix num op) or BUMP( (pseudo-function, no OP_FUNC_LPAR) */
case 0x5d: /* DIV (infix num op) or RANDOM( (pseudo-func, 1 or 2 num args) */
- if(last_op_tok == OP_NUMCONST || last_op_tok == OP_HEXCONST || last_op_tok >= 0x80) {
- /* if the last token was a variable or a numeric, this is infix
- (can't be a function, last token would have to have been a command
- or a regular operator). */
+ if(last_op_tok == OP_GRP_RPAR || last_op_tok == OP_NUMCONST || last_op_tok == OP_HEXCONST || last_op_tok >= 0x80) {
+ /* if the last token was a variable or a numeric, or a right paren,
+ this is infix (can't be a function, last token would have to have
+ been a command or a math/etc operator). */
remove_type(BT_BXL_BXE);
} else {
remove_type(BT_TURBO);
}
break;
case 0x5c: /* DEC (function, takes str) in TB, HEX$ (function, takes num) in BXL/BXE */
+ /* 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 >= 0x80 && (get_vartype(nexttok2) == TYPE_STRING)) {
- /* TODO: see if this test is actually valid! */
- remove_type(BT_BXL_BXE);
+ } else if(nexttok2 == OP_NUMCONST) {
+ remove_type(BT_TURBO);
+ } else if(nexttok2 >= 0x80) {
+ if(get_vartype(nexttok2) == TYPE_STRING) {
+ remove_type(BT_BXL_BXE);
+ } else {
+ remove_type(BT_TURBO);
+ }
}
break;
case 0x5e: /* FRAC (num func, 1 arg) or DPEEK (num func, 1 arg) in BXL...