diff --git a/README.md b/README.md new file mode 100644 index 0000000..93f5601 --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +hscript +======= + +Parse and evalutate Haxe expressions. + +Usage : + +```haxe +var expr = "var x = 4; 1 + 2 * x"; +var parser = new hscript.Parser(); +var ast = parser.parseString(expr); +var interp = new hscript.Interp(); +trace(interp.execute(ast)); +``` + +In case or parse or runtime error an `hscript.Expr.Error` is throwed. You can use `parser.line` to know the line number. + +You can set some globaly accessible identifiers by using `interp.variables.set("name",value)` + +Advanced Usage +-------------- + +When compiled with `-D hscriptPos` you will get fine error reporting at parsing time. + +You can subclass `hscript.Interp` to override behaviors for `get`, `set`, `call`, `fcall` and `cnew` behaviors. + +You can add more binary and unary operations to the parser by setting `opPriority`, `opRightAssoc` and `unops` content. + +You can use `parser.allowJSON` to allow JSON data. + +You can use `parser.allowTypes` to parse types for local vars, exceptions, function args and return types. Types are ignored by the interpreter. + +You can use `new hscript.Macro(pos).convert(ast)` to convert an hscript AST to a Haxe macros one. \ No newline at end of file diff --git a/release.bat b/release.bat index bf9c9da..8a73378 100644 --- a/release.bat +++ b/release.bat @@ -1,7 +1,7 @@ @echo off rm -rf release mkdir release -cp haxelib.json release +cp haxelib.json README.md release cd release mkdir hscript cd ..