aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--whichbas.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/whichbas.c b/whichbas.c
index f4bd151..6cb21c2 100644
--- a/whichbas.c
+++ b/whichbas.c
@@ -291,16 +291,13 @@ 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) */
- /* XXX: incomplete */
- if(last_cmd_pos == pos - 1) {
- /* partial: if the last token was a command, this *can't* be infix.*/
- remove_type(BT_TURBO);
- } else if(last_op_tok == OP_NUMCONST || last_op_tok == OP_HEXCONST || last_op_tok >= 0x80) {
- /* partial: if the last token was a variable or a numeric, this can't
- be a function (last token would have to have been a command
- or a regular operator). however, Turbo BASIC allows up to 256
- variables, this only catches the first 128. */
+ 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). */
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 */
@@ -390,6 +387,8 @@ CALLBACK(handle_end_stmt) {
default: break;
}
if(verbose) fprintf(stderr, " bas_type now %02x\n", bas_type);
+
+ last_cmd = last_op_tok = 0;
}
void foreign(const char *name) {