hiss-read more ergonomic
This commit is contained in:
@@ -14,6 +14,10 @@ class Story {
|
||||
// Separate reader for Hiss expressions:
|
||||
var reader: HissReader;
|
||||
|
||||
function hissRead(str: String) {
|
||||
return reader.read("", HStream.FromString(str));
|
||||
}
|
||||
|
||||
public function new(storyScript: String, storyTeller: StoryTeller) {
|
||||
StaticFiles.compileWith("reader-macros.hiss");
|
||||
StaticFiles.compileWith("hanklib.hiss");
|
||||
@@ -26,7 +30,8 @@ class Story {
|
||||
|
||||
interp.importFunction(storyTeller, storyTeller.handleOutput, "*handle-output*");
|
||||
interp.importFunction(storyTeller, storyTeller.handleChoices, "*handle-choices*");
|
||||
interp.importFunction(reader, reader.read, "hiss-read");
|
||||
interp.importFunction(this, hissRead, "hiss-read");
|
||||
interp.importFunction(reader, reader.readDelimitedList, "hiss-read-delimited-list", List([Int(3)]) /* keep blankELements wrapped */, ["terminator", "delimiters", "start", "stream"]);
|
||||
|
||||
interp.load("hanklib.hiss");
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
(HStream:drop-whitespace stream)
|
||||
(HStream:peek stream 1))
|
||||
("{"
|
||||
(hiss-read "" (HStream:from-string (trim (substring (first (HStream:take-until stream ["}"])) 1)))))
|
||||
(hiss-read (trim (substring (first (HStream:take-until stream ["}"])) 1))))
|
||||
(default t))
|
||||
output
|
||||
(read-output "" stream t)
|
||||
|
||||
Reference in New Issue
Block a user