about summary refs log tree commit diff stats
path: root/shell/parse.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-04-27 23:10:30 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-04-27 23:10:30 -0700
commit55cde01edfe504855f171b6dbdc312cbcc02872b (patch)
treee39ebe42c53e6a8e906319faf6d318f4f6f6837d /shell/parse.mu
parent9e9e40c05a1a6df71f57f98044da4258ac013b5c (diff)
downloadmu-55cde01edfe504855f171b6dbdc312cbcc02872b.tar.gz
shell: stream literals
Diffstat (limited to 'shell/parse.mu')
-rw-r--r--shell/parse.mu17
1 files changed, 14 insertions, 3 deletions
diff --git a/shell/parse.mu b/shell/parse.mu
index 1fc74214..03e0488e 100644
--- a/shell/parse.mu
+++ b/shell/parse.mu
@@ -175,9 +175,20 @@ fn parse-atom _curr-token: (addr cell), _out: (addr handle cell), trace: (addr t
     }
     return
   }
-  # default: symbol
-  # just copy token data
-  allocate-symbol _out
+  # default: copy either to a symbol or a stream
+  # stream token -> literal
+  var stream-token?/eax: boolean <- stream-token? curr-token
+  compare stream-token?, 0/false
+  {
+    break-if-=
+    allocate-stream _out
+  }
+  compare stream-token?, 0/false
+  {
+    break-if-!=
+    allocate-symbol _out
+  }
+  # copy token data
   var out/eax: (addr handle cell) <- copy _out
   var out-addr/eax: (addr cell) <- lookup *out
   var curr-token-data-ah/ecx: (addr handle stream byte) <- get curr-token, text-data