exp comments

This commit is contained in:
2021-11-23 19:33:45 -07:00
parent e43c70f659
commit 855fa06a87
3 changed files with 14 additions and 1 deletions

View File

@@ -57,6 +57,12 @@ class Reader {
stream.takeUntilAndDrop("\n"); stream.takeUntilAndDrop("\n");
null; 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) -> RawHaxe(stream.expect("closing |#", () -> stream.takeUntilAndDrop("|#")));
readTable[":"] = (stream:Stream, k) -> TypedExp(nextToken(stream, "a type path"), assertRead(stream, k)); 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() { function testCountingLambda() {
_testCountingLambda(); _testCountingLambda();
} }
function testExpComment() {
_testExpComment();
}
} }
class BasicObject { class BasicObject {

View File

@@ -576,3 +576,6 @@
(Assert.equals 2 (fullSyntax)) (Assert.equals 2 (fullSyntax))
(Assert.equals 1 (arrowSyntax)) (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)))))