Commit Graph

284 Commits

Author SHA1 Message Date
Stephen Chung
db7b9cb0f9 Native only if function call is not a valid identifier. 2020-12-18 23:03:56 +08:00
Stephen Chung
aff207d4f4 Bump version. 2020-12-07 22:21:02 +08:00
Stephen Chung
c5babac3da Quote map property names. 2020-11-30 22:02:32 +08:00
Stephen Chung
4c4a209609 Fix tests. 2020-11-30 21:16:59 +08:00
Stephen Chung
1004bca5b5 Print arrays and maps with to_debug. 2020-11-30 11:20:51 +08:00
Stephen Chung
36546c7325 Fix builds 2020-11-27 23:37:59 +08:00
Stephen Chung
a0979d0c35 Code cleanup 2020-11-25 09:36:06 +08:00
Stephen Chung
36aa827e15 Simply interned strings dict. 2020-11-23 21:12:57 +08:00
Stephen Chung
9abd397276 Fix no_function build. 2020-11-23 20:26:28 +08:00
Stephen Chung
b43223a94f Add get_fn_metadata_list. 2020-11-23 19:11:32 +08:00
Stephen Chung
8d410dfc71 Add return type to function metadata. 2020-11-22 22:15:17 +08:00
Stephen Chung
6222f14fcb Fix no-std build. 2020-11-22 17:49:00 +08:00
Stephen Chung
07fe132e1a Add gen_fn_siguatures API. 2020-11-22 17:21:34 +08:00
Stephen Chung
739dce72e3 Move if_def_fn into CorePackage. 2020-11-22 15:41:55 +08:00
Stephen Chung
e5c9ca23b5 Build index when creating a module. 2020-11-21 22:18:32 +08:00
Stephen Chung
0046fe7e73 Prefer Engine::disable_symbol to disable eval. 2020-11-21 15:08:18 +08:00
Stephen Chung
783803ec46 Update comments with links. 2020-11-20 16:52:28 +08:00
Stephen Chung
d35a7eeaa8 Optimize PackagesCollection. 2020-11-19 10:24:43 +08:00
Stephen Chung
272c8505b8 Refactor use. 2020-11-16 23:10:14 +08:00
Stephen Chung
d50d48f26f Move definition of Array and Map to lib.rs. 2020-11-16 21:14:32 +08:00
Stephen Chung
adb902326e Reduce feature gates on imports. 2020-11-16 16:28:04 +08:00
Stephen Chung
ef02150afd Expose methods for Engine::register_module. 2020-11-16 14:07:48 +08:00
Stephen Chung
b75964e383 Add Dynamic::UNIT. 2020-11-15 23:14:29 +08:00
Stephen Chung
c919ee4e46 Fine tune hash map sizes. 2020-11-15 13:49:54 +08:00
Stephen Chung
bde8917ed4 Set capacity of hash maps. 2020-11-15 12:07:35 +08:00
Stephen Chung
7b27dcdd62 Fix error messages. 2020-11-11 13:25:45 +08:00
Stephen Chung
48886eacc8 Add == and != to arrays and maps. 2020-11-08 23:00:37 +08:00
Stephen Chung
f75942715d Remove clippy warnings. 2020-11-04 12:34:34 +08:00
Stephen Chung
d7d6f74dfd Add constant NO_POS. 2020-11-02 12:50:27 +08:00
Stephen Chung
6f3ce96d9d Enable termination token. 2020-11-02 11:04:45 +08:00
Stephen Chung
a2e2b5e2ef Add f32_float feature. 2020-11-01 15:48:48 +08:00
Stephen Chung
3e23cf943e Add to_float from f32 to f64. 2020-10-30 14:19:19 +08:00
Stephen Chung
4e115d2bc2 Code structure refactor. 2020-10-29 11:37:51 +08:00
Stephen Chung
cbd7ed2ca7 Fix test. 2020-10-28 22:30:35 +08:00
Stephen Chung
f5ffbfbe06 Code structure cleanup. 2020-10-28 22:18:44 +08:00
Stephen Chung
01663a6581 Refine docs. 2020-10-27 11:30:38 +08:00
Stephen Chung
b467b18722 Fix no_std build. 2020-10-25 22:08:02 +08:00
Stephen Chung
13f1ae577b Use plugins to define functions. 2020-10-19 23:49:01 +08:00
Stephen Chung
d68c951795 Pad string to exact length even when padding string is not multiple. 2020-10-18 22:47:58 +08:00
Stephen Chung
25f820f5bf Reimplement pad for string. 2020-10-18 22:36:58 +08:00
Stephen Chung
6e5c903241 Fix no_module build. 2020-10-18 22:10:08 +08:00
Stephen Chung
46b92c9d1f Allow NativeCallContext in function arguments. 2020-10-18 21:47:34 +08:00
Stephen Chung
82e6dd446a Encapsulate register_fn_raw parameters into NativeCallContext. 2020-10-18 17:02:17 +08:00
Stephen Chung
58c820785b Add drain and retain for arrays. 2020-10-18 13:18:12 +08:00
Stephen Chung
8eb6c821d4 Fix tests. 2020-10-17 14:08:59 +08:00
Stephen Chung
39474d6420 Streamline function pointers and currying. 2020-10-17 13:49:16 +08:00
Stephen Chung
e62df6cbed Remove none for array. 2020-10-16 21:02:16 +08:00
Stephen Chung
3b99b8f166 Simplify iterator registration. 2020-10-15 22:11:18 +08:00
Stephen Chung
707ece7e80 Refactor iterators API. 2020-10-14 23:22:10 +08:00
Stephen Chung
e0c39edff4 Enhance array functions. 2020-10-14 21:27:31 +08:00
Stephen Chung
6db412815b Add chop and extract for arrays. 2020-10-13 14:39:49 +08:00
Stephen Chung
1c86c66f1a Add more functions to arrays. 2020-10-13 10:57:29 +08:00
Stephen Chung
a0d5249c4d Fix unchecked build. 2020-10-12 23:17:16 +08:00
Stephen Chung
747fda1ec7 Add filter, map, reduce to Array. 2020-10-12 22:49:51 +08:00
Stephen Chung
994e5a4251 Move some concat functions to builtin. 2020-10-10 22:13:55 +08:00
Stephen Chung
612ecc4ebc Move StaticVec definition to lib.rs. 2020-10-10 13:41:55 +08:00
Stephen Chung
95c4ac4180 Fix no_float bug in time. 2020-10-09 13:47:35 +08:00
Stephen Chung
a4b674d015 Trap elapsed error when timestamp is later than now. 2020-10-09 12:51:26 +08:00
Stephen Chung
1272eeb81a Add/remove #[inline] attributes. 2020-10-08 22:25:50 +08:00
Stephen Chung
e1ce67adc2 Add TimeStamp variant. 2020-09-27 22:15:35 +08:00
Stephen Chung
726b030616 Implement +/- operators for timestamp. 2020-09-26 19:45:33 +08:00
Stephen Chung
4efe6b90e7 Add string::split(). 2020-09-25 23:02:49 +08:00
Stephen Chung
9fcbda1ba4 Add reverse function to arrays. 2020-09-24 10:51:21 +08:00
Stephen Chung
39433164f2 Fix no_float build. 2020-09-23 12:06:17 +08:00
Stephen Chung
4e0f887025 Merge branch 'master' into plugins 2020-09-23 12:00:15 +08:00
Stephen Chung
ed38b50490 Add parse_int and parse_float. 2020-09-23 12:00:03 +08:00
Stephen Chung
5718f454c4
Merge pull request #60 from jhwgh1968/plugins
Remove redundant clones in codegen
2020-09-23 11:54:57 +08:00
J Henry Waugh
d65042088e Remove redundant clones in codegen 2020-09-22 21:38:59 -05:00
Stephen Chung
035b9cb839 Avoid &mut ImmutableString. 2020-09-22 22:45:11 +08:00
Stephen Chung
5a37497a22 Flatten type groups and types in parentheses. 2020-09-22 21:29:44 +08:00
Stephen Chung
3224c5baf5 Avoid &mut ImmutableString. 2020-09-22 19:42:44 +08:00
Stephen Chung
41a16c9cf7 Use modules. 2020-09-22 19:17:50 +08:00
Stephen Chung
594dcc3a06 Disallow registering indexers for arrays, maps and strings. 2020-09-22 17:57:56 +08:00
Stephen Chung
83f9df2852 Fix op-assignment overrides. 2020-09-21 16:15:52 +08:00
J Henry Waugh
c8dffff515 Fix clippy::perf lint errors 2020-09-20 13:07:46 -05:00
J Henry Waugh
788a22108b Hide clippy errors from exported modules 2020-09-20 13:03:35 -05:00
Stephen Chung
848bdf3f01 Add combine_with_exported_module. 2020-09-16 21:50:44 -05:00
Stephen Chung
d41fde9c31 Use multiple renames to simplify plugins. 2020-09-08 18:01:34 +08:00
Stephen Chung
91b4f8a6bc Fix no-std build. 2020-08-31 12:09:52 +08:00
Stephen Chung
ee3781e86e Simplify error handling code. 2020-08-31 11:46:32 +08:00
Stephen Chung
32985c9480 Fix string package for no_std. 2020-08-30 23:18:47 +08:00
Stephen Chung
75ca495199 Nicer formatting/less indentation of module plugin blocks. 2020-08-30 17:28:53 +08:00
Stephen Chung
9ab3d87cfc Refactor. 2020-08-24 22:37:44 +08:00
Stephen Chung
2fbc1b7910 Add missing pub to functions. 2020-08-24 10:38:15 +08:00
Stephen Chung
03237c9852 Merge branch 'plugins' into plugins_dev 2020-08-24 08:36:15 +08:00
J Henry Waugh
9fe3672514 string_more: add missing pub from crop_string 2020-08-23 17:49:50 -05:00
Stephen Chung
211ce54973 Move most packages to modules. 2020-08-22 22:26:49 +08:00
Stephen Chung
5d6fdba24d Merge branch 'plugins' into plugins_dev 2020-08-22 16:20:53 +08:00
J Henry Waugh
15a8f528ae Avoid export_fn+cfg attributes in Rhai packages 2020-08-21 23:26:24 -05:00
Stephen Chung
08977e2a62 Use combine_flatten for plugin modules. 2020-08-21 21:48:45 +08:00
Stephen Chung
729ab99ec3 Refine packages. 2020-08-20 22:11:41 +08:00
Stephen Chung
980aba77a9 Use &mut. 2020-08-19 12:53:33 +08:00
Stephen Chung
09b75ed1a3 Fix bug in strings package. 2020-08-17 10:00:50 +08:00
Stephen Chung
810514dd31 Add get/set/index_get/index_set parameters to rhai_fn. 2020-08-17 00:13:52 +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
db9d8b81cf Move BasicStringsPackage to plugins. 2020-08-15 12:57:47 +08:00
J Henry Waugh
e4045256fe Fix type resolution issue with no_float enabled 2020-08-14 19:39:28 -05:00
J Henry Waugh
89de2fe6b2 Feature gate make_getter imports 2020-08-14 19:37:34 -05:00
J Henry Waugh
eabf9db263 Add missing num_traits import 2020-08-14 19:37:25 -05:00
J Henry Waugh
1051a3f108 Add missing import of String and ToString 2020-08-14 19:37:25 -05:00
J Henry Waugh
e6a1b88b4c Fully feature gate array string functions 2020-08-14 19:37:25 -05:00
J Henry Waugh
4de02c2bd7 Remove extra import 2020-08-14 16:30:00 -05:00
Stephen Chung
209d1a174c Yet more packages into plugins. 2020-08-15 00:04:10 +08:00
Stephen Chung
ceb1a26733 Move more packages to plugins. 2020-08-14 18:58:34 +08:00
Stephen Chung
c0dc47c9db Convert some packages into plugins. 2020-08-14 13:43:26 +08:00
Stephen Chung
b956639c2a Move some math functions into plugins. 2020-08-13 14:57:46 +08:00
Stephen Chung
2f395492de Simply error code. 2020-08-06 10:17:32 +08:00
Stephen Chung
e1a70fe958 Add FnPtr to standard packages. 2020-08-03 23:11:08 +08:00
Stephen Chung
60891e694f Streamline code and feature gates. 2020-07-31 22:30:23 +08:00
Ilya Lakhin
89f75bbf0c Merge remote-tracking branch 'schungx/closures' into closures 2020-07-31 13:05:16 +07:00
Ilya Lakhin
e5fe222de3 Shared variant of Dynamic type; All read/write access operations in Dynamic backed by Read/Write lock guards; new shared() script function 2020-07-31 10:47:14 +07:00
Stephen Chung
e505a06839 Add comparison operators to ImmutableString. 2020-07-30 13:28:25 +08:00
Stephen Chung
411539f3be Minimize usage of downcast_ref. 2020-07-28 19:11:46 +08:00
Stephen Chung
057f6435a4 Add public_only parameter to module function methods. 2020-07-27 18:10:45 +08:00
Stephen Chung
2dd4d9bcf9 Avoid warnings with only_i32. 2020-07-26 22:37:33 +08:00
Stephen Chung
6b600704a3 Avoid warnings. 2020-07-26 15:53:22 +08:00
Stephen Chung
353df6bea1 Avoid warnings in standard build. 2020-07-26 10:03:59 +08:00
Stephen Chung
e8b6d0143d Small fixups. 2020-07-20 23:23:12 +08:00
Stephen Chung
a5fa8322e9 Avoid pulling in std for no-std. 2020-07-20 20:23:35 +08:00
Stephen Chung
adc96e24bd Fix all features. 2020-07-13 19:38:50 +08:00
Stephen Chung
ff6d205c1d Make Modules::set_raw_fn public. 2020-07-07 22:59:23 +08:00
Stephen Chung
ea86888638 Add new &Module parameter to native functions. 2020-07-06 12:04:02 +08:00
Stephen Chung
368b4a480b Reformat code. 2020-07-04 22:53:00 +08:00
Stephen Chung
760c13d36e Fix features. 2020-07-01 22:21:43 +08:00
Stephen Chung
52ef223f83 Fix pad functions. 2020-06-30 18:34:32 +08:00
Stephen Chung
d6a08be223 Refactor. 2020-06-29 23:55:28 +08:00
Stephen Chung
549ef6bf7f Add oop.rhai script. 2020-06-27 17:34:39 +08:00
Stephen Chung
175c3ccaec OOP support. 2020-06-26 10:39:18 +08:00
Stephen Chung
580a62daaf Add sign function. 2020-06-25 19:19:16 +08:00
Stephen Chung
fe640e0e13 Implement function pointers. 2020-06-25 18:07:57 +08:00
Stephen Chung
58c198776f Code cleanup. 2020-06-25 11:07:46 +08:00
Stephen Chung
7cc1a3f5dc Change Map keys to ImmutableString to facilitate fast keys(). 2020-06-21 16:37:05 +08:00
Stephen Chung
2a73841549 Add support for Instant for wasm32. 2020-06-17 16:50:57 +08:00
Stephen Chung
ae6d5e13a9 Gate i128/u128 for wasm32 target. 2020-06-17 16:50:46 +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
29044cc305 Merge branch 'plugins' 2020-06-16 09:36:47 +08:00
Stephen Chung
ff37e02443 Add iterator support for strings. 2020-06-16 09:34:30 +08:00
Stephen Chung
fcb5059570 Do not check for data oversize when unchecked. 2020-06-15 22:04:14 +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
4c46c7e26b Register property versions of some methods. 2020-05-30 10:30:21 +08:00
Stephen Chung
acd4685145 Convert function calls to method calls to use &mut first argument. 2020-05-28 23:57:09 +08:00
Stephen Chung
0b259d0062 Move += for ImmutableString to Engine. 2020-05-28 10:33:28 +08:00
Stephen Chung
b34d5fe3a1 Complete ImmutableString. 2020-05-26 14:14:03 +08:00
Stephen Chung
95e67c48bd Optimize op-assignment statement. 2020-05-25 20:14:31 +08:00
Stephen Chung
fca140ef55 Refine immutable strings. 2020-05-25 17:01:39 +08:00
Stephen Chung
99ea2b33c9 Use immutable strings. 2020-05-25 13:44:28 +08:00
Stephen Chung
b49e1e199a Build-in certain common operators. 2020-05-23 18:59:28 +08:00
Stephen Chung
a743c47345 Refactor. 2020-05-22 21:50:24 +08:00