Commit Graph

291 Commits

Author SHA1 Message Date
Stephen Chung
be97047e51 Limit modules loading. 2020-05-15 21:40:54 +08:00
Stephen Chung
55c97eb649 Add progress tracking and operations limit. 2020-05-15 11:43:32 +08:00
Stephen Chung
5c61827c7c Force-cast local variable names when pushing into scope. 2020-05-14 11:21:56 +08:00
Stephen Chung
e6d6a709f0 Expand section on modules and packages. 2020-05-13 22:49:12 +08:00
Stephen Chung
d6fd5416b0 Add replace function for characters 2020-05-12 23:30:55 +08:00
Stephen Chung
0d20137d6c Implement private modifier for functions. 2020-05-09 11:29:30 +08:00
Stephen Chung
d1de84fdd2 Add comments and fix documentation. 2020-05-09 10:00:59 +08:00
Stephen Chung
e50fcc385f Pre-calculate index for module-qualified calls. 2020-05-08 22:38:56 +08:00
Stephen Chung
eb52bfa28a Add export statement. 2020-05-08 16:49:24 +08:00
Stephen Chung
f1abd11571 Add docs and test on creating module from AST and file. 2020-05-06 23:00:26 +08:00
Stephen Chung
0cb0393c24 Bump version. 2020-05-06 19:59:45 +08:00
Stephen Chung
88fec57394 Make module_resolver optional and remove NullModuleResolver. 2020-05-06 16:09:44 +08:00
Stephen Chung
c9571d375a Add position to script error. 2020-05-06 00:09:04 +08:00
Stephen Chung
82e1af7acd Implement module resolvers. 2020-05-05 23:57:25 +08:00
Stephen Chung
036c054ba8 Fix indexer example. 2020-05-05 20:55:06 +08:00
Stephen Chung
a1bcc5cd7d Merge branch 'master' into namespace 2020-05-05 20:42:16 +08:00
Stephen Chung
f081040767 Add support for custom type indexers. 2020-05-05 20:38:48 +08:00
Stephen Chung
ff86ae1bd8 Update README with module functions API. 2020-05-05 18:26:08 +08:00
Stephen Chung
143861747d Rename sub-scope/SubScope to module. 2020-05-05 10:39:12 +08:00
Stephen Chung
64036f69ca Refine modules. 2020-05-04 23:07:42 +08:00
Stephen Chung
2bdd174f16 Add import statement. 2020-05-04 19:36:58 +08:00
Stephen Chung
d83b829810 Avoid copying arguments for function calls. 2020-05-03 16:54:24 +08:00
Stephen Chung
4d98468aa6 Merge branch 'master' of https://github.com/jonathandturner/rhai 2020-05-01 17:52:34 +08:00
Cheng JIANG
fb2e48cca2
fix naming 2020-05-01 11:27:27 +02:00
Stephen Chung
60b52c142e Fix README example for on_print and on_debug. 2020-04-29 23:03:18 +08:00
Stephen Chung
33d3e34908 Deep linking for dot/index chains. 2020-04-26 18:04:07 +08:00
Stephen Chung
a306979a9c Fix tests. 2020-04-23 14:00:29 +08:00
Stephen Chung
05bad53011 Encapsulate function calls and handle map property access more efficiently. 2020-04-23 10:21:02 +08:00
Stephen Chung
c40c0a0bc3 Add From<Vec<T>> and From<HashMap<String, T>> for Dynamic. 2020-04-22 14:07:34 +08:00
Stephen Chung
69733688bf Make all public API's return Box<EvalAltResult> to reduce footprint. 2020-04-21 23:25:12 +08:00
Stephen Chung
0306d15c04 Split core and standard libraries into packages. 2020-04-21 00:11:25 +08:00
Stephen Chung
dd09dbf79e Add section on operator overloading. 2020-04-19 18:32:53 +08:00
Stephen Chung
53f7edf306 Add doc on performance and min builds. 2020-04-19 13:22:37 +08:00
Stephen Chung
674d6c856f Bump version to 0.13.0. 2020-04-15 22:27:24 +08:00
Stephen Chung
691541c176 Add more benchmarks. 2020-04-13 23:38:10 +08:00
Stephen Chung
20bc66c5f6 Merge branch 'master' into enum-Dynamic 2020-04-13 21:34:20 +08:00
Stephen Chung
254522b268 Do not run test_string_substring if no_object. 2020-04-13 14:26:53 +08:00
Stephen Chung
2e9a5f7a89 Add sub_string, crop and index_of to String. 2020-04-13 12:29:22 +08:00
Stephen Chung
5796e520ec Support Dynamic return values. 2020-04-13 10:27:08 +08:00
Stephen Chung
5152a40e93 Change Dynamic to enum. 2020-04-12 23:00:06 +08:00
Stephen Chung
5848339d5a Add timestamp support. 2020-04-11 16:06:57 +08:00
Stephen Chung
d73cfb6da5 Allow escaping quotes in strings. 2020-04-11 12:46:10 +08:00
Stephen Chung
c1b16b1a35 Add remove/insert to arrays and maps. 2020-04-10 21:59:29 +08:00
Stephen Chung
ff8eca8a5e Add parse_json. 2020-04-10 17:14:07 +08:00
Stephen Chung
5d611d1674 Add docs on JSON parsing. 2020-04-10 15:18:26 +08:00
Stephen Chung
adbfceb5be Do not omit error enum variants. 2020-04-10 12:16:39 +08:00
Stephen Chung
3609150dcf Bump version to 0.12.0. 2020-04-09 18:45:49 +08:00
Stephen Chung
34ef2d6e00 Rename AnonymousFn to Func 2020-04-09 10:38:33 +08:00
Stephen Chung
518725e119 Add support for anonymous functions in Rust. 2020-04-08 23:01:48 +08:00
Stephen Chung
bcff6bfd71 Remove no_stdlib feature in favor of Engine::new_raw(). 2020-04-08 10:19:03 +08:00
Stephen Chung
e0bb2e5c97 Change optimize_ast to take optimization level as parameter. 2020-04-08 09:30:50 +08:00
Stephen Chung
9f3646d9ec Keep only one call_fn, adds tuples of one and zero. 2020-04-07 21:50:33 +08:00
Stephen Chung
e795a50ae2 Make Engine reentrant to prepare for parallel execution. 2020-04-07 13:23:06 +08:00
Stephen Chung
e204ae1a2c Add 'in' expression. 2020-04-06 17:47:34 +08:00
Stephen Chung
2bb195cd65 Add doc tests to Scope. 2020-04-05 23:43:40 +08:00
Stephen Chung
c4498d147d Add set_value to Scope. 2020-04-05 19:17:48 +08:00
Stephen Chung
3f247fd695 Allow passing in custom Scope to call_fn. 2020-04-05 12:17:31 +08:00
Stephen Chung
29150faef2 Improve AST evaluation efficiency by sharing functions. 2020-04-04 22:00:44 +08:00
Stephen Chung
12a379dd57 Add stepped range function and keys/values for maps. 2020-04-04 12:20:24 +08:00
Stephen Chung
a79f2a209c Make Engine Send+Sync. 2020-04-03 17:17:00 +08:00
Stephen Chung
0873bdc152 Add sync feature to make Dynamic, Scope and AST Send + Sync. 2020-04-02 19:40:02 +08:00
Stephen Chung
5e7c9b47d5 Rename downcast to try_cast and add cast for Dynamic. 2020-04-02 12:35:44 +08:00
Stephen Chung
c4a51b1390 Add append/mixin functions for arrays and maps. 2020-04-01 22:56:54 +08:00
Stephen Chung
4ea2fb88ae Add continue statement. 2020-04-01 16:22:18 +08:00
Stephen Chung
d7ac57c060 Minor code cleanup. 2020-04-01 09:51:33 +08:00
Stephen Chung
dcf5eaf64d Add to_string to prepare for string interpolation. 2020-03-31 10:00:17 +08:00
Stephen Chung
01c0b51017 Change object maps to #{ ... } 2020-03-30 17:40:26 +08:00
Stephen Chung
fce51758d1 Add support for string literal property names in object maps. 2020-03-30 12:14:59 +08:00
Stephen Chung
45ee51874f Add object maps. 2020-03-29 23:53:35 +08:00
Stephen Chung
ef6c6ea6d2 Add no_object feature to disable objects. 2020-03-29 17:15:12 +08:00
Stephen Chung
ef6dd9414a Allow if expressions. 2020-03-27 23:47:23 +08:00
Stephen Chung
337a96394f Limit function calls depth. 2020-03-27 14:34:01 +08:00
Stephen Chung
bcab024d22 Add info to pull directly from GitHub. 2020-03-24 09:49:19 +08:00
Stephen Chung
1b4bcbcfdf Add evaluate expressions. 2020-03-22 21:03:58 +08:00
Stephen Chung
b6320c0eef Minor fine tuning. 2020-03-22 10:18:16 +08:00
Stephen Chung
bd6eb27154 Undo secion changes to README on optimization levels. 2020-03-21 00:40:49 +08:00
Stephen Chung
ed996e71d6 Enable dot operations on constant variables. 2020-03-20 19:27:02 +08:00
Stephen Chung
16ea8f416e Revise section on function side effects because Rhai functions cannot mutate state. 2020-03-19 22:29:24 +08:00
Stephen Chung
6a6c5f30de Add eval function. 2020-03-19 19:53:42 +08:00
Stephen Chung
cc8ec12691 Add more comments and examples. 2020-03-19 13:52:10 +08:00
Stephen Chung
0dc51f8e59 Removee debug_msgs feature. 2020-03-18 22:03:50 +08:00
Stephen Chung
3518c5a630 Bump version to 0.11.0. 2020-03-18 12:13:44 +08:00
Stephen Chung
e7c669343e Add no_std example. 2020-03-18 12:09:34 +08:00
Stephen Chung
ecded729ad Finalize no_std support. 2020-03-18 10:50:51 +08:00
Stephen Chung
777f66ff3c Add section on statements and variables. 2020-03-18 10:42:27 +08:00
Stephen Chung
abe5365bfd Improve error messages to lists. 2020-03-18 10:40:07 +08:00
Stephen Chung
d4311bddb0 Put comments into example scripts. 2020-03-18 10:40:07 +08:00
Stephen Chung
35e354eb41 Refine README. 2020-03-16 12:42:01 +08:00
Stephen Chung
372321dfe3 Add full optimization level for aggressive optimizing. 2020-03-15 22:39:58 +08:00
Stephen Chung
973153e832 Add no_optimize feature to disable optimizations. 2020-03-14 20:06:10 +08:00
Stephen Chung
26bdc8ba08 FIX - fixes panic when constant array is assigned to. Refine README section on constants. 2020-03-14 19:46:44 +08:00
Stephen Chung
cb6171ebcd Merge branch 'constants' 2020-03-14 14:33:56 +08:00
Stephen Chung
c7a6777b70
Merge branch 'master' into master 2020-03-13 18:27:53 +08:00
Stephen Chung
9844ae8665 Add constants. 2020-03-13 18:12:41 +08:00
Jarkko Kuukkanen
6c72e3c48b
Change filename to path for clarity 2020-03-13 12:07:51 +02:00
Stephen Chung
91317c0d3e New sample script - primes.rhai. 2020-03-12 23:46:40 +08:00
Stephen Chung
da440a5dff Add optimization section to README. 2020-03-12 21:19:34 +08:00
Stephen Chung
560da5fdc6 Allow call_fn with only one parameter; consume can retain functions, eval cannot. 2020-03-12 14:54:14 +08:00
Stephen Chung
e24d3a7ade Allow overloading of script functions. 2020-03-12 13:02:13 +08:00
Stephen Chung
7c4d22d98a Add no_function feature to disable script-defined functions. 2020-03-11 13:28:12 +08:00
Stephen Chung
708c285a0a Add only_i32 and only_i64 features. 2020-03-10 23:06:20 +08:00
Stephen Chung
e22aaca5c1 Make sure all tests run with all features. 2020-03-10 19:48:47 +08:00
Stephen Chung
cc772c6e2a Add no_float feature to disable floating-point. 2020-03-10 18:32:01 +08:00
Stephen Chung
52b5732bcb Add no_inidex feature to disable arrays and indexing. 2020-03-10 17:10:33 +08:00
Stephen Chung
f3bcb2a10d Simplify call_fn API, no need to pass &mut references. 2020-03-10 14:09:05 +08:00
Stephen Chung
711cd9bb1c Improve repl and rhai_runner examples with error messages. 2020-03-10 11:25:34 +08:00
Stephen Chung
63482d5a79 Use ? operator for examples. 2020-03-09 16:54:43 +08:00
Stephen Chung
a6899afb11 Refine README. 2020-03-09 12:53:07 +08:00
Stephen Chung
b9d562eba4 Add standard math functions and make power functions checked. 2020-03-09 11:42:10 +08:00
Stephen Chung
c5b40783ef Add unchecked feature to remove arithmetic operations checking. 2020-03-08 23:14:18 +08:00
Stephen Chung
b1b25d3043 Add fallible functions support and replace most arithmetic operations with checked versions. 2020-03-08 22:47:13 +08:00
Stephen Chung
daa581bac7 Add append to strings. 2020-03-08 09:19:04 +08:00
Stephen Chung
ea82ee81d6 Fix call_fn to take &ast instead of ast. 2020-03-07 00:29:45 +08:00
Stephen Chung
42fe5e8b95 Add documentation of call_fn to README. 2020-03-06 11:26:58 +08:00
Stephen Chung
883f08c026 Enable more indexing expressions. 2020-03-05 20:28:03 +08:00
Stephen Chung
c9395049e2 Remove no-std feature and rename stdlib to no_stdlib. 2020-03-05 10:18:46 +08:00
Stephen Chung
bb56a7a843 Code refactor, bug fixes, code docs. 2020-03-04 22:00:01 +08:00
Stephen Chung
3af421ae5f Fix problems with script-defined functions. 2020-03-03 23:31:16 +08:00
Stephen Chung
71a3c79915 Fix number parsing. 2020-03-03 21:39:25 +08:00
Stephen Chung
9f80bf03c4 Add throw. 2020-03-03 18:15:20 +08:00
Stephen Chung
e2cb111e4b Add type_of function. 2020-03-03 17:28:38 +08:00
Stephen Chung
95d0b2e620 Better error messages for function definitions. 2020-03-03 16:23:55 +08:00
Stephen Chung
a1591ae45b Better API for Scope. 2020-03-03 15:20:20 +08:00
Stephen Chung
ed8d2ac20f Add else if control flow. 2020-03-02 17:04:56 +08:00
Stephen Chung
318bf97986 Bump version to 0.10.1. 2020-03-02 15:20:29 +08:00
Stephen Chung
a5e09295f8 Allow comparisons between different types (returning false). 2020-03-02 14:28:42 +08:00
Stephen Chung
22a505b57b Short-curcuit boolean operators. 2020-03-02 12:08:03 +08:00
Stephen Chung
b152ed88f0 Move built-in functions into separate module. 2020-03-01 17:37:47 +08:00
Stephen Chung
e93fd7d3fe Properly handle char types. 2020-03-01 13:30:22 +08:00
Stephen Chung
8128c0cf24 Add pad and truncate array functions. 2020-02-25 16:23:59 +08:00
Stephen Chung
80a9abada6 Introduce to_int and to_float conersion functions. 2020-02-25 15:02:50 +08:00
Stephen Chung
2e296ff9d7 Fix MarkDown style. 2020-02-25 15:01:50 +08:00
Stephen Chung
7893a9734b Minor fixes to README. 2020-02-25 11:23:46 +08:00
Stephen Chung
f8485932b5 Add documentation on pre-compilation. 2020-02-25 11:08:40 +08:00
Stephen Chung
a0c5635712 Update README with new features. 2020-02-25 10:43:13 +08:00
timfish
82fd20b2b1 Rust 2018 2019-09-18 11:21:07 +01:00
timfish
d7d0507f5a Fix readme and a couple of mis-named types? 2019-09-16 22:14:14 +01:00
Hugo Locurcio
e3bee78030
Fix mixed indentation in the README
This makes the Loop example script display correctly on GitHub.
2019-09-09 17:21:46 +02:00
Jonathan Turner
daadb4c9ef Bump version 2019-07-23 19:55:58 +12:00
DYM
eda257a810
libs.rs >> awesome-rust
libs.rs is DEPRECATED in favour of https://github.com/rust-unofficial/awesome-rust
2018-03-01 18:51:01 +01:00
nabijaczleweli
14f31f4232
Syntax highligh TOML as TOML in README 2017-12-21 14:24:54 +01:00
Lukáš Hozda
f8606aec4c bump version once again, since operators were renamed 2017-12-21 12:33:12 +01:00
Lukáš Hozda
13f7f43f98 bump version, since @torkleyy provided some major improvements, also a breaking change (FnRegister -> RegisterFn); fix typo in readme 2017-12-21 11:24:30 +01:00
Lukáš Hozda
df6ac00a67 update README 2017-11-04 11:18:56 +01:00
Lukáš Hozda
8e4ded77b0 I believe latest additions warrant a version increment 2017-11-02 08:34:32 +01:00
Lukáš Hozda
9448c19581 fix version in README, continue documenting 2017-10-30 13:08:40 +01:00
Lukáš Hozda
1b22cab7dd add loops and comments and a list of example scripts and how to run them to README 2017-10-28 21:59:14 +02:00
Lukáš Hozda
5bfee9688e add REPL example to README 2017-10-15 17:52:02 +02:00
Lukáš Hozda
13a3ba6f77 add a section about examples to README, add imports to tests.rs 2017-10-15 17:48:53 +02:00
Lukáš Hozda
d2ae2c6057 bump version in README, add TODO 2017-10-13 21:52:07 +02:00