diff --git a/haxelib.json b/haxelib.json index c94336d..2a65bca 100644 --- a/haxelib.json +++ b/haxelib.json @@ -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": "" } } diff --git a/hiss.hxml b/hiss.hxml new file mode 100644 index 0000000..2a37498 --- /dev/null +++ b/hiss.hxml @@ -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 \ No newline at end of file diff --git a/src/hank/Test.hx b/src/hank/Test.hx new file mode 100644 index 0000000..760e93d --- /dev/null +++ b/src/hank/Test.hx @@ -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)); + } + } +} \ No newline at end of file diff --git a/src/hank/examples/hello.hank b/src/hank/examples/hello.hank new file mode 100644 index 0000000..5dd01c1 --- /dev/null +++ b/src/hank/examples/hello.hank @@ -0,0 +1 @@ +Hello, world! \ No newline at end of file diff --git a/src/hank/hank.hiss b/src/hank/hank.hiss new file mode 100644 index 0000000..e2fdcc6 --- /dev/null +++ b/src/hank/hank.hiss @@ -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) \ No newline at end of file