Implementing Hank as a hiss variant

This commit is contained in:
2020-04-25 17:25:33 +01:00
parent 569c382246
commit e9e4c9f802
5 changed files with 63 additions and 1 deletions

View File

@@ -7,8 +7,10 @@
"version": "0.0.8",
"releasenote": "It isn't safe to use this library yet.",
"contributors": ["NQNStudios"],
"classPath": "src/",
"main": "hank.Test",
"dependencies": {
"hscript": "",
"hiss": "",
"utest": ""
}
}

5
hiss.hxml Normal file
View File

@@ -0,0 +1,5 @@
-lib hiss
-cp src
-main hank.Test
--resource C:/cygwin64/home/u0920639/hiss/src/hiss/stdlib.hiss@src/hiss/stdlib.hiss
--interp

23
src/hank/Test.hx Normal file
View File

@@ -0,0 +1,23 @@
package hank;
import hiss.HissRepl;
import hiss.HissReader;
import hiss.HissTools;
class Test {
public static function main() {
trace ("Running Hank examples!");
var exampleDir = 'src/hank/examples/';
for (file in sys.FileSystem.readDirectory(exampleDir)) {
var repl = new HissRepl();
repl.load('src/hank/hank.hiss');
var path = haxe.io.Path.join([exampleDir, file]).toString();
trace('Reading $file:');
trace(HissTools.toPrint(repl.read(sys.io.File.getContent(path))));
trace('Running $file:');
trace(repl.load(path));
}
}
}

View File

@@ -0,0 +1 @@
Hello, world!

31
src/hank/hank.hiss Normal file
View File

@@ -0,0 +1,31 @@
/*
['INCLUDE ' => include],
['<-' => thread],
['->' => divert],
['===' => knot],
['==' => knot],
['=' => stitch],
['~' => haxeLine],
['```' => haxeBlock],
['-' => gather],
['*' => choice],
['+' => choice],
['#' => tag]];
[] starts choice conditional text
{ } starts a Hiss insertion (usually for variables)
( ) starts a Hiss funcall insertion
< > starts an alt expression
*/
(setq *hank-inline-terminators* '(
"->"
"["
"{"
"("
"<"))
(defun read-output (_ stream _)
(list 'print (get (call stream take-until (list "\n") t) output)))
(set-default-read-function read-output)