From a965d27f33c7d1cc69922fd8c94a02fe7dc4d889 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Sun, 21 May 2023 00:46:04 -0400 Subject: Else if fixes --- tnslc/else.tnsl | 17 ++++++++--------- tnslc/tnslc.tnsl | 6 ++++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/tnslc/else.tnsl b/tnslc/else.tnsl index 8c4789d..a87aad3 100644 --- a/tnslc/else.tnsl +++ b/tnslc/else.tnsl @@ -1,14 +1,13 @@ /; main [int] - /; if (1 == 1) - /; if (1 == 0) - return 1 - ;; else if (1 > 0) - break - ;; else - return 0 - ;/ + int i = 1 + + + /; if (i == 3) + i = 1 + ;; else if (i == 1) + i = 10 ;/ - return 2 + return i ;/ \ No newline at end of file diff --git a/tnslc/tnslc.tnsl b/tnslc/tnslc.tnsl index c642216..d5e1f7d 100644 --- a/tnslc/tnslc.tnsl +++ b/tnslc/tnslc.tnsl @@ -7,7 +7,7 @@ # 1 - Info (default) # 2 - Debugging information (useful for me, probably less for you) # 3 - Also logs the state changes of the log itself -;{}uint8 log_level = "1" +;{}uint8 log_level = "2" ;{}uint8 log_mode = "single" /; log_state({}uint8 new_state) @@ -3471,9 +3471,10 @@ }, "") ;outro = {"", "", ""} - ;condition = -1 + ;condition = 0 - 1 /; if (tok`{next_non_nl(tok, cur` + 1)}.cmp("if")) + ;cur` = next_non_nl(tok, cur` + 1) ;cur` = next_non_nl(tok, cur` + 1) ;cf = cf.parent`.new_sub_cf("elif") /; loop (cur` < len (tok`)) [cur`++] @@ -3504,6 +3505,7 @@ ;/ ;cur` = next_non_nl(tok, cur`) + ;cur`-- ;; else ;cf = cf.parent`.new_sub_cf("else") ;/ -- cgit v1.2.3