about summary refs log tree commit diff stats
path: root/apps
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-11-12 23:25:45 -0800
committerKartik Agaram <vc@akkartik.com>2020-11-12 23:25:45 -0800
commitf3d33ac462d3c81ff8cc0e3a6ab5958be14e309e (patch)
tree2829d6b330b022a663f79131c541e2b87cd2813b /apps
parent165ed256a3a45357d741fa4e28b74c671ef7cd82 (diff)
downloadmu-f3d33ac462d3c81ff8cc0e3a6ab5958be14e309e.tar.gz
7231
Diffstat (limited to 'apps')
-rwxr-xr-xapps/callsbin53455 -> 53599 bytes
-rw-r--r--apps/calls.subx46
-rw-r--r--apps/sigils.subx4
3 files changed, 47 insertions, 3 deletions
diff --git a/apps/calls b/apps/calls
index c9568f8a..1ddfd3a3 100755
--- a/apps/calls
+++ b/apps/calls
Binary files differdiff --git a/apps/calls.subx b/apps/calls.subx
index 9f8b2658..d3418cf0 100644
--- a/apps/calls.subx
+++ b/apps/calls.subx
@@ -821,6 +821,8 @@ next-word-string-or-expression-without-metadata:  # line: (addr stream byte), ou
     #       ++line->read to skip ')'
     #     out->end = &line->data[line->read]
     #     return
+    #   if line->data[line->read] == '('
+    #     abort
     #   if line->data[line->read] == ')'
     #     ++line->read to skip ')'
     #     # make sure there's nothing else of importance
@@ -923,7 +925,7 @@ $next-word-string-or-expression-without-metadata:string-literal:
 $next-word-string-or-expression-without-metadata:check-for-expression:
     # if (line->data[line->read] != '*') goto next check
     3d/compare-eax-and 0x2a/imm32/asterisk
-    75/jump-if-!= $next-word-string-or-expression-without-metadata:check-for-end-of-call/disp8
+    75/jump-if-!= $next-word-string-or-expression-without-metadata:check-for-open-paren/disp8
     # if (line->data[line->read + 1] == ' ') goto error1
     8a/copy-byte *(esi+ecx+0xd) 0/r32/AL
     3d/compare-eax-and 0x20/imm32/space
@@ -954,6 +956,10 @@ $next-word-string-or-expression-without-metadata:paren:
     89/<- *(edi+4) 0/r32/eax
     # return
     e9/jump $next-word-string-or-expression-without-metadata:end/disp32
+$next-word-string-or-expression-without-metadata:check-for-open-paren:
+    # if (line->data[line->read] == '(') abort
+    3d/compare-eax-and 0x28/imm32/open-paren
+    0f 84/jump-if-= $next-word-string-or-expression-without-metadata:error4a/disp32
 $next-word-string-or-expression-without-metadata:check-for-end-of-call:
     # if (line->data[line->read] != ')') goto next check
     3d/compare-eax-and 0x29/imm32/close-paren
@@ -1192,6 +1198,44 @@ $next-word-string-or-expression-without-metadata:error3:
     e8/call syscall_exit/disp32
     # never gets here
 
+$next-word-string-or-expression-without-metadata:error4a:
+    # print(stderr, "error: unexpected '(' within call in '" line "'")
+    # . write-buffered(Stderr, "error: unexpected '(' within call in '")
+    # . . push args
+    68/push "error: unexpected '(' within call in '"/imm32
+    68/push Stderr/imm32
+    # . . call
+    e8/call write-buffered/disp32
+    # . . discard args
+    81 0/subop/add %esp 8/imm32
+    # . write-stream-data(Stderr, line)
+    # . . push args
+    56/push-esi
+    68/push Stderr/imm32
+    # . . call
+    e8/call write-stream-data/disp32
+    # . . discard args
+    81 0/subop/add %esp 8/imm32
+    # . write-buffered(Stderr, "'\n")
+    # . . push args
+    68/push "'\n"/imm32
+    68/push Stderr/imm32
+    # . . call
+    e8/call write-buffered/disp32
+    # . . discard args
+    81 0/subop/add %esp 8/imm32
+    # . flush(Stderr)
+    # . . push args
+    68/push Stderr/imm32
+    # . . call
+    e8/call flush/disp32
+    # . . discard args
+    81 0/subop/add %esp 4/imm32
+    # . syscall(exit, 1)
+    bb/copy-to-ebx 1/imm32
+    e8/call syscall_exit/disp32
+    # never gets here
+
 $next-word-string-or-expression-without-metadata:error4:
     # print(stderr, "error: unexpected text after end of call in '" line "'")
     # . write-buffered(Stderr, "error: unexpected text after end of call in '")
diff --git a/apps/sigils.subx b/apps/sigils.subx
index b076d24e..d5777f2e 100644
--- a/apps/sigils.subx
+++ b/apps/sigils.subx
@@ -1,5 +1,5 @@
-# Experimental syntax sugar for addressing modes that expand into /rm32 and
-# other related arguments.
+# Syntax sugar for addressing modes that expand into /rm32 and other related
+# arguments.
 #
 # To run:
 #   $ ./bootstrap translate init.linux 0*.subx apps/subx-params.subx apps/sigils.subx  -o apps/sigils