exp comments

This commit is contained in:
2021-11-23 19:33:45 -07:00
parent 6bac8c2c9c
commit 0be08fb13c
3 changed files with 14 additions and 1 deletions

View File

@@ -56,7 +56,13 @@ class Reader {
readTable["//"] = (stream:Stream, k) -> {
stream.takeUntilAndDrop("\n");
null;
};
// Special comment syntax that disables the next whole reader expression:
readTable["**"] = (stream:Stream, k) -> {
assertRead(stream, k);
null;
};
readTable["#|"] = (stream:Stream, k) -> RawHaxe(stream.expect("closing |#", () -> stream.takeUntilAndDrop("|#")));
readTable[":"] = (stream:Stream, k) -> TypedExp(nextToken(stream, "a type path"), assertRead(stream, k));

View File

@@ -318,6 +318,10 @@ class BasicTestCase extends Test {
function testCountingLambda() {
_testCountingLambda();
}
function testExpComment() {
_testExpComment();
}
}
class BasicObject {

View File

@@ -575,4 +575,7 @@
(Assert.equals 1 (fullSyntax))
(Assert.equals 2 (fullSyntax))
(Assert.equals 1 (arrowSyntax))
(Assert.equals 2 (arrowSyntax))))
(Assert.equals 2 (arrowSyntax))))
(function _testExpComment []
(Assert.equals 15 (+ **6 5 **(- 5 11) 5 (+ 5 **(20 9)))))