Stream.takeLineAsStream()
This commit is contained in:
@@ -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 {
|
public function expect(whatToExpect:String, f:Void->Option<String>):String {
|
||||||
var position = position();
|
var position = position();
|
||||||
switch (f()) {
|
switch (f()) {
|
||||||
|
@@ -109,7 +109,7 @@
|
|||||||
`{
|
`{
|
||||||
(defReaderMacro ,readerMacroStart [stream &builder b]
|
(defReaderMacro ,readerMacroStart [stream &builder b]
|
||||||
(let [nextLineStream
|
(let [nextLineStream
|
||||||
(Stream.fromString (stream.expect "hollywoo macro line" ->(stream.takeLine)))
|
(stream.expect "hollywoo macro line" ->(stream.takeLineAsStream))
|
||||||
methodCall
|
methodCall
|
||||||
(b.callSymbol
|
(b.callSymbol
|
||||||
,methodName
|
,methodName
|
||||||
|
Reference in New Issue
Block a user