about summary refs log tree commit diff stats
path: root/apps/tile
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-10-25 18:45:11 -0700
committerKartik Agaram <vc@akkartik.com>2020-10-25 18:45:11 -0700
commita148b23a22709a45647fd07ce95db9147217a061 (patch)
treedb95e96fbb4a1da518f25bcda5cf863b34ecb4a1 /apps/tile
parent8a6ad45d8d26c60b62a2a7ac8d594b3c4d1dbc45 (diff)
downloadmu-a148b23a22709a45647fd07ce95db9147217a061.tar.gz
7101 - tile: remove quotes when evaluating strings
This found several bugs due to me not checking for null strings.
Diffstat (limited to 'apps/tile')
-rw-r--r--apps/tile/main.mu7
-rw-r--r--apps/tile/rpn.mu2
-rw-r--r--apps/tile/value-stack.mu2
3 files changed, 4 insertions, 7 deletions
diff --git a/apps/tile/main.mu b/apps/tile/main.mu
index d4f53535..08e6532b 100644
--- a/apps/tile/main.mu
+++ b/apps/tile/main.mu
@@ -77,12 +77,7 @@ fn test {
   initialize-environment-with-fake-screen env, 5, 0xa
   var g/eax: grapheme <- copy 0x22  # '"'
   process env, g
-  g <- copy 0x31  # '1'
-  process env, g
-  g <- copy 0x20  # space
-  process env, g
-  g <- copy 0x33  # '3'
-  process env, g
+  render env
 }
 
 fn repl {
diff --git a/apps/tile/rpn.mu b/apps/tile/rpn.mu
index 80ab47ae..cf0766b0 100644
--- a/apps/tile/rpn.mu
+++ b/apps/tile/rpn.mu
@@ -109,7 +109,7 @@ fn evaluate functions: (addr handle function), bindings: (addr table), scratch:
         break-if-!=
         var h: (handle array byte)
         var s/eax: (addr handle array byte) <- address h
-        stream-to-string curr-stream, s  # leak
+        unquote-stream-to-string curr-stream, s  # leak
         push-string-to-value-stack out, *s
         break $evaluate:process-word
       }
diff --git a/apps/tile/value-stack.mu b/apps/tile/value-stack.mu
index aae87c3d..7050442d 100644
--- a/apps/tile/value-stack.mu
+++ b/apps/tile/value-stack.mu
@@ -130,6 +130,8 @@ fn value-stack-max-width _self: (addr value-stack) -> result/eax: int {
       break-if-!=
       var s-ah/eax: (addr handle array byte) <- get g, text-data
       var s/eax: (addr array byte) <- lookup *s-ah
+      compare s, 0
+      break-if-=
       var w/eax: int <- length s
       compare w, out
       break-if-<=