aboutsummaryrefslogtreecommitdiff
path: root/whichbas.c
diff options
context:
space:
mode:
Diffstat (limited to 'whichbas.c')
-rw-r--r--whichbas.c47
1 files changed, 27 insertions, 20 deletions
diff --git a/whichbas.c b/whichbas.c
index 586fd0b..0aeb5d1 100644
--- a/whichbas.c
+++ b/whichbas.c
@@ -249,17 +249,27 @@ int is_string_func(unsigned char tok) {
/* return true if a token is:
- a string constant,
- a string variable,
- - a string expression operator, like OP_STR_LE,
- a function that returns a string.
*/
-int is_string_op(unsigned char tok) {
+int is_string_rval(unsigned char tok) {
return
is_string_const (tok) ||
is_string_func (tok) ||
- is_string_exp_op (tok) ||
is_string_var (tok) ;
}
+/* return true if a token is:
+ - a string constant,
+ - a string variable,
+ - a string expression operator, like OP_STR_LE,
+ - a function that returns a string.
+*/
+int is_string_op(unsigned char tok) {
+ return
+ is_string_rval (tok) ||
+ is_string_exp_op (tok) ;
+}
+
void remove_type(int type) {
bas_type &= ((~type) & 0x0f);
@@ -629,6 +639,18 @@ CALLBACK(handle_op) {
}
}
+ /* BXL/BXE allows string concatenation in assignment with the comma,
+ A$="FOO","BAR" or A$=C$,D$. */
+ if(last_cmd == CMD_LET || last_cmd == CMD_ILET) {
+ if(program[last_cmd_pos + 2] == OP_STR_ASSIGN) {
+ if(tok == OP_COMMA) {
+ if(is_string_rval(nexttok)) {
+ remove_type(BT_ATARI | BT_TURBO);
+ }
+ }
+ }
+ }
+
if(tok == OP_HEXCONST) remove_type(BT_ATARI); /* hex const (turbo *and* bxl/xe) */
if(tok <= OP_FUNC_STRIG) {
if(verbose) fprintf(stderr, " bas_type now %02x\n", bas_type);
@@ -715,27 +737,12 @@ CALLBACK(handle_op) {
break;
case 0x5c: /* DEC (function, takes str) in TB, HEX$ (function, takes num) in BXL/BXE */
- if(is_string_op(nexttok2)) {
+ /* COMPLETE */
+ if(is_string_rval(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) {
- 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...