diff options
author | B. Watson <urchlay@slackware.uk> | 2024-07-18 04:29:38 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-07-18 04:29:38 -0400 |
commit | 2ef7e58b7a55257a0fc7c31db7be519b56f9190c (patch) | |
tree | dcac33476f5d9f054d4814fdadcddbdff973b5e7 | |
parent | f5cb0cc786ca73197a17b56782c5595ff813f570 (diff) | |
download | bw-atari8-tools-2ef7e58b7a55257a0fc7c31db7be519b56f9190c.tar.gz |
listbas: Turbo indentation support (seems complete, needs more testing).
-rw-r--r-- | listbas.c | 32 |
1 files changed, 31 insertions, 1 deletions
@@ -557,9 +557,38 @@ void aplus_indent_line(const unsigned char tok) { } void turbo_indent_line(const unsigned char tok) { + if(if_without_then) indent_level++; + switch(tok) { + case 0x40: /* ELSE */ + if(first_stmt) { + /* gets "outdented" */ + indent_level--; + print_indent(); + indent_level++; + } + return; + case CMD_FOR: /* FOR */ + case 0x3c: /* REPEAT */ + case 0x3e: /* WHILE */ + case 0x45: /* DO */ + case 0x4f: /* PROC */ + if(first_stmt) print_indent(); + indent_level++; + return; + case CMD_NEXT: /* NEXT */ + case 0x3d: /* UNTIL */ + case 0x3f: /* WEND */ + case 0x41: /* ENDIF */ + case 0x46: /* LOOP */ + case 0x51: /* ENDPROC */ + indent_level--; + break; + default: break; + } + if(first_stmt) print_indent(); } -/* TODO: IF without THEN: the actual IF line is supposed to get indented, +/* FIXME: IF without THEN: the actual IF line is supposed to get indented, but only if there's *not* a THEN. no easy way to look ahead that I've thought of yet. */ /* Note: BXL's PROCEDURE/EXIT (from toolkit extensions) does @@ -587,6 +616,7 @@ void bxe_indent_line(const unsigned char tok) { switch(tok) { case 0x3c: /* ELSE */ if(first_stmt) { + /* gets "outdented" */ indent_level--; print_indent(); indent_level++; |