about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xapps/mubin601794 -> 602072 bytes
-rw-r--r--apps/mu.subx33
2 files changed, 33 insertions, 0 deletions
diff --git a/apps/mu b/apps/mu
index 17240f9a..dd16a282 100755
--- a/apps/mu
+++ b/apps/mu
Binary files differdiff --git a/apps/mu.subx b/apps/mu.subx
index ecffe3a1..7a0859df 100644
--- a/apps/mu.subx
+++ b/apps/mu.subx
@@ -2420,6 +2420,34 @@ test-convert-invalid-literal:
     5d/pop-to-ebp
     c3/return
 
+test-convert-valid-literal-with-metadata:
+    # . prologue
+    55/push-ebp
+    89/<- %ebp 4/r32/esp
+    # setup
+    (clear-stream _test-input-stream)
+    (clear-stream $_test-input-buffered-file->buffer)
+    (clear-stream _test-output-stream)
+    (clear-stream $_test-output-buffered-file->buffer)
+    #
+    (write _test-input-stream "fn foo {\n")
+    (write _test-input-stream "  var x/eax: int <- copy 1/abc\n")
+    (write _test-input-stream "}\n")
+    # convert
+    (convert-mu _test-input-buffered-file _test-output-buffered-file Stderr 0)
+    (flush _test-output-buffered-file)
+#?     # dump _test-output-stream {{{
+#?     (write 2 "^")
+#?     (write-stream 2 _test-output-stream)
+#?     (write 2 "$\n")
+#?     (rewind-stream _test-output-stream)
+#?     # }}}
+    # no errors
+    # . epilogue
+    89/<- %esp 5/r32/ebp
+    5d/pop-to-ebp
+    c3/return
+
 test-local-var-in-mem-has-no-initializer:
     # . prologue
     55/push-ebp
@@ -16865,6 +16893,7 @@ $test-function-header-with-multiple-args-and-outputs:out1:
 #   x/eax: int
 #   x/eax: int,
 # ignores at most one trailing comma
+# does not support other, non-register metadata
 # WARNING: modifies name
 parse-var-with-type:  # name: (addr slice), first-line: (addr stream byte), out: (addr handle var), fn-name: (addr array byte), err: (addr buffered-file), ed: (addr exit-descriptor)
     # pseudocode:
@@ -19680,6 +19709,7 @@ $new-var:end:
     5d/pop-to-ebp
     c3/return
 
+# WARNING: modifies name
 new-literal-integer:  # ad: (addr allocation-descriptor), name: (addr slice), out: (addr handle var), fn: (addr function), err: (addr buffered-file), ed: (addr exit-descriptor)
     # . prologue
     55/push-ebp
@@ -19687,6 +19717,9 @@ new-literal-integer:  # ad: (addr allocation-descriptor), name: (addr slice), ou
     # . save registers
     50/push-eax
     51/push-ecx
+    # first strip out metadata
+    8b/-> *(ebp+0xc) 1/r32/ecx
+    (next-token-from-slice *ecx *(ecx+4) 0x2f *(ebp+0xc))
     # if (!is-hex-int?(name)) abort
     (is-hex-int? *(ebp+0xc))  # => eax
     3d/compare-eax-and 0/imm32/false
#3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
[colours]
bkgnd=default
titlebar=cyan
titlebar.text=black
titlebar.brackets=black
titlebar.unencrypted=black
titlebar.encrypted=white
titlebar.untrusted=white
titlebar.trusted=white
titlebar.online=white
titlebar.offline=white
titlebar.away=white
titlebar.chat=white
titlebar.dnd=white
titlebar.xa=white
statusbar=green
statusbar.text=black
statusbar.time=black
statusbar.brackets=black
statusbar.active=black
statusbar.current=bold_black
statusbar.new=white
main.text=bold_cyan
main.text.me=yellow
main.text.them=green
main.splash=bold_yellow
main.help.header=bold_yellow
main.time=bold_green
input.text=bold_blue
subscribed=green
unsubscribed=bold_black
otr.started.trusted=green
otr.started.untrusted=yellow
otr.ended=red
otr.trusted=green
otr.untrusted=yellow
online=green
away=blue
chat=green
dnd=bold_black
xa=blue
offline=bold_black
incoming=bold_yellow
mention=bold_cyan
trigger=bold_cyan
typing=yellow
gone=bold_black
error=bold_black
roominfo=yellow
roommention=bold_cyan
roommention.term=bold_cyan
roomtrigger=bold_cyan
roomtrigger.term=bold_cyan
me=blue
them=bold_blue
roster.header=bold_green
roster.chat=green
roster.online=green
roster.away=blue
roster.xa=blue
roster.dnd=bold_black
roster.offline=bold_black
roster.chat.active=green
roster.online.active=green
roster.away.active=blue
roster.xa.active=blue
roster.dnd.active=bold_black
roster.offline.active=bold_black
roster.chat.unread=green
roster.online.unread=green
roster.away.unread=blue
roster.xa.unread=blue
roster.dnd.unread=bold_black
roster.offline.unread=bold_black
roster.room=green
roster.room.unread=bold_green
roster.room.mention=bold_green
roster.room.trigger=bold_green
occupants.header=bold_green
receipt.sent=bold_black