about summary refs log tree commit diff stats
path: root/400.mu
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-12-04 21:57:51 -0800
committerKartik Agaram <vc@akkartik.com>2020-12-04 23:02:53 -0800
commit18d5bab2b66406ee1e329ef099b375d98f0c2dd8 (patch)
tree00c29a0b83fc049a9362bd5cb1337926257329e1 /400.mu
parent8a8db34f259f12b06f7b87e4f4c1b5530425ff29 (diff)
downloadmu-18d5bab2b66406ee1e329ef099b375d98f0c2dd8.tar.gz
7329 - snapshot: advent day 4 part 2
I've found two bugs in SubX libraries:

1. next-word had an out-of-bounds read
2. next-word was skipping comments, because that's what I need during bootstrapping.
I've created a new variant called next-raw-word that doesn't skip comments.
These really need better names.

We're now at the point where 4b.mu has the right structure and returns
identical result to 4a.mu.
Diffstat (limited to '400.mu')
-rw-r--r--400.mu3
1 files changed, 2 insertions, 1 deletions
diff --git a/400.mu b/400.mu
index d3ff0e9b..23e3ce2d 100644
--- a/400.mu
+++ b/400.mu
@@ -113,7 +113,8 @@ sig write-stream-data f: (addr buffered-file), s: (addr stream byte)
 sig write-int32-decimal out: (addr stream byte), n: int
 sig is-decimal-digit? c: grapheme -> _/eax: boolean
 sig to-decimal-digit in: grapheme -> _/eax: int
-sig next-word line: (addr stream byte), out: (addr slice)
+sig next-word line: (addr stream byte), out: (addr slice)  # skips '#' comments
+sig next-raw-word line: (addr stream byte), out: (addr slice)  # does not skip '#' comments
 sig has-metadata? word: (addr slice), s: (addr string) -> _/eax: boolean
 sig is-valid-name? in: (addr slice) -> _/eax: boolean
 sig is-label? word: (addr slice) -> _/eax: boolean