about summary refs log tree commit diff stats
path: root/shell/tokenize.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-06-20 22:24:03 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-06-20 22:32:03 -0700
commitfa26249931c1cf71edd78cb1c030b501783ae027 (patch)
treeed30c752583c5285a38d1dcf30fe89cca24ecc9c /shell/tokenize.mu
parentecc763f092456b4d8c93a3d7f47163e4a32fa7b0 (diff)
downloadmu-fa26249931c1cf71edd78cb1c030b501783ae027.tar.gz
new macro: with
Diffstat (limited to 'shell/tokenize.mu')
-rw-r--r--shell/tokenize.mu6
1 files changed, 4 insertions, 2 deletions
diff --git a/shell/tokenize.mu b/shell/tokenize.mu
index ab25615f..f7e4663c 100644
--- a/shell/tokenize.mu
+++ b/shell/tokenize.mu
@@ -386,7 +386,7 @@ fn test-tokenize-indent {
 fn next-token in: (addr gap-buffer), out: (addr token), start-of-line?: boolean, trace: (addr trace) -> _/edi: boolean {
   trace-text trace, "tokenize", "next-token"
   trace-lower trace
-  # first save an indent token
+  # save an indent token if necessary
   {
     compare start-of-line?, 0/false
     break-if-=
@@ -406,12 +406,13 @@ fn next-token in: (addr gap-buffer), out: (addr token), start-of-line?: boolean,
     trace-text trace, "tokenize", "newline"
     g <- read-from-gap-buffer in
     initialize-skip-token out  # might drop indent if that's all there was in this line
+    trace-higher trace
     return 1/at-start-of-line
   }
   {
     compare start-of-line?, 0/false
     break-if-=
-    # still here? no comment or newline?
+    # still here? no comment or newline? return saved indent
     trace-higher trace
     return 0/not-at-start-of-line
   }
@@ -421,6 +422,7 @@ fn next-token in: (addr gap-buffer), out: (addr token), start-of-line?: boolean,
     break-if-=
     trace-text trace, "tokenize", "end"
     initialize-skip-token out
+    trace-higher trace
     return 1/at-start-of-line
   }
   var _g/eax: grapheme <- peek-from-gap-buffer in