Stream.takeLineAsStream()

This commit is contained in:
2022-01-08 22:58:48 -07:00
parent 142969cd22
commit 50c0c7ed9a
2 changed files with 18 additions and 1 deletions

View File

@@ -249,6 +249,23 @@ class Stream {
};
}
public function takeLineAsStream():Option<Stream> {
var lineNo = this.line;
var column = this.column;
var absoluteChar = this.absoluteChar;
return switch (takeLine()) {
case Some(line): Some({
var s = Stream.fromString(line);
s.line = lineNo;
s.column = column;
s.file = this.file;
s.absoluteChar = absoluteChar;
s;
});
default: None;
};
}
public function expect(whatToExpect:String, f:Void->Option<String>):String {
var position = position();
switch (f()) {

View File

@@ -109,7 +109,7 @@
`{
(defReaderMacro ,readerMacroStart [stream &builder b]
(let [nextLineStream
(Stream.fromString (stream.expect "hollywoo macro line" ->(stream.takeLine)))
(stream.expect "hollywoo macro line" ->(stream.takeLineAsStream))
methodCall
(b.callSymbol
,methodName