diff options
author | Kartik Agaram <vc@akkartik.com> | 2021-02-07 10:52:04 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2021-02-07 10:52:04 -0800 |
commit | f626421bc4f526c48b789914a3a1e088a9250278 (patch) | |
tree | 578b7f37c5477d66fa3b470b740aff3068bfd7dd /apps | |
parent | 5268b0e1df434e267b365e931fead9caa151c54b (diff) | |
download | mu-f626421bc4f526c48b789914a3a1e088a9250278.tar.gz |
7692
It's bad enough that metadata comments are restricted to integer literals; let's at least make them work on _all_ integer literals.
Diffstat (limited to 'apps')
-rwxr-xr-x | apps/mu | bin | 602072 -> 602314 bytes | |||
-rw-r--r-- | apps/mu.subx | 35 | ||||
-rw-r--r-- | apps/tile/gap-buffer.mu | 4 |
3 files changed, 33 insertions, 6 deletions
diff --git a/apps/mu b/apps/mu index dd16a282..1f4e781a 100755 --- a/apps/mu +++ b/apps/mu Binary files differdiff --git a/apps/mu.subx b/apps/mu.subx index 7a0859df..e6ad162d 100644 --- a/apps/mu.subx +++ b/apps/mu.subx @@ -5648,6 +5648,34 @@ test-array-size-in-hex: 5d/pop-to-ebp c3/return +test-array-size-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: (array int 3/bar)\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-convert-function-with-populate: # . prologue 55/push-ebp @@ -17132,11 +17160,10 @@ $parse-type:check-for-int: (is-decimal-digit? %eax) # => eax 3d/compare-eax-and 0/imm32/false 74/jump-if-= break/disp8 - # - (is-hex-int? %ecx) # => eax - 3d/compare-eax-and 0/imm32/false - 74/jump-if-= break/disp8 $parse-type:int: + # strip out metadata + (next-token-from-slice *ecx *(ecx+4) 0x2f %ecx) + # (check-mu-hex-int %ecx *(ebp+0x14) *(ebp+0x18)) (parse-hex-int-from-slice %ecx) # => eax c7 0/subop/copy *(edx+4) 9/imm32/type-id-array-capacity # Type-tree-value diff --git a/apps/tile/gap-buffer.mu b/apps/tile/gap-buffer.mu index b5a690ec..0132daf0 100644 --- a/apps/tile/gap-buffer.mu +++ b/apps/tile/gap-buffer.mu @@ -14,7 +14,7 @@ fn initialize-gap-buffer _self: (addr gap-buffer) { # just for tests fn initialize-gap-buffer-with self: (addr gap-buffer), s: (addr array byte) { initialize-gap-buffer self - var stream-storage: (stream byte 0x10) # max-word-size + var stream-storage: (stream byte 0x10/max-word-size) var stream/ecx: (addr stream byte) <- address stream-storage write stream, s { @@ -238,7 +238,7 @@ fn gap-buffer-equal? _self: (addr gap-buffer), s: (addr array byte) -> _/eax: bo # complication: graphemes may be multiple bytes # so don't rely on length # instead turn the expected result into a stream and arrange to read from it in order - var stream-storage: (stream byte 0x10) # max-word-size + var stream-storage: (stream byte 0x10/max-word-size) var expected-stream/ecx: (addr stream byte) <- address stream-storage write expected-stream, s # compare left |