about summary refs log tree commit diff stats
path: root/baremetal/shell/parse.mu
diff options
context:
space:
mode:
Diffstat (limited to 'baremetal/shell/parse.mu')
-rw-r--r--baremetal/shell/parse.mu14
1 files changed, 9 insertions, 5 deletions
diff --git a/baremetal/shell/parse.mu b/baremetal/shell/parse.mu
index 7e5aafc3..ab7f440d 100644
--- a/baremetal/shell/parse.mu
+++ b/baremetal/shell/parse.mu
@@ -1,7 +1,15 @@
+fn parse-input tokens: (addr stream cell), out: (addr handle cell), trace: (addr trace) {
+  rewind-stream tokens
+  parse-sexpression tokens, out, trace
+  var empty?/eax: boolean <- stream-empty? tokens
+  compare empty?, 0/false
+  break-if-!=
+  error trace, "unexpected tokens at end; only type in a single expression at a time"
+}
+
 fn parse-sexpression tokens: (addr stream cell), _out: (addr handle cell), trace: (addr trace) {
   trace-text trace, "read", "parse"
   trace-lower trace
-  rewind-stream tokens
   var curr-token-storage: cell
   var curr-token/ecx: (addr cell) <- address curr-token-storage
   var empty?/eax: boolean <- stream-empty? tokens
@@ -14,10 +22,6 @@ fn parse-sexpression tokens: (addr stream cell), _out: (addr handle cell), trace
   read-from-stream tokens, curr-token
   parse-atom curr-token, _out, trace
   trace-higher trace
-  var empty?/eax: boolean <- stream-empty? tokens
-  compare empty?, 0/false
-  break-if-!=
-  error trace, "unexpected tokens at end; only type in a single expression at a time"
 }
 
 fn parse-atom _curr-token: (addr cell), _out: (addr handle cell), trace: (addr trace) {