KSR reader macros for basic and reversed cards

This commit is contained in:
2022-12-18 00:59:01 +00:00
parent d22aa9c1bd
commit a297135f8d
2 changed files with 14 additions and 1 deletions

View File

@@ -164,4 +164,16 @@
("?" (elements.push (b.str line)))
("" (break))
(otherwise (throw "bad element for a cloze sequence: $line")))))
`(cloze ,@elements)))
`(cloze ,@elements)))
(defMacroFunction btDefault [exp]
(case (Type.enumConstructor exp.def)
("StrExp"
`(basicText ,exp))
(otherwise exp)))
(defReaderMacro "=>" [stream]
`(card ,(btDefault (read stream)) ,(btDefault (read stream))))
(defReaderMacro "<=>" [stream]
`(reversed ,(btDefault (read stream)) ,(btDefault (read stream))))