added README.md
This commit is contained in:
@@ -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.
|
||||
+1
-1
@@ -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 ..
|
||||
|
||||
Reference in New Issue
Block a user