Commit Graph

444 Commits

Author SHA1 Message Date
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