Commit Graph

2099 Commits

Author SHA1 Message Date
Stephen Chung
fb0b071fe0 Add lifetimes to GlobalRuntimeState and EvalState for future needs. 2022-01-22 17:48:07 +08:00
Stephen Chung
c32ace40a4 Fix builds. 2022-01-22 17:27:18 +08:00
Stephen Chung
f92894e337 Rename GlobalRuntimeStatemodules -> imports. 2022-01-20 08:17:34 +08:00
Stephen Chung
3d4abeed0e New metadata functions. 2022-01-20 08:16:38 +08:00
Stephen Chung
0b3250a262 Add strict command to rhai-repl. 2022-01-19 14:02:55 +08:00
Stephen Chung
f0781c9736 Properly handle \r\n pairs in doc-comments. 2022-01-17 23:15:51 +08:00
Stephen Chung
d58df1fb34 Engine::gen_fn_signatures enumerates non-standard external packages. 2022-01-17 23:15:22 +08:00
Stephen Chung
86fc2f7bf1 Refine types display. 2022-01-17 21:51:04 +08:00
Stephen Chung
58e1094b79 Register test functions in repl. 2022-01-17 21:50:36 +08:00
Stephen Chung
16c03cc864 Add comments to standard library functions. 2022-01-17 21:49:06 +08:00
Stephen Chung
5232bbbff8 Add get/set methods to arrays, blobs, maps and strings. 2022-01-17 10:21:03 +08:00
Stephen Chung
573bfe46dd Fix formatting. 2022-01-17 07:50:29 +08:00
Stephen Chung
57cfd6a354 Fix builds. 2022-01-16 23:15:37 +08:00
Stephen Chung
24b68971a8 Fix offset calc. 2022-01-16 22:54:28 +08:00
Stephen Chung
5935a88958 Revert "Refine examples."
This reverts commit 146129279c.
2022-01-16 22:50:39 +08:00
Stephen Chung
146129279c Refine examples. 2022-01-16 22:45:49 +08:00
Stephen Chung
3667761340 Fix bugs and add comments to standard library. 2022-01-15 23:34:38 +08:00
Stephen Chung
e24848668a Fix build. 2022-01-15 11:35:44 +08:00
Stephen Chung
00b189d0c6 Replace Cow<str> in Scope with SmartString. 2022-01-15 11:26:43 +08:00
Stephen Chung
2a8a8c00f5 Refine calc_index API. 2022-01-15 10:24:08 +08:00
Stephen Chung
a8ec984b0f Fix unsafe violation in for loop. 2022-01-15 10:18:16 +08:00
Stephen Chung
ae77582028 Minor refactor. 2022-01-14 21:49:38 +08:00
Stephen Chung
e2e0b8d083 Fix Array::chop. 2022-01-14 10:04:24 +08:00
Stephen Chung
96764c0d2d Fix UINT -> UNSIGNED_INT. 2022-01-13 22:51:56 +08:00
Stephen Chung
25f54c0ea5 Pretty-display return types. 2022-01-13 22:51:10 +08:00
Stephen Chung
5ab7c59ba0 Fix Array::pad infinite loop. 2022-01-13 22:05:07 +08:00
Stephen Chung
5e32af0ceb Fix unchecked build. 2022-01-13 21:08:36 +08:00
Stephen Chung
510c201d2f Fix build. 2022-01-13 21:01:56 +08:00
Stephen Chung
09aa9fc3db Extract metadata into separate type. 2022-01-13 19:07:56 +08:00
Stephen Chung
a3a527923a Fix metadata param name in JSON. 2022-01-13 18:13:38 +08:00
Stephen Chung
0f4e8848f9 Extract index calculataion into functions. 2022-01-13 18:13:27 +08:00
Stephen Chung
4b4a6c944d Fix test. 2022-01-12 11:01:03 +08:00
Stephen Chung
37dbc68bf5 Use target_family for wasm. 2022-01-12 08:12:28 +08:00
Stephen Chung
77eb96bd7e Fix errors. 2022-01-11 11:40:08 +08:00
Stephen Chung
6dedb1ed9f Fix no_std builds. 2022-01-11 11:33:54 +08:00
Stephen Chung
f205091d0a Inline traits impl. 2022-01-10 22:51:24 +08:00
Stephen Chung
56217e386e Fix debug for Engine. 2022-01-10 22:51:04 +08:00
Stephen Chung
5d90b3274c Catch unsupported custom syntax. 2022-01-10 20:08:03 +08:00
Stephen Chung
ea6c264f5f Fix builds. 2022-01-10 13:43:30 +08:00
Stephen Chung
1e0d46fc13 Fix debug print for GlobalRuntimeStates. 2022-01-09 18:43:12 +08:00
Stephen Chung
e4e2bb3356 Fix builds. 2022-01-09 12:44:24 +08:00
Stephen Chung
d1749131c5 Add missing data size check. 2022-01-08 23:23:43 +08:00
Stephen Chung
f399e8a905 Evaluate function call args more efficiently. 2022-01-08 18:40:19 +08:00
Stephen Chung
afb651d0aa Support converting literal FnPtr. 2022-01-08 14:00:41 +08:00
Stephen Chung
047e65223d Fix builds. 2022-01-07 12:19:01 +08:00
Stephen Chung
a267ac5e54 Split Engine into eval folder. 2022-01-07 11:43:47 +08:00
Stephen Chung
33bfff3722 Fix build. 2022-01-06 23:29:11 +08:00
Stephen Chung
c75d51ae88 Reduce unnecessary data size checking. 2022-01-06 22:10:16 +08:00
Stephen Chung
de6cb36503 Lift function calls out of match block in eval_stmt. 2022-01-06 16:06:31 +08:00
Stephen Chung
80edb1200d Fix Array::pad limits. 2022-01-06 15:30:17 +08:00
Stephen Chung
0a63e1732b Optimize hot path in Engine::eval_expr. 2022-01-06 15:28:53 +08:00
Stephen Chung
2e050f8f88 Reduce data size checking. 2022-01-06 13:40:03 +08:00
Stephen Chung
ed89817d0c Reverse tail call optimization. 2022-01-06 12:31:46 +08:00
Stephen Chung
bc6bf6c6ba Change expect("exists") to unwrap(). 2022-01-06 11:07:52 +08:00
Stephen Chung
b1b4361d08 Fix documentation. 2022-01-06 10:19:25 +08:00
magnus
7bf517b242 Fix documentation 2022-01-06 10:18:02 +08:00
Stephen Chung
123e8b1b48 Improve FnPtr debug display. 2022-01-05 13:48:25 +08:00
Stephen Chung
2b613fdff3 Remove unneeded strings interner for modules. 2022-01-05 13:40:49 +08:00
Stephen Chung
a0531129df Restructure expression dispatch. 2022-01-05 13:14:18 +08:00
Stephen Chung
f35c9c1ac4 Refactor imports. 2022-01-05 12:52:56 +08:00
Stephen Chung
328f6910b6 Refactor wasm feature gates. 2022-01-04 22:16:20 +08:00
Stephen Chung
d99953c101 Fixup AsRef<str> vs &str. 2022-01-04 15:22:48 +08:00
Stephen Chung
1d1e473ac4 Minor refactor. 2022-01-03 23:16:47 +08:00
Stephen Chung
d60f14ec27 Streamline hot code. 2022-01-03 23:11:06 +08:00
Stephen Chung
8961f36e8e Move bit-fields into new package. 2022-01-03 23:10:20 +08:00
Stephen Chung
bccdf70521 Change tuples into fields. 2022-01-02 23:26:38 +08:00
Stephen Chung
29f1328087 Simplify Dynamic::from for better inlining. 2022-01-02 20:47:03 +08:00
Stephen Chung
809feaf58d Add doc comments. 2022-01-02 15:14:55 +08:00
Stephen Chung
d60ed5a502 Reduce size of Variant trait. 2022-01-01 19:54:46 +08:00
Stephen Chung
a6ddb64596 Fix builds. 2022-01-01 17:38:32 +08:00
Stephen Chung
135b1f54c2 Remove Option from source and use empty string as no source. 2022-01-01 17:20:00 +08:00
Stephen Chung
8329baea29 Fix doc comments. 2021-12-31 23:01:34 +08:00
Stephen Chung
f3a8364936 Split blob write into write_utf8 and write_ascii. 2021-12-31 17:49:38 +08:00
Stephen Chung
ce93f56813 Rename parameters. 2021-12-31 17:49:19 +08:00
Stephen Chung
e3aa2c19ce Make for loops for efficient. 2021-12-31 15:59:13 +08:00
Stephen Chung
64bf2eef5c Better error messages. 2021-12-30 12:19:41 +08:00
Stephen Chung
1fd242ed2c Flatten nested block scopes. 2021-12-30 12:14:54 +08:00
Stephen Chung
be4ae6e763 Add rewind_scope to eval_stmt. 2021-12-30 08:57:23 +08:00
Stephen Chung
3488dbe74b Fix merging strings interner. 2021-12-29 14:26:54 +08:00
Stephen Chung
4bd482352e Fix eval call. 2021-12-28 23:00:31 +08:00
Stephen Chung
cbaf095c7a Merge restore_state and rewind_scope. 2021-12-28 17:50:49 +08:00
Stephen Chung
5b667a69b7 Reverse EvalStateData. 2021-12-28 12:19:20 +08:00
Stephen Chung
280010c427 Fix builds. 2021-12-28 12:00:01 +08:00
Stephen Chung
807240e249 Rename Imports to GlobalRuntimeState. 2021-12-28 11:42:52 +08:00
Stephen Chung
9deddc679c Use Box<str>. 2021-12-27 23:15:25 +08:00
Stephen Chung
a78488d935 Rename Imports to GlobalRuntimeState. 2021-12-27 23:03:30 +08:00
Stephen Chung
e8b070cbf8 Fix builds. 2021-12-27 22:28:11 +08:00
Stephen Chung
9c7ced2b80 Move custom syntax to api. 2021-12-27 22:02:34 +08:00
Stephen Chung
4d226542fa Split out strings interner. 2021-12-27 21:56:50 +08:00
Stephen Chung
7a15071e4e Reduce size of ChainArgument. 2021-12-27 17:00:21 +08:00
Stephen Chung
757eacfdde No need for types with Into::into. 2021-12-27 16:59:05 +08:00
Stephen Chung
f443e4d9f6 Fix formatting. 2021-12-27 13:30:44 +08:00
Stephen Chung
dfb3378b28 Expand function call arguments inline storage. 2021-12-27 12:27:44 +08:00
Stephen Chung
05d4c81e7a Use type alias for error. 2021-12-27 12:27:31 +08:00
Stephen Chung
e7ca3f41dd Fix formatting. 2021-12-27 11:43:11 +08:00
Stephen Chung
a07faf7dd9 Fix doc test. 2021-12-26 12:16:48 +08:00
Stephen Chung
01c35808cb Use type alias 2021-12-25 23:49:14 +08:00
Stephen Chung
43363e0660 Reserve is keyword. 2021-12-24 14:59:14 +08:00
Stephen Chung
5c31ec7f78 Fix array bug. 2021-12-22 22:22:20 +08:00
Stephen Chung
3751b6d018 Build in array/blob concat functions. 2021-12-22 19:59:48 +08:00
Stephen Chung
422db4269e Allow multiple packages in def_package. 2021-12-22 12:41:55 +08:00
Stephen Chung
1c50efbac8 Unroll switch range case if range has only one number. 2021-12-22 10:48:19 +08:00
Stephen Chung
7ff50451cc Make comments multiline. 2021-12-21 22:16:03 +08:00
Stephen Chung
f9f3615878 Fix builds. 2021-12-21 16:36:53 +08:00
Stephen Chung
b85a9b3c1c Extract doc-comment on plugin functions. 2021-12-21 16:14:07 +08:00
Stephen Chung
f74486f904 Separate return type name and use references for serialization. 2021-12-21 13:21:29 +08:00
Stephen Chung
d7960dfe80 Short circuit no_function. 2021-12-21 13:03:39 +08:00
Stephen Chung
b4756b4575 Move CallableFunction to own file. 2021-12-20 22:13:00 +08:00
Stephen Chung
bca9fe53b0 New syntax for def_package. 2021-12-20 11:42:39 +08:00
Stephen Chung
5729f0cdd4 Add test for call_fn_raw. 2021-12-19 23:22:14 +08:00
Stephen Chung
123012404b Add Blob::write for strings. 2021-12-18 23:03:35 +08:00
Stephen Chung
e507dcfcb4 Fix no_index build. 2021-12-18 18:44:08 +08:00
Stephen Chung
541ef319bb Merge branch 'v1.3-fixes' 2021-12-18 18:22:20 +08:00
Stephen Chung
7eda6454a8 Bug fix. 2021-12-18 17:47:35 +08:00
Stephen Chung
9736171089 Fix bug in hex parsing for negative numbers. 2021-12-18 17:07:30 +08:00
Stephen Chung
0ae4d14a62 Move BLOB concat and push to builtin. 2021-12-18 15:37:20 +08:00
Stephen Chung
82d3375fc0 Fix Dynamic::from for BLOB. 2021-12-18 15:36:30 +08:00
Stephen Chung
9cf8360616 Move blob functions to builtin. 2021-12-18 14:58:02 +08:00
Stephen Chung
2b79a65454 Move range contains into builtin. 2021-12-18 14:50:37 +08:00
Stephen Chung
fc84600b22 Add NativeCallContext::call_fn 2021-12-18 12:29:04 +08:00
Stephen Chung
1c1247ac9a Tidy up code. 2021-12-18 12:28:56 +08:00
Stephen Chung
dc6896fbe2 Add OpAssignment::new_from_token. 2021-12-17 16:55:24 +08:00
Stephen Chung
8d67c70294 Fix builds. 2021-12-17 16:55:07 +08:00
Stephen Chung
29a9b3878d Fix builds. 2021-12-17 16:32:34 +08:00
Stephen Chung
42638db0fb Move Engine default limits. 2021-12-17 16:15:30 +08:00
Stephen Chung
c7ec27acc7 Split AST into separate files. 2021-12-17 16:07:13 +08:00
Stephen Chung
b1b2c62d7d Merge branch 'v1.3-fixes' 2021-12-16 22:40:25 +08:00
Stephen Chung
10fa6844c4 Fix custom syntax with method calls. 2021-12-16 22:40:10 +08:00
Stephen Chung
fbc2b1f13d Allow non-custom reserved symbols in custom syntax. 2021-12-16 18:01:49 +08:00
Stephen Chung
f92cbe1f6d Merge branch 'v1.3-fixes' 2021-12-16 16:10:39 +08:00
Stephen Chung
224aa0ea68 Allow custom syntax inside binary operator expressions. 2021-12-16 16:06:44 +08:00
Stephen Chung
2adb4ba4a8 Simplify deref_mut to &mut *. 2021-12-15 23:21:05 +08:00
Stephen Chung
abbfa3777d Add more range API's. 2021-12-15 22:12:51 +08:00
Stephen Chung
59a9ff0b0f Fix range precedences and add comparison operators. 2021-12-15 14:18:03 +08:00
Stephen Chung
eda80488d5 Fix builds. 2021-12-15 12:46:25 +08:00
Stephen Chung
7afec287d8 Fix doc test. 2021-12-15 12:26:05 +08:00
Stephen Chung
ef14079c61 Add ranges. 2021-12-15 12:06:17 +08:00
Stephen Chung
93e3c4c10a Compact BLOB display. 2021-12-13 09:40:43 +08:00
Stephen Chung
5eaf85254f Fix builds. 2021-12-12 17:26:15 +08:00
Stephen Chung
6af406bafc Add parse/write to blobs. 2021-12-12 16:29:54 +08:00
Stephen Chung
780c36e675 Simplify if let. 2021-12-12 12:33:22 +08:00
Stephen Chung
3a5495a65c Clarify custom operators. 2021-12-09 22:54:10 +08:00
Stephen Chung
675ddb89f9 Add "" and `` in string literals. 2021-12-09 13:34:51 +08:00
Stephen Chung
d9d44a9683 Add Engine::register_type_with_name_raw. 2021-12-09 12:49:12 +08:00
Stephen Chung
4421f33b2c Fix bug in blob's. 2021-12-07 19:03:04 +08:00
Stephen Chung
2a7a648429 Reduce feature gates. 2021-12-06 20:52:47 +08:00
Stephen Chung
5b64e0b383 Use deref for Expression. 2021-12-06 18:50:37 +08:00
Stephen Chung
cc98e82ea1 Include hashes in JSON output. 2021-12-06 11:12:54 +08:00
Stephen Chung
206b5051eb Clarify non-zero hashes. 2021-12-06 10:34:13 +08:00
Stephen Chung
54f78c5cd9 Use zero for no hash. 2021-12-05 17:05:19 +08:00
Stephen Chung
6f6380ca3a Fix builds. 2021-12-04 18:07:27 +08:00
Stephen Chung
b8c4054c20 Add strict variables mode. 2021-12-04 17:57:28 +08:00
Stephen Chung
fd26654125 Add allow_looping. 2021-12-03 11:24:38 +08:00
Stephen Chung
7cd76c6d18 Add language options. 2021-12-03 11:16:35 +08:00
Stephen Chung
9a5bd9396a Fix builds. 2021-12-02 17:46:39 +08:00
Stephen Chung
27c0181035 Fix build. 2021-12-02 16:01:37 +08:00
Stephen Chung
41dd989866 Support deserialization into byte arrays for BLOB's via serde_bytes. 2021-12-02 14:10:53 +08:00
Stephen Chung
70f4c53854 Trap out-of-bounds panic for BLOB's. 2021-12-02 13:09:59 +08:00
Stephen Chung
5363b0724f Support Option in from_dynamic. 2021-12-02 12:50:11 +08:00
Stephen Chung
5003d836d9 Do not construct function pointer for invalid function names. 2021-12-02 12:49:57 +08:00
Stephen Chung
d36e2d22d1 Minor refactor. 2021-12-02 12:49:46 +08:00
Stephen Chung
4b4b7a753b Add low-level warnings. 2021-11-29 13:12:47 +08:00
Stephen Chung
ba0a6c667e Add FnPtr::call_within_context. 2021-11-29 12:43:59 +08:00
Stephen Chung
0ab86ac623 Move AST::new() and AST::new_with_source() to internals. 2021-11-29 10:58:46 +08:00
Stephen Chung
c5f2b0a253 Fix builds. 2021-11-29 10:17:04 +08:00
Stephen Chung
95dc2ad502 Remove fields and parameters under no_function. 2021-11-29 09:43:35 +08:00
Stephen Chung
a3e79c0bd0 Fix builds. 2021-11-28 23:06:33 +08:00
Stephen Chung
9fa4d60336 Minor code and docs refactor. 2021-11-28 22:57:28 +08:00
Stephen Chung
dca47d5233 Remove volatile warnings for types and functions exposed unter internals. 2021-11-28 22:03:02 +08:00
Stephen Chung
c5317d7706 Deprecate NativeCallContext::new 2021-11-28 12:41:33 +08:00
Stephen Chung
d88e17d177 Move more &str to AsRef<str> 2021-11-28 12:41:20 +08:00
Stephen Chung
f49ff28b82 Fix test. 2021-11-28 10:49:48 +08:00
Stephen Chung
9c4ed44ab8 Fix builds. 2021-11-27 23:29:32 +08:00
Stephen Chung
4fc088a0f1 Fix feature builds. 2021-11-27 23:20:05 +08:00
Stephen Chung
e918e61e95 Use AsRef<str> for more flexible API. 2021-11-27 23:04:45 +08:00
Stephen Chung
30bfdd841a Add FnPtr::call. 2021-11-27 16:28:34 +08:00
Stephen Chung
d56585c877 Remove no_smartstring feature. 2021-11-27 14:24:36 +08:00
Stephen Chung
abe6b4a29b Use more const functions. 2021-11-27 14:24:06 +08:00
Stephen Chung
280b5b405e Make some new functions const. 2021-11-25 17:09:00 +08:00
Stephen Chung
fc472f641b Remove blob functions for filtering. 2021-11-23 23:01:14 +08:00
Stephen Chung
b7b42e658a Fix blob methods. 2021-11-23 22:52:10 +08:00
Stephen Chung
93b802effd Merge branch 'v1.2-fixes' 2021-11-23 22:46:16 +08:00
Stephen Chung
2b0b79870e Fix bug in array methods. 2021-11-23 22:37:18 +08:00
Stephen Chung
0c89a9c4c5 Change parameter name. 2021-11-23 18:10:01 +08:00
Stephen Chung
a757dfe89d Add blobs. 2021-11-23 14:58:54 +08:00
Stephen Chung
6ad7b344bf Add into_array and into_typed_array. 2021-11-23 12:45:59 +08:00
Stephen Chung
90200e607c Fix doc comment links. 2021-11-20 21:29:36 +08:00
Stephen Chung
fa41f4faf0 Move function back to correct file. 2021-11-20 15:43:55 +08:00
Stephen Chung
344b48ad36 Split APIs into files. 2021-11-20 14:57:21 +08:00
Stephen Chung
b7dc94fc1d Refactor. 2021-11-16 23:13:53 +08:00
Stephen Chung
e961ae23fd Eliminate script hashes under no_function. 2021-11-16 13:42:46 +08:00
Stephen Chung
b178d7c367 Fix no_function builds. 2021-11-16 13:42:22 +08:00
Stephen Chung
c2c30f7711 Use fold. 2021-11-16 13:15:43 +08:00
Stephen Chung
2fffe31b59 Level up exports. 2021-11-16 12:26:37 +08:00
Stephen Chung
98707912e0 Convert for loop to iterator. 2021-11-15 14:30:00 +08:00
Stephen Chung
de906053ed Deprecate call_fn_dynamic into call_fn_raw. 2021-11-15 11:13:00 +08:00
Stephen Chung
615c3acad6 Use actual outer scope for function-bang calls. 2021-11-14 22:48:57 +08:00
Stephen Chung
64b889fb95 Restructure code base. 2021-11-13 22:36:23 +08:00
Stephen Chung
38884ede46 Reducce panic messages. 2021-11-13 12:23:35 +08:00
Stephen Chung
c8aab47f50 Merge branch 'v1.1-fixes' 2021-11-13 10:01:55 +08:00