Refactor reader macros in AOC Day 8 pt 1
This commit is contained in:
@@ -1,28 +1,10 @@
|
||||
(load "BootCodeCommon.kiss")
|
||||
|
||||
(defreadermacro "" [stream] #| ReaderExp.CallExp(
|
||||
{
|
||||
pos: {file: "bleh", line: 1, column: 1, absoluteChar: 1},
|
||||
def: ReaderExp.Symbol(stream.expect("an instruction", function () { stream.takeUntilAndDrop(" "); }))
|
||||
},
|
||||
[
|
||||
{
|
||||
pos: {file: "fefea", line: 1, column: 1, absoluteChar: 1},
|
||||
def: ReaderExp.CallExp(
|
||||
{
|
||||
pos: {file: "treh", line: 1, column: 1, absoluteChar: 1},
|
||||
def: ReaderExp.Symbol(stream.expect("+/-", function () { stream.takeChars(1); }))
|
||||
},
|
||||
[
|
||||
{
|
||||
pos: {file: "smeeh", line: 1, column: 1, absoluteChar: 1},
|
||||
def: ReaderExp.Symbol("0")
|
||||
},
|
||||
{
|
||||
pos: {file: "greeeh", line: 1, column: 1, absoluteChar: 1},
|
||||
def: ReaderExp.Symbol(stream.expect("an argument", function () { stream.takeUntilAndDrop("\n"); }))
|
||||
}
|
||||
])
|
||||
}
|
||||
])
|
||||
|#)
|
||||
(defreadermacro "" [stream]
|
||||
`(,(ReaderExp.Symbol
|
||||
(begin (stream.dropWhitespace) (nextToken stream)))
|
||||
(,(ReaderExp.Symbol
|
||||
(begin (stream.dropWhitespace) (stream.expect "+/-" (lambda [] (stream.takeChars 1)))))
|
||||
0
|
||||
,(ReaderExp.Symbol
|
||||
(nextToken stream)))))
|
Reference in New Issue
Block a user