From 7885677f5f92584a0b2f25daa2fd9f313bdd1943 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sun, 9 Mar 2025 13:27:05 -0400 Subject: listbas: -D, fix ELSE. --- listamsb.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/listamsb.c b/listamsb.c index 6e06818..b8b4372 100644 --- a/listamsb.c +++ b/listamsb.c @@ -619,16 +619,6 @@ int need_space_between(int ext1, int ext2, unsigned char t1, unsigned char t2) { if(t2 == TOK_AND) return 1; if(t2 == TOK_OR) return 1; if(t2 == TOK_NOT) return 1; - - /* XXX: this isn't ideal. This line: - 10 IF A THEN PRINT "OK" ELSE GOTO 100 - ...gets crunched to: - 10 IFATHENPRINT "OK"ELSEGOTO100 - ...but it decrunches to: - 10 IF A THEN PRINT "OK" : ELSE GOTO 100 - ...which works OK, but the : really shouldn't appear. - the trouble is, we only look ahead one token. */ - if(t2 == TOK_ELSE) return 1; } if(t1 >= 0x80) { @@ -696,6 +686,11 @@ int decrunch_line(void) { byte = read_prog_byte(); if(need_space_between(1, 0, prev, byte)) code[codelen++] = ' '; + } else if(prev == ':' && byte == TOK_ELSE) { + /* special case, ELSE needs a space before the (invisible) + colon that comes before it. */ + code[codelen - 1] = ' '; + code[codelen++] = prev; } else if(need_space_between(0, 0, prev, byte)) { code[codelen++] = ' '; } -- cgit v1.2.3