fix new bug in reader macros without &builder

This commit is contained in:
2021-11-29 17:06:17 -07:00
parent 67f56aa68d
commit 5706dcaa6b
3 changed files with 9 additions and 8 deletions

View File

@@ -1,12 +1,12 @@
(defmacro year [num &body body]
(defMacro year [num &body body]
`(#when ,(symbol (+ "year" (symbolNameValue num)))
(print (+ "year " (Std.string ,num)))
,@body))
(defmacro day [num &body body]
(defMacro day [num &body body]
`(#when ,(symbol (+ "day" (symbolNameValue num)))
(print (+ "day " (Std.string ,num)))
,@body))
(defmacro dayTodo [num]
(defMacro dayTodo [num]
`(day ,num (print "TODO")))

View File

@@ -29,10 +29,9 @@
(3 (N num))
(otherwise (throw (+ "Bad facing" facing)))))
(defReaderMacro "" [stream]
(defReaderMacro "" [stream &builder b]
(stream.dropWhitespace)
(if (stream.isEmpty)
null
`(,(ReaderExp.Symbol
(stream.expect "a ship command" (lambda [] (stream.takeChars 1))))
,(ReaderExp.Symbol (stream.expect "a number argument" (lambda [] (stream.takeUntilAndDrop #|"\n"|#)))))))
`(,(b.symbol (stream.expect "a ship command" ->(stream.takeChars 1)))
,(b.symbol (stream.expect "a number argument" ->(stream.takeUntilAndDrop #|"\n"|#))))))