Implementing Hank as a hiss variant
This commit is contained in:
@@ -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
5
hiss.hxml
Normal 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
23
src/hank/Test.hx
Normal 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
1
src/hank/examples/hello.hank
Normal file
1
src/hank/examples/hello.hank
Normal file
@@ -0,0 +1 @@
|
||||
Hello, world!
|
||||
31
src/hank/hank.hiss
Normal file
31
src/hank/hank.hiss
Normal 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)
|
||||
Reference in New Issue
Block a user