diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-02-28 13:06:11 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-02-28 15:13:59 -0800 |
commit | b89c158e3e2f24cbc6b3f0ebe71d9206e529fcaa (patch) | |
tree | ec2e5f346e5a27923759a8bfdbdb47f1e495dbc9 /baremetal/shell | |
parent | 1211a47e0b988488274e473e7fbb4eae7e07ac1b (diff) | |
download | mu-b89c158e3e2f24cbc6b3f0ebe71d9206e529fcaa.tar.gz |
7823
Diffstat (limited to 'baremetal/shell')
-rw-r--r-- | baremetal/shell/parse.mu | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/baremetal/shell/parse.mu b/baremetal/shell/parse.mu index 7c36673f..c89f8f0d 100644 --- a/baremetal/shell/parse.mu +++ b/baremetal/shell/parse.mu @@ -4,15 +4,19 @@ fn parse-sexpression tokens: (addr stream cell), _out: (addr handle cell), 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 + compare empty?, 0/false { - var done?/eax: boolean <- stream-empty? tokens - compare done?, 0/false - break-if-!= - read-from-stream tokens, curr-token - parse-atom curr-token, _out, trace + break-if-= + error trace, "nothing to parse" return } - abort "unexpected tokens at end; only type in a single expression at a time" + read-from-stream tokens, curr-token + parse-atom curr-token, _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-atom _curr-token: (addr cell), _out: (addr handle cell), trace: (addr trace) { |