fix { reader macro comment error

This commit is contained in:
2021-10-28 15:12:04 -04:00
parent d96c4f30fa
commit aee1c3b7ef
2 changed files with 15 additions and 9 deletions

View File

@@ -77,14 +77,16 @@ class Reader {
// Lets you construct key-value pairs for map literals or for-loops // Lets you construct key-value pairs for map literals or for-loops
readTable["=>"] = (stream:Stream, k) -> KeyValueExp(assertRead(stream, k), assertRead(stream, k)); readTable["=>"] = (stream:Stream, k) -> KeyValueExp(assertRead(stream, k), assertRead(stream, k));
readTable[")"] = (stream:Stream, k) -> { function unmatchedBracket(b:String) {
stream.putBackString(")"); readTable[b] = (stream:Stream, k) -> {
throw new UnmatchedBracketSignal(")", stream.position()); stream.putBackString(b);
}; throw new UnmatchedBracketSignal(b, stream.position());
readTable["]"] = (stream:Stream, k) -> {
stream.putBackString("]");
throw new UnmatchedBracketSignal("]", stream.position());
}; };
}
unmatchedBracket(")");
unmatchedBracket("]");
unmatchedBracket("}");
readTable["`"] = (stream:Stream, k) -> Quasiquote(assertRead(stream, k)); readTable["`"] = (stream:Stream, k) -> Quasiquote(assertRead(stream, k));
readTable[","] = (stream:Stream, k) -> Unquote(assertRead(stream, k)); readTable[","] = (stream:Stream, k) -> Unquote(assertRead(stream, k));

View File

@@ -30,7 +30,11 @@
rassert fluffers rassert fluffers
(Assert.pass)) (Assert.pass))
(function _testCommentAtBlockEnd [] (function _testCommentAtBlockOrArrayEnd []
[
(+ 1 2)
// Comment
]
{ {
(+ 1 2) (+ 1 2)
// Comment // Comment