raw strings
This commit is contained in:
@@ -47,7 +47,9 @@ class Reader {
|
||||
|
||||
readTable["("] = (stream, k) -> CallExp(assertRead(stream, k), readExpArray(stream, ")", k));
|
||||
readTable["["] = (stream, k) -> ListExp(readExpArray(stream, "]", k));
|
||||
readTable["\""] = (stream, k) -> StrExp(stream.expect("closing \"", () -> stream.takeUntilAndDrop("\"")));
|
||||
readTable['"'] = readString;
|
||||
readTable["#"] = readRawString;
|
||||
|
||||
readTable["/*"] = (stream, k) -> {
|
||||
stream.takeUntilAndDrop("*/");
|
||||
null;
|
||||
|
@@ -76,7 +76,7 @@ class Stream {
|
||||
var lineLengths = [];
|
||||
|
||||
/** Every drop call should end up calling dropChars() or the position tracker will be wrong. **/
|
||||
private function dropChars(count:Int) {
|
||||
public function dropChars(count:Int) {
|
||||
for (idx in 0...count) {
|
||||
switch (content.charAt(idx)) {
|
||||
case "\n":
|
||||
|
@@ -273,6 +273,10 @@ class BasicTestCase extends Test {
|
||||
function testPatternLets() {
|
||||
_testPatternLets();
|
||||
}
|
||||
|
||||
function testRawString() {
|
||||
_testRawString();
|
||||
}
|
||||
}
|
||||
|
||||
class BasicObject {
|
||||
|
@@ -454,4 +454,8 @@
|
||||
(Assert.fail))
|
||||
(unlessLet [(Some (or 5 6)) some5]
|
||||
(print "something else went wrong!")
|
||||
(Assert.fail))))
|
||||
(Assert.fail))))
|
||||
|
||||
(defun _testRawString []
|
||||
(Assert.equals #| "\\" |# #"\"#)
|
||||
(Assert.equals #| "\"#" |# ##""#"##))
|
Reference in New Issue
Block a user