about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-11-28 01:13:44 -0800
committerKartik Agaram <vc@akkartik.com>2019-11-28 01:14:15 -0800
commit0c24aa334e419789a40f44f61d889928f0154030 (patch)
tree6ba0921862ccec1524731ede9256cc2dea45738b
parent367394c7de7f2483670769b1c1589302de43cf56 (diff)
downloadmu-0c24aa334e419789a40f44f61d889928f0154030.tar.gz
5772
-rwxr-xr-xapps/mubin55513 -> 56081 bytes
-rw-r--r--apps/mu.subx110
2 files changed, 110 insertions, 0 deletions
diff --git a/apps/mu b/apps/mu
index 3a44c191..5fede48e 100755
--- a/apps/mu
+++ b/apps/mu
Binary files differdiff --git a/apps/mu.subx b/apps/mu.subx
index 90315188..4a449e67 100644
--- a/apps/mu.subx
+++ b/apps/mu.subx
@@ -964,6 +964,7 @@ test-is-identifier-Z:
     c3/return
 
 test-is-identifier-@:
+    # character before 'A' is invalid
     # . prologue
     55/push-ebp
     89/<- %ebp 4/r32/esp
@@ -984,6 +985,115 @@ test-is-identifier-@:
     5d/pop-to-ebp
     c3/return
 
+test-is-identifier-square-bracket:
+    # character after 'Z' is invalid
+    # . prologue
+    55/push-ebp
+    89/<- %ebp 4/r32/esp
+    # (eax..ecx) = "[a"
+    b8/copy-to-eax "[a"/imm32
+    8b/-> *eax 1/r32/ecx
+    8d/copy-address *(eax+ecx+4) 1/r32/ecx
+    05/add-to-eax 4/imm32
+    # var slice/ecx = {eax, ecx}
+    51/push-ecx
+    50/push-eax
+    89/<- %ecx 4/r32/esp
+    #
+    (is-identifier? %ecx)
+    (check-ints-equal %eax 0 "F - test-is-identifier-@")
+    # . epilogue
+    89/<- %esp 5/r32/ebp
+    5d/pop-to-ebp
+    c3/return
+
+test-is-identifier-backtick:
+    # character before 'a' is invalid
+    # . prologue
+    55/push-ebp
+    89/<- %ebp 4/r32/esp
+    # (eax..ecx) = "`a"
+    b8/copy-to-eax "`a"/imm32
+    8b/-> *eax 1/r32/ecx
+    8d/copy-address *(eax+ecx+4) 1/r32/ecx
+    05/add-to-eax 4/imm32
+    # var slice/ecx = {eax, ecx}
+    51/push-ecx
+    50/push-eax
+    89/<- %ecx 4/r32/esp
+    #
+    (is-identifier? %ecx)
+    (check-ints-equal %eax 0 "F - test-is-identifier-backtick")
+    # . epilogue
+    89/<- %esp 5/r32/ebp
+    5d/pop-to-ebp
+    c3/return
+
+test-is-identifier-curly-brace-open:
+    # character after 'z' is invalid; also used for blocks
+    # . prologue
+    55/push-ebp
+    89/<- %ebp 4/r32/esp
+    # (eax..ecx) = "{a"
+    b8/copy-to-eax "{a"/imm32
+    8b/-> *eax 1/r32/ecx
+    8d/copy-address *(eax+ecx+4) 1/r32/ecx
+    05/add-to-eax 4/imm32
+    # var slice/ecx = {eax, ecx}
+    51/push-ecx
+    50/push-eax
+    89/<- %ecx 4/r32/esp
+    #
+    (is-identifier? %ecx)
+    (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-open")
+    # . epilogue
+    89/<- %esp 5/r32/ebp
+    5d/pop-to-ebp
+    c3/return
+
+test-is-identifier-curly-brace-close:
+    # . prologue
+    55/push-ebp
+    89/<- %ebp 4/r32/esp
+    # (eax..ecx) = "}a"
+    b8/copy-to-eax "}a"/imm32
+    8b/-> *eax 1/r32/ecx
+    8d/copy-address *(eax+ecx+4) 1/r32/ecx
+    05/add-to-eax 4/imm32
+    # var slice/ecx = {eax, ecx}
+    51/push-ecx
+    50/push-eax
+    89/<- %ecx 4/r32/esp
+    #
+    (is-identifier? %ecx)
+    (check-ints-equal %eax 0 "F - test-is-identifier-curly-brace-close")
+    # . epilogue
+    89/<- %esp 5/r32/ebp
+    5d/pop-to-ebp
+    c3/return
+
+test-is-identifier-hyphen:
+    # disallow leading '-' since '->' has special meaning
+    # . prologue
+    55/push-ebp
+    89/<- %ebp 4/r32/esp
+    # (eax..ecx) = "-a"
+    b8/copy-to-eax "-a"/imm32
+    8b/-> *eax 1/r32/ecx
+    8d/copy-address *(eax+ecx+4) 1/r32/ecx
+    05/add-to-eax 4/imm32
+    # var slice/ecx = {eax, ecx}
+    51/push-ecx
+    50/push-eax
+    89/<- %ecx 4/r32/esp
+    #
+    (is-identifier? %ecx)
+    (check-ints-equal %eax 0 "F - test-is-identifier-hyphen")
+    # . epilogue
+    89/<- %esp 5/r32/ebp
+    5d/pop-to-ebp
+    c3/return
+
 populate-mu-function-body:  # in : (address buffered-file), out : (address function)
     # . prologue
     55/push-ebp