56 lines
1.2 KiB
Plaintext
56 lines
1.2 KiB
Plaintext
(defReaderMacro &start "!" [stream]
|
|
(let [line (stream.expect "a string line" (lambda [] (stream.takeLine)))]
|
|
(ReaderExp.StrExp line)))
|
|
|
|
(function myLine []
|
|
!String that takes the rest of the line
|
|
)
|
|
|
|
(function myBool []
|
|
(begin !false))
|
|
|
|
(defAlias &call pluppers +)
|
|
(defAlias &ident fluffers 5)
|
|
(defAlias &ident buffers 4)
|
|
|
|
(var mySum (pluppers fluffers buffers))
|
|
|
|
// Read b c directly as strings
|
|
(defReaderMacro ["b" "c"] [stream] #{ReaderExp.StrExp(stream.expect("b, or c", function () stream.takeChars(1)));}#)
|
|
|
|
(var str1 b)
|
|
(var str2 c)
|
|
|
|
// rassert asserts the next expression without parens
|
|
(defReaderMacro "rassert" [stream] `(assert ,(read stream)))
|
|
|
|
(function _testQuasiquoteMacro []
|
|
rassert [5]
|
|
rassert b
|
|
rassert fluffers
|
|
(Assert.pass))
|
|
|
|
(undefReaderMacro ["b" "c"])
|
|
|
|
(function _testCommentAtBlockOrArrayEnd []
|
|
[
|
|
(+ 1 2)
|
|
// Comment
|
|
]
|
|
{
|
|
(+ 1 2)
|
|
// Comment
|
|
}
|
|
(Assert.pass))
|
|
|
|
(defReaderMacro &start "bob" [stream] `var1)
|
|
(defReaderMacro "bob" [stream] `var2)
|
|
|
|
|
|
(function _testStartOfLineInMiddle []
|
|
(let [var1 "first"
|
|
var2 "second"]
|
|
|
|
(Assert.equals "firstsecond" (+
|
|
bob bob))))
|