aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--listbas.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/listbas.c b/listbas.c
index dc267c8..f56b39b 100644
--- a/listbas.c
+++ b/listbas.c
@@ -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++;