Commit Graph

624 Commits

Author SHA1 Message Date
Stephen Chung
54d68c1061 Fix bug. 2020-10-26 21:49:49 +08:00
Stephen Chung
b607a3a9ba Add raw API for custom syntax. 2020-10-25 21:57:18 +08:00
Stephen Chung
2c7c719cd5 Minor cleanup before release. 2020-10-22 12:26:44 +08:00
Stephen Chung
ce03a4fda5 Fix throw test. 2020-10-20 23:30:01 +08:00
Stephen Chung
07bdb824fe Add try-catch. 2020-10-20 23:16:03 +08:00
Stephen Chung
5ee9dfc5cd 1) Change namespaces to iter_namespaces
2) throw can throw any value
2020-10-20 18:09:26 +08:00
Stephen Chung
92ba7b42d5 Implement namespaces chain. 2020-10-20 10:54:32 +08:00
Stephen Chung
a9fd0ff4de Encapsulate scope into EvalContext;
Fix bug with custom syntax delta.
2020-10-19 19:11:55 +08:00
Stephen Chung
c8c4ca21ad Update docs. 2020-10-19 14:26:15 +08:00
Stephen Chung
8a17856f27 Fix test. 2020-10-18 22:38:15 +08:00
Stephen Chung
ea814779bf Fix test. 2020-10-18 22:24:01 +08:00
Stephen Chung
82e6dd446a Encapsulate register_fn_raw parameters into NativeCallContext. 2020-10-18 17:02:17 +08:00
Stephen Chung
d88adfd73d Fix test. 2020-10-16 21:26:38 +08:00
Stephen Chung
f995d09d8b Fix bug with calling scripted function. 2020-10-16 21:16:06 +08:00
Stephen Chung
fb05e811b7 Map::keys and Map::values can be used method-call style. 2020-10-15 22:11:40 +08:00
Stephen Chung
1c86c66f1a Add more functions to arrays. 2020-10-13 10:57:29 +08:00
Stephen Chung
747fda1ec7 Add filter, map, reduce to Array. 2020-10-12 22:49:51 +08:00
Stephen Chung
fd5a932611 Implement variable resolver. 2020-10-11 21:58:11 +08:00
Stephen Chung
c463e42987 Fix serde test. 2020-10-10 14:15:23 +08:00
Stephen Chung
d511aac7a4 Reduce max call stack size for debug. 2020-10-08 23:00:01 +08:00
Stephen Chung
e34a370f33 Test optimizer with overriding operator. 2020-10-08 10:34:32 +08:00
Stephen Chung
d35c216465 Add README's. 2020-10-07 22:56:21 +08:00
Stephen Chung
8809d25d3c Add Dynamic::from(&str) 2020-10-06 21:25:05 +08:00
Stephen Chung
82d48df734 Merge data type mismatch errors. 2020-10-05 13:45:57 +08:00
Stephen Chung
9664ae42a7 Add is_def_XXX tests. 2020-10-03 21:59:19 +08:00
Stephen Chung
eec3f4e1bf Module:;eval_ast_as_new defaults to merging namespaces. 2020-10-03 11:42:54 +08:00
Stephen Chung
2fd30321a8 Fix test. 2020-10-02 15:31:59 +08:00
Stephen Chung
d2c94ba07c Add more module tests. 2020-10-02 14:55:02 +08:00
Stephen Chung
e526b53b42 No need to merge module if empty. 2020-09-30 09:57:21 +08:00
Stephen Chung
64c421b3d7 Revise docs. 2020-09-28 22:14:19 +08:00
Stephen Chung
726b030616 Implement +/- operators for timestamp. 2020-09-26 19:45:33 +08:00
Stephen Chung
371b7fd00b Fix tests. 2020-09-26 00:46:47 +08:00
Stephen Chung
4efe6b90e7 Add string::split(). 2020-09-25 23:02:49 +08:00
Stephen Chung
f406fc0ac0 Fix function calls. 2020-09-25 19:07:24 +08:00
Stephen Chung
d91d983c74 Enable dots on numbers to parse as method calls. 2020-09-23 22:48:28 +08:00
Stephen Chung
ed38b50490 Add parse_int and parse_float. 2020-09-23 12:00:03 +08:00
Stephen Chung
83f9df2852 Fix op-assignment overrides. 2020-09-21 16:15:52 +08:00
Stephen Chung
1ae6af5289 Merge branch 'plugins_dev' of https://github.com/schungx/rhai into plugins 2020-09-20 14:32:44 +08:00
Stephen Chung
2ba875a177 Use take_string for &str and String parameters. 2020-09-20 14:23:14 +08:00
Stephen Chung
bf245a798b Enable String parameters. 2020-09-20 10:51:37 +08:00
Stephen Chung
39546b7053 Enable &str and String parameters in module functions. 2020-09-19 18:12:23 +08:00
Stephen Chung
d1d3aaf374 Add cast to type for constants to avoid mis-typing. 2020-09-16 21:53:22 -05:00
Stephen Chung
7ceb624ec1 Add combine_with_exported_module. 2020-09-16 21:53:22 -05:00
Stephen Chung
6126f0cb10 Add cast to type for constants to avoid mis-typing. 2020-09-16 21:53:22 -05:00
Stephen Chung
f1d85ae99c Add combine_with_exported_module. 2020-09-16 21:53:22 -05:00
Stephen Chung
6dc5a81d53 Add cast to type for constants to avoid mis-typing. 2020-09-16 21:50:49 -05:00
Stephen Chung
848bdf3f01 Add combine_with_exported_module. 2020-09-16 21:50:44 -05:00
Ilya Lakhin
4bb1a34abb Fixes bug in Module::set_fn_4_mut 2020-09-15 10:14:34 +07:00
Stephen Chung
b311688fee Fix test. 2020-09-11 22:56:19 +08:00
Stephen Chung
6c69a40083 Allow scripted functions in packages. 2020-09-11 22:32:59 +08:00
Stephen Chung
dbfd3df810 Support multiple names in rhai_fn. 2020-09-07 17:08:37 -05:00
Stephen Chung
99b8228630 Use smallvec/union for nightly builds. 2020-09-05 17:55:35 +08:00
Stephen Chung
ae953315fe Refine plugins doc. 2020-09-04 15:42:31 +08:00
Stephen Chung
3902e49a7d Fix bug in right-shifts. 2020-08-23 18:04:19 +08:00
Stephen Chung
a72f797da1 Merge branch 'plugins' into plugins_dev 2020-08-23 17:54:37 +08:00
Stephen Chung
57acd618de Merge branch 'master' into plugins 2020-08-23 17:24:27 +08:00
Stephen Chung
e2f271644a Expand packages and raw Engine write-up. 2020-08-23 17:22:39 +08:00
Stephen Chung
f4c74cc03b Add external closure test. 2020-08-23 16:29:15 +08:00
Stephen Chung
c62914b91a Merge branch 'master' into plugins_dev 2020-08-22 23:04:34 +08:00
Stephen Chung
86c7862ac4 Merge branch 'master' into plugins 2020-08-22 23:03:32 +08:00
Stephen Chung
177a0de23c Fix closure test. 2020-08-22 23:01:25 +08:00
Stephen Chung
3042e3d9db Merge branch 'master' into plugins_dev 2020-08-22 22:51:41 +08:00
Stephen Chung
0ece75aba3 Allow module access in closures. 2020-08-22 22:44:24 +08:00
Stephen Chung
0b04d05afe Do not parse closures when allow_anonymous_fn is false. 2020-08-22 11:08:27 +08:00
Stephen Chung
5b3467631f No need for rhai_mod if not renaming. 2020-08-22 10:44:51 +08:00
Stephen Chung
08977e2a62 Use combine_flatten for plugin modules. 2020-08-21 21:48:45 +08:00
Stephen Chung
3c0d431fd2 Merge branch 'plugins' into plugins_dev 2020-08-20 22:14:56 +08:00
Stephen Chung
729ab99ec3 Refine packages. 2020-08-20 22:11:41 +08:00
Stephen Chung
7c1d4efeb7 Merge branch 'master' into plugins_dev 2020-08-20 16:54:00 +08:00
Stephen Chung
ac6d519d28 Fix bug that consumes first argument in module-qualified call. 2020-08-20 16:26:10 +08:00
Stephen Chung
eedebf11d2 Fix plugins test. 2020-08-19 13:39:20 +08:00
Stephen Chung
c5360db185 Handle #{ in Engine::parse_json, restrict to object hashes only. 2020-08-18 23:07:17 +08:00
Stephen Chung
772e44aa3d Test getter. 2020-08-18 09:25:43 +08:00
Stephen Chung
e75d91e9bf Bring more functions into modules in plugins via rhai_fn(name) attribute. 2020-08-16 23:41:59 +08:00
Stephen Chung
209d1a174c Yet more packages into plugins. 2020-08-15 00:04:10 +08:00
Stephen Chung
c0dc47c9db Convert some packages into plugins. 2020-08-14 13:43:26 +08:00
Stephen Chung
d2ea981fac Merge branch 'master' into plugins 2020-08-14 11:45:52 +08:00
Stephen Chung
b956639c2a Move some math functions into plugins. 2020-08-13 14:57:46 +08:00
J Henry Waugh
0fb61eab00 Fix plugin test 2020-08-12 23:47:57 -05:00
J Henry Waugh
a25f6b35a1 Add new macro_register test which runs in no_std 2020-08-12 23:46:12 -05:00
J Henry Waugh
1a2ef7b531 Fix macro_unroll test 2020-08-12 23:40:50 -05:00
J Henry Waugh
ce8fbe40c4 Fold into fully generic form 2020-08-09 12:13:02 -05:00
J Henry Waugh
3fa252e732 Fold generate_add once more 2020-08-09 12:04:50 -05:00
J Henry Waugh
a45b1d406f Add only_i32 feature support 2020-08-09 11:47:11 -05:00
J Henry Waugh
dc7b36fd11 Fix for stable 2020-08-09 11:42:37 -05:00
J Henry Waugh
a24d11324c Create functional test for generated bulk operations 2020-08-09 11:21:29 -05:00
Stephen Chung
564d3bc339 Add more closure tests. 2020-08-09 22:12:50 +08:00
Ilya Lakhin
d84ef1a0d1 CLosures test fix 2020-08-09 18:55:01 +07:00
Ilya Lakhin
20cff87e14 False-positive capturing prevention bug fix 2020-08-09 18:35:29 +07:00
Stephen Chung
0e344ff3eb Merge branch 'master' into plugins 2020-08-08 23:01:48 +08:00
Stephen Chung
da3cce58d3 Minor refactor. 2020-08-08 22:59:05 +08:00
Stephen Chung
e66873bb83
Merge pull request #27 from Eliah-Lakhin/capturing-bug
Function names capturing as external variables bug
2020-08-08 22:52:20 +08:00
Ilya Lakhin
9c6584240f Unit test for registered functions in anon function context 2020-08-08 19:09:18 +07:00
Stephen Chung
fbad20eb0d Merge branch 'master' into plugins 2020-08-08 16:26:52 +08:00
Stephen Chung
f016655414 Simply test error matching. 2020-08-08 16:03:14 +08:00
J Henry Waugh
75bcbb74eb Fix unrelated CI failure for features 2020-08-06 19:41:19 -05:00
Stephen Chung
26c5b10ef7 Merge branch 'master' into plugins 2020-08-06 10:31:15 +08:00
Stephen Chung
41b41ff834 Fix tests. 2020-08-06 00:24:25 +08:00
Stephen Chung
ae11dbbefe Fix feature flags. 2020-08-05 22:53:01 +08:00
Stephen Chung
07af296ab0 Fix custom syntax test. 2020-08-05 17:02:11 +08:00
Stephen Chung
24346b9728 Merge branch 'master' into plugins 2020-08-04 16:51:22 +08:00
Stephen Chung
3fc35c4f87 Merge from master. 2020-08-03 13:28:29 +08:00
Stephen Chung
4079164bfd Implement closures. 2020-08-03 12:10:20 +08:00
Stephen Chung
dd0177f588 Allow deprecated API. 2020-08-03 10:07:52 +08:00
J Henry Waugh
7219fd6b79 Fix tests/plugins.rs to match new hygiene 2020-08-02 19:49:24 -05:00
Stephen Chung
096eb4493e Engine::load_package API change. 2020-08-02 18:55:22 +08:00
Stephen Chung
5eed5fe6a3 Add plugins test. 2020-08-02 18:53:25 +08:00
Stephen Chung
675c4eb606 Add plugins test. 2020-08-02 15:39:16 +08:00
Stephen Chung
b86c87253b Prevent data races. 2020-08-02 13:33:51 +08:00
Stephen Chung
cc53b21731 Avoid hard-coding variable type for shared. 2020-08-01 22:28:13 +08:00
Stephen Chung
8d0623d07f Add is_shared function. 2020-07-31 18:43:34 +08:00
Stephen Chung
e70e0ff4e2 Fixup. 2020-07-31 16:39:38 +08:00
Ilya Lakhin
89f75bbf0c Merge remote-tracking branch 'schungx/closures' into closures 2020-07-31 13:05:16 +07:00
Ilya Lakhin
4f771d904a Code cleanup 2020-07-31 12:09:32 +07:00
Ilya Lakhin
ca64668e58 take() keyword; shared test with registered functions with callbacks 2020-07-31 11:41:22 +07:00
Ilya Lakhin
060dd33046 Shared Dynamic tests and fixes in Engine; Also fixed a bug in Parser variable capturing 2020-07-31 10:47:22 +07:00
Ilya Lakhin
aa87a7f5ef Fixes in Engine to properly interpret Shared Dynamic 2020-07-31 10:47:22 +07:00
Stephen Chung
7d4620d0d9 Unbounded -> unbound. 2020-07-30 23:29:11 +08:00
Stephen Chung
98b294c699 Implement capturing. 2020-07-30 18:18:28 +08:00
Stephen Chung
8299adf95c Add docs for auto-currying. 2020-07-29 22:43:57 +08:00
Ilya Lakhin
8fc16b40e6 Code style issues fixed 2020-07-29 20:17:18 +07:00
Ilya Lakhin
48356abc83 Autocurry fixes and test 2020-07-29 18:52:54 +07:00
Ilya Lakhin
8e51988b66 A prototype of a new feature to automatically curry of external scope variables 2020-07-29 16:56:32 +07:00
Stephen Chung
e2daba55d7 Refine unicode-xid-ident feature writeup. 2020-07-29 13:57:17 +08:00
Stephen Chung
eeb86f5efb Merge branch 'master' of https://github.com/jonathandturner/rhai 2020-07-29 11:43:48 +08:00
ekicyou
7d333fdc4e add test 2020-07-29 10:41:44 +09:00
ekicyou
288e0a4d14 add unicode_xid, test 2020-07-29 08:25:37 +09:00
Stephen Chung
057f6435a4 Add public_only parameter to module function methods. 2020-07-27 18:10:45 +08:00
Stephen Chung
a3a167424b Allow Rust functions in FnPtr::call_dynamic. 2020-07-27 12:52:32 +08:00
Stephen Chung
878ba0b794 Remove register_raw_fn_XXX API's. 2020-07-26 18:17:55 +08:00
Stephen Chung
6b600704a3 Avoid warnings. 2020-07-26 15:53:22 +08:00
Stephen Chung
94c2f64473 Merge branch 'master' of https://github.com/jonathandturner/rhai 2020-07-25 16:05:11 +08:00
John-John Tedro
1aab77df1c Avoid scanning over slices to validate numerical literals 2020-07-25 09:52:54 +02:00
Stephen Chung
2b0aacde23 Fix Module::set_indexer_set_fn. 2020-07-24 23:16:54 +08:00
Stephen Chung
1a48a2d8ba Refine currying docs. 2020-07-23 15:49:09 +08:00
Ilya Lakhin
82685b7df2 FnPtr::call_dynamic shortcut function that enriches call arguments with curry-ed data automatically 2020-07-23 04:53:40 +07:00
Stephen Chung
6d551f1596 Add currying support. 2020-07-22 23:12:09 +08:00
Stephen Chung
abf66850f6 Enable custom syntax without internals. 2020-07-22 17:05:13 +08:00
Stephen Chung
35374f5b3b Simplify custom syntax. 2020-07-22 13:08:51 +08:00
Stephen Chung
e8b6d0143d Small fixups. 2020-07-20 23:23:12 +08:00
Stephen Chung
3ae7cf4018 Improve treatment of disabled symbols and custom symbols. 2020-07-17 14:50:23 +08:00
Stephen Chung
d119e13b79 Allow binding of this pointer in FnPtr calls. 2020-07-17 10:18:07 +08:00
Stephen Chung
16fbfbb606 Enable call in function-call style. 2020-07-16 12:09:31 +08:00
Stephen Chung
adc96e24bd Fix all features. 2020-07-13 19:38:50 +08:00
Stephen Chung
e8d78bdfde Add support for String in function parameters. 2020-07-13 13:40:51 +08:00
Stephen Chung
8449f8c55e Make API chainable. 2020-07-12 11:46:53 +08:00
Stephen Chung
2a8d63fd5f Refine custom syntax. 2020-07-11 15:09:17 +08:00
Stephen Chung
ebffbf0f98 Refine docs and add custom syntax. 2020-07-10 22:01:47 +08:00
Stephen Chung
99164ebceb Add custom syntax. 2020-07-09 19:54:28 +08:00
Stephen Chung
703cc414b8 Allow mutating a module-qualified function's first argument if it is a variable. 2020-07-08 13:06:00 +08:00
Stephen Chung
ff6d205c1d Make Modules::set_raw_fn public. 2020-07-07 22:59:23 +08:00
Stephen Chung
a2c0554f3c Make consistent style. 2020-07-06 21:52:07 +08:00
Stephen Chung
f5ff759fcc Merge branch 'master' of https://github.com/schungx/rhai 2020-07-06 21:31:03 +08:00
Alvin Wong
4a3a32dc3a Fix serializing externally-tagged enum representations 2020-07-06 21:11:41 +08:00
Alvin Wong
4b6afc9c72 Add enum serialization tests 2020-07-06 18:32:22 +08:00
Alvin Wong
0644c67252 Impl. deserializing enum representations 2020-07-06 18:32:22 +08:00
Stephen Chung
46cdec1280 Refine docs and tests. 2020-07-06 16:20:03 +08:00
Alvin Wong
8f53ce50d4 Ensure rhai::INT can be deserialized into any integer types 2020-07-06 15:30:56 +08:00
Stephen Chung
3e45d5d9a5 Refine docs and API. 2020-07-06 13:01:57 +08:00
Stephen Chung
ea86888638 Add new &Module parameter to native functions. 2020-07-06 12:04:02 +08:00
Stephen Chung
a27f89b524 Add new register_fn_raw API. 2020-07-05 23:08:44 +08:00
Stephen Chung
e390dd73e6 Add custom operators. 2020-07-05 17:41:45 +08:00
Stephen Chung
936a3ff44a Add feature to disable symbols. 2020-07-05 15:23:51 +08:00
Stephen Chung
78c94daf46 Add ser::to_dynamic. 2020-07-03 22:42:56 +08:00
Stephen Chung
fa84e5c502 Add serde deserialization. 2020-07-03 17:19:55 +08:00
Stephen Chung
1b7ffdf408 Better type display. 2020-07-03 10:45:01 +08:00
Stephen Chung
760c13d36e Fix features. 2020-07-01 22:21:43 +08:00
Stephen Chung
e614790897 Enable function pointers even under no_function. 2020-06-30 18:34:58 +08:00
Stephen Chung
d6a08be223 Refactor. 2020-06-29 23:55:28 +08:00
Stephen Chung
aac04a5e53 Remove modules from Scope and use separate stack. 2020-06-27 23:56:24 +08:00
Stephen Chung
f3bde843cb Fix scripts and tests. 2020-06-27 21:19:53 +08:00
Stephen Chung
175c3ccaec OOP support. 2020-06-26 10:39:18 +08:00
Stephen Chung
fe640e0e13 Implement function pointers. 2020-06-25 18:07:57 +08:00
Stephen Chung
b08f85a8b1 Refine side_effects test. 2020-06-22 09:46:36 +08:00
Stephen Chung
d728ac6758 Edit documentation. 2020-06-22 00:03:45 +08:00
Stephen Chung
e095a87ea2 Remove wasm64 target. 2020-06-17 16:49:51 +08:00
Stephen Chung
7f4f737ff2 Gate WASM target. 2020-06-17 09:54:17 +08:00
Stephen Chung
151cd1af48 Support compiling to WASM. 2020-06-16 23:47:31 +08:00
Stephen Chung
1adf3cc39a Support for trailing commas. 2020-06-16 22:14:46 +08:00
Stephen Chung
ff37e02443 Add iterator support for strings. 2020-06-16 09:34:30 +08:00
Stephen Chung
a417bdd8e3 Support registering functions with a reference to the scripting engine. 2020-06-15 21:49:02 +08:00
Stephen Chung
0c6a939c66 Better convert LexError to ParseError. 2020-06-14 16:56:36 +08:00
Stephen Chung
bb691a0313 Add maximum data size limits. 2020-06-14 14:25:47 +08:00
Stephen Chung
954f971ddf New optimizer test. 2020-06-13 21:57:46 +08:00
Stephen Chung
5275778952 Add test to call_fn with String parameter. 2020-06-12 18:46:36 +08:00
Stephen Chung
9d91349513 Refine position display in error messages. 2020-06-12 18:04:16 +08:00
Stephen Chung
a4cabc1ac7 Better String parameter error message. 2020-06-08 14:10:06 +08:00
Stephen Chung
e942ef358c Transparently convert &str to ImmutableString for register_fn. 2020-06-07 17:54:33 +08:00
Stephen Chung
5f40a1376a Implement index setters. 2020-06-06 13:06:00 +08:00
Stephen Chung
b8da1691d3 Consolidate callbacks. 2020-06-02 13:33:16 +08:00
Stephen Chung
b8b12055b9 Disable if-expression when parsing expressions. 2020-06-01 13:26:20 +08:00
Stephen Chung
6d190096fd Fix bug with bracket postfix when no_index. 2020-06-01 13:03:01 +08:00
Stephen Chung
cec6748ac6 Remove no_module gates to prepare for plugins. 2020-06-01 10:58:14 +08:00
Stephen Chung
d7d49a5196 Fix bug in chained dot/index expression. 2020-05-31 14:27:16 +08:00
Stephen Chung
4c46c7e26b Register property versions of some methods. 2020-05-30 10:30:21 +08:00
Stephen Chung
2bcc51cc45 Fix bug in index expressions. 2020-05-30 10:27:48 +08:00
Stephen Chung
e1242df5c8 Extract copy/restore of first argument in method call. 2020-05-29 18:15:58 +08:00
Stephen Chung
9616452c00 Fix bug in calling script function in method style. 2020-05-29 00:53:30 +08:00
Stephen Chung
d7c69c4f51 More tests. 2020-05-28 14:08:21 +08:00
Stephen Chung
99ea2b33c9 Use immutable strings. 2020-05-25 13:44:28 +08:00
Stephen Chung
d56634cac7 Complete built-in operators. 2020-05-24 00:29:06 +08:00
Stephen Chung
e224550861 Move boxing of ParseError into ParseErrorType. 2020-05-22 18:28:13 +08:00
Stephen Chung
6b8c6bda42 Use u64 for operations counter. 2020-05-19 10:08:27 +08:00
Stephen Chung
1824dced69 Limit expression/statement nesting depths. 2020-05-18 19:32:22 +08:00
Stephen Chung
8b5550eeb6 Complete StaticVec implementation. 2020-05-17 22:19:49 +08:00
Stephen Chung
0cb781c1aa Avoid allocation in Target. 2020-05-16 11:42:56 +08:00
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
cabceb7498 Better handling of errors during function calls. 2020-05-13 21:58:38 +08:00
Stephen Chung
d613764c03 Test for private functions. 2020-05-13 13:49:01 +08:00
Stephen Chung
03c64688ad Fix sync feature. 2020-05-12 16:32:22 +08:00
Stephen Chung
2e28967565 Fix bug with wrong method call hash. 2020-05-12 10:20:29 +08:00
Stephen Chung
414f3d3c23 Fix bug with calling a pure function method-call style. 2020-05-11 18:55:58 +08:00
Stephen Chung
80debbc432 Refactor. 2020-05-10 00:19:13 +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
f3c0609377 Catch more assignment errors at parse time. 2020-05-07 12:25:09 +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
88fec57394 Make module_resolver optional and remove NullModuleResolver. 2020-05-06 16:09:44 +08:00
Stephen Chung
82e1af7acd Implement module resolvers. 2020-05-05 23:57:25 +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
aae9e43109 Implement module-qualified functions. 2020-05-05 17:51:40 +08:00
Stephen Chung
38e717a838 Build Module type plus engine hooks. 2020-05-05 15:00:10 +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
798e1df298 Do not error when a property is read-only. 2020-05-04 18:06:09 +08:00
Stephen Chung
60b52c142e Fix README example for on_print and on_debug. 2020-04-29 23:03:18 +08:00
Stephen Chung
304c658f89 Use scope offset for variable access. 2020-04-28 23:05:03 +08:00
Stephen Chung
6351c07bc6 Fix compiling for all features. 2020-04-28 19:39:28 +08:00
Stephen Chung
a306979a9c Fix tests. 2020-04-23 14:00:29 +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
5d9a99cefc Refine postfix operators handling. 2020-04-17 19:00:52 +08:00
Stephen Chung
f8e9d66a0b Remove lifetime from Engine. 2020-04-16 23:31:48 +08:00
Stephen Chung
a35518fe49 Split tokenizer into separate file, plus fix no_std feature. 2020-04-15 22:21:23 +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
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
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
b74c85f04c Fix max call depth and add test. 2020-04-07 23:13:47 +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
c4498d147d Add set_value to Scope. 2020-04-05 19:17:48 +08:00
Stephen Chung
94313ca095 Test variable mutation in outer scope. 2020-04-05 12:57:20 +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
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
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
ee18f047b4 Fix test. 2020-03-30 16:18:33 +08:00
Stephen Chung
0a8b324fec Merge branch 'object_maps' 2020-03-30 16:13:12 +08:00
Stephen Chung
273fc59a30 Refine tests. 2020-03-30 16:10:40 +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
a8a4ed2967 Merge all MissingXXX errors into MissingToken. 2020-03-29 13:44:27 +08:00
Stephen Chung
ef6dd9414a Allow if expressions. 2020-03-27 23:47:23 +08:00
Stephen Chung
796690f506 Detect duplicated parameters in function definitions. 2020-03-27 16:46:08 +08:00
Stephen Chung
b603a85bca Add expression eval test. 2020-03-25 11:50:58 +08:00
Stephen Chung
d21f66b911 Fixing lint warnings 2020-03-24 16:57:35 +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
083b3147be Fix test_eval. 2020-03-21 00:23:13 +08:00
Stephen Chung
ed996e71d6 Enable dot operations on constant variables. 2020-03-20 19:27:02 +08:00
Stephen Chung
36b7124dd5 Add eval test. 2020-03-19 20:55:53 +08:00
Stephen Chung
cc8ec12691 Add more comments and examples. 2020-03-19 13:52:10 +08:00
Stephen Chung
8efe080412 Handle break and return better. 2020-03-18 10:42:27 +08:00
Stephen Chung
f3213b945d Fix power_of test. 2020-03-16 13:08:53 +08:00
Stephen Chung
6d33a91d09 Fix minor floating-point digit error. 2020-03-16 12:40:55 +08:00
Stephen Chung
372321dfe3 Add full optimization level for aggressive optimizing. 2020-03-15 22:39:58 +08:00
Stephen Chung
6e076c409d Use matches! in examples. 2020-03-14 23:40:30 +08:00
Stephen Chung
dd36f3387a Fixup code to make sure all feature builds succeed. 2020-03-14 20:06:40 +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
9844ae8665 Add constants. 2020-03-13 18:12:41 +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
4662b9bd0c Fine tune some tests. 2020-03-12 12:35:30 +08:00
Stephen Chung
7c4d22d98a Add no_function feature to disable script-defined functions. 2020-03-11 13:28:12 +08:00
Stephen Chung
880bce1114 General cleanup. 2020-03-11 11:03:18 +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
f3bcb2a10d Simplify call_fn API, no need to pass &mut references. 2020-03-10 14:09:05 +08:00
Stephen Chung
bae9946291 Allow engine to retain functions across runs. 2020-03-10 09:30:12 +08:00
Stephen Chung
5b5fd162be Use ? operator in tests. 2020-03-09 21:09:53 +08:00
Stephen Chung
01d04f717b Natively handle negative numbers in tokenizer instead of the neg() function. 2020-03-09 10:10:19 +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
024133ae2d Avoid string copying. 2020-03-07 10:15:42 +08:00
Stephen Chung
ea82ee81d6 Fix call_fn to take &ast instead of ast. 2020-03-07 00:29:45 +08:00
Stephen Chung
bb56a7a843 Code refactor, bug fixes, code docs. 2020-03-04 22:00:01 +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
a1591ae45b Better API for Scope. 2020-03-03 15:20:20 +08:00
Stephen Chung
366188234b Pretty-print common type names. 2020-03-02 23:16:19 +08:00
Stephen Chung
0707fad1ca Refactor tests. 2020-03-02 22:11:56 +08:00
Stephen Chung
ed8d2ac20f Add else if control flow. 2020-03-02 17:04:56 +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
e93fd7d3fe Properly handle char types. 2020-03-01 13:30:22 +08:00
Stephen Chung
e4e471fd20 Add line/position in compilation errors; Add compile to AST; FIx infinite loop in close parens. 2020-02-24 23:25:52 +08:00
Stephen Chung
896579869c Fix test_mismatched_op. 2020-02-23 23:41:14 +08:00
Stephen Chung
157aa2be94 Add for statement and range function; New register_box_fn for functions returning Box<dyn Any> (which should not be boxed again); Register standard utility functions in library (e.g. print, string concat). 2020-02-23 22:48:46 +08:00
timfish
4217e96d19 Remove unused enums and simplify test assertions 2019-10-09 12:06:32 +01:00
timfish
53bb0a38f0 Use std::any::type_name 2019-09-30 18:57:21 +01:00
timfish
82fd20b2b1 Rust 2018 2019-09-18 11:21:07 +01:00
steve donovan
2bf3f5e957 better not-found error messages for variables and functions 2018-07-16 13:01:11 +02:00
Juan Ibiapina
e534e907e8 Use default rust directory structure for tests 2018-06-13 10:56:29 +02:00