Commit Graph

1950 Commits

Author SHA1 Message Date
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
Stephen Chung
a227963f7a Fix unary parsing. 2021-11-13 09:50:49 +08:00
Stephen Chung
a9aa8e84fd Use Box<[]>. 2021-11-12 13:25:57 +08:00
Stephen Chung
bffc73435c Remove externals from ScriptFnDef. 2021-11-12 13:02:16 +08:00
Stephen Chung
7f34e4ad99 Merge branch 'v1.1-fixes' 2021-11-11 21:47:45 +08:00
Stephen Chung
774fd7514e Fix bang function calls under no_closure. 2021-11-11 21:47:35 +08:00
Stephen Chung
5e18ea34fe Fix doc test. 2021-11-11 21:43:45 +08:00
Stephen Chung
0fbc437916 Use Box<str> internally. 2021-11-11 13:55:52 +08:00
Stephen Chung
93869b544c Fix doc test. 2021-11-09 15:42:17 +08:00
Stephen Chung
f6dc440601 Add AST::iter_literal_variables. 2021-11-09 13:22:45 +08:00
Stephen Chung
e63cba9caf Merge branch 'v1.1-fixes' 2021-11-09 08:48:16 +08:00
Stephen Chung
5685ca8411 Fix floating-point display. 2021-11-09 08:46:02 +08:00
Stephen Chung
5083df3096 Propagate constants to functions for Engine::XXX_with_scope calls. 2021-11-08 22:16:28 +08:00
Stephen Chung
31ef7e6c69 Fix builds. 2021-11-08 12:07:49 +08:00
Stephen Chung
cc6a0571e7 Fix builds. 2021-11-08 11:35:46 +08:00
Stephen Chung
09e6b21729 Move mutable runtime global state to Imports. 2021-11-08 09:27:08 +08:00
Stephen Chung
71ad158b6a Fix builds. 2021-11-07 18:25:32 +08:00
Stephen Chung
68c0ee08c0 Reduce usage of Default::default() to make it easier to refactor. 2021-11-07 18:12:37 +08:00
Stephen Chung
61cc3d0bf2 Merge branch 'v1.1-fixes' 2021-11-05 23:26:00 +08:00
Stephen Chung
eeca8c90aa Make sure the global namespace is always searched first. 2021-11-05 23:22:05 +08:00
Stephen Chung
46e99df9cd Reverse regression on string + operator. 2021-11-05 20:34:27 +08:00
Stephen Chung
b2eb207ce4 Fix no_position builds. 2021-11-05 19:53:52 +08:00
Stephen Chung
affbb81d8a Add NativeCallContext::position. 2021-11-05 19:35:33 +08:00
Stephen Chung
231584824a Properly handle unary operators at beginning of statement. 2021-11-03 09:11:20 +08:00
Stephen Chung
7c6b444616 Fix display of 0.0. 2021-11-03 08:44:07 +08:00
Stephen Chung
ff9ac41da2 Merge branch 'v1.1-fixes' 2021-11-01 10:08:27 +08:00
Stephen Chung
c955c9200e Fix build. 2021-11-01 10:07:45 +08:00
Stephen Chung
2ea86c3987 Fix bug in assignment parsing. 2021-11-01 09:55:50 +08:00
Stephen Chung
b23bdb6d13 Remove unnecessary string builtins. 2021-11-01 09:42:22 +08:00
Stephen Chung
77dfc80fe9 Use iter().rev().enumerate(). 2021-11-01 09:31:48 +08:00
Stephen Chung
3d1b2d6f10 Fix no_function build. 2021-10-29 17:10:28 +08:00
Stephen Chung
dc2e824ce2 Fix no_module builds. 2021-10-29 17:01:29 +08:00
Stephen Chung
a5ae002cb7 Refine namespace display. 2021-10-27 23:30:25 +08:00
Stephen Chung
00659d65d9 Implement global module in EvalState. 2021-10-27 17:52:48 +08:00
Stephen Chung
79dd3f8186 Add $$ marker to custom syntax. 2021-10-25 22:41:42 +08:00
Stephen Chung
96f08e8cad Merge branch 'v1.1-fixes' 2021-10-23 17:54:03 +08:00
Stephen Chung
4e965c3f3f Fix no_module+internals build. 2021-10-23 17:49:52 +08:00
Stephen Chung
34cf494545 Add Array::sort with no predicate. 2021-10-23 11:51:48 +08:00
wackbyte
9f0347df9f Fix some rustdoc warnings and a typo in FLOAT's docs
Unfortunately, I can't fix the 2 remaining warnings.
2021-10-22 12:03:06 +08:00
Stephen Chung
8a7912a901 Fix build. 2021-10-21 19:51:35 +08:00
Stephen Chung
83f83307ca Fix builds. 2021-10-21 19:30:58 +08:00
Stephen Chung
65ef402440 Eliminate optimize module with no_optimize. 2021-10-21 19:17:34 +08:00
Stephen Chung
315a891ba6 Fine tune array methods. 2021-10-21 19:04:53 +08:00
Stephen Chung
1c921f3784 Add dedup to array. 2021-10-21 17:59:54 +08:00
Stephen Chung
9c16d90de9 Use #[inline(always)] only when relatively certain. 2021-10-21 17:26:43 +08:00
Stephen Chung
313999b0ac Reduce nesting in plugin sub-modules. 2021-10-20 16:22:12 +08:00
Stephen Chung
c8e7c970d1 Add variants of Array methods taking FnPtr with function names. 2021-10-20 11:06:38 +08:00
Stephen Chung
3001e90775 Deprecate From<EvalAltResult> for Result<T, Box<EvalAltResult>> because it is clearer for code to explicitly wrap errors in Err. 2021-10-19 23:52:58 +08:00
Stephen Chung
6d31bb0d19 Do not inline error path functions. 2021-10-19 20:16:36 +08:00
Stephen Chung
2334cd8f56 Avoid cloning in array methods as much as possible. 2021-10-19 19:57:15 +08:00
Stephen Chung
3174b4759e Simplify code. 2021-10-18 15:09:07 +08:00
Stephen Chung
782f6a3e12 Revert change. 2021-10-11 16:46:34 +08:00
Stephen Chung
90b6b15f15 Use into(). 2021-10-11 15:49:51 +08:00
Stephen Chung
4908b58473 Lazy calculate indexer call hashes. 2021-09-29 12:16:59 +08:00
Stephen Chung
87d48948f9 Merge branch 'bug-fixes' 2021-09-28 16:55:33 +08:00
Stephen Chung
7ce8887343 Fix no_index build. 2021-09-28 16:36:31 +08:00
Stephen Chung
85dcd6e754 Fix bug with changing property of value obtained via index getter. 2021-09-28 15:59:46 +08:00
Stephen Chung
e963a7251c Check if empty string came from global instance. 2021-09-27 11:09:19 +08:00
Stephen Chung
fe47058add Merge branch 'bug-fixes' 2021-09-27 10:34:46 +08:00
Stephen Chung
6df2178460 Assume property getters are pure. 2021-09-27 10:34:24 +08:00
Stephen Chung
70828209fe Fix builds. 2021-09-26 21:50:07 +08:00
Stephen Chung
42d3fde0af Fix no_closure build. 2021-09-26 21:30:33 +08:00
Stephen Chung
a130960627 Fix empty strings. 2021-09-26 21:25:29 +08:00
Stephen Chung
3557db88e8 Merge empty strings. 2021-09-26 21:18:52 +08:00
Stephen Chung
65a1c24d7b Add signatures to callback function docs. 2021-09-25 15:57:38 +08:00
Stephen Chung
0715262c44 Enhance signature of on_parse_token callback. 2021-09-24 22:44:39 +08:00
Stephen Chung
d791052d5c Add Engine::on_parse_token. 2021-09-24 18:00:48 +08:00
Stephen Chung
cd8af67842 Merge branch 'bug-fixes' 2021-09-24 09:27:45 +08:00
Stephen Chung
d9dca6ef98 Expore more internal data structures. 2021-09-24 09:26:35 +08:00
Stephen Chung
8f94a60020 Optimize interpolated strings. 2021-09-20 22:36:10 +08:00
Stephen Chung
adbe9a292e Short circuit functions if empty: array, map, string. 2021-09-20 18:35:23 +08:00
Stephen Chung
6e7fbfa66f Add pop to string. 2021-09-20 16:25:23 +08:00
Stephen Chung
71e8cf727d Use LazyCompact for SmartString. 2021-09-20 11:34:01 +08:00
Stephen Chung
2d46bf37c8 Fix build. 2021-09-19 22:44:27 +08:00
Stephen Chung
e191f9d91e Merge branch 'bug-fixes' 2021-09-19 22:34:47 +08:00
Stephen Chung
5d47ebf57a Add test for constants to Scope::get_mut. 2021-09-18 10:14:54 +08:00
Stephen Chung
5163fb0a33 Upgrade to rust-decimal 1.16 and add sin/cos/tan. 2021-09-15 10:41:35 +08:00
Stephen Chung
08155c0978 Fix sign function for NaN. 2021-09-14 22:33:10 +08:00
Stephen Chung
bdbfa8ef5f Catch mutually exclusive features. 2021-09-12 21:06:13 +08:00
Stephen Chung
50ad42bd7f Fix metadata build. 2021-09-12 14:46:31 +08:00
Stephen Chung
c84f80d433 Use StaticVec for parsing. 2021-09-12 14:34:00 +08:00
Stephen Chung
b961a10d27 Refine code. 2021-09-12 14:33:48 +08:00
Stephen Chung
96dbbc76e4 Use StaticVec for function resolution caches for the common case where no modules are used. 2021-09-12 13:33:55 +08:00
Stephen Chung
6e25354076 Fix bit flag options and docs. 2021-09-12 13:21:53 +08:00
Stephen Chung
6510b617fe Reduce usage of Default::default() 2021-09-11 19:40:40 +08:00
Stephen Chung
5d3a22ab6f Fix NamespaceRef::new() 2021-09-11 19:40:31 +08:00
Stephen Chung
84be799403 Change StaticVec to 3 inline elements. 2021-09-10 20:25:22 +08:00
Stephen Chung
43de522568 Use option flags for certain AST nodes. 2021-09-10 20:23:59 +08:00
Stephen Chung
7956f9d59c Reduce duplicated generics code. 2021-09-07 23:05:31 +08:00
Stephen Chung
09da9ddcbc Move unit tests into separate file. 2021-09-07 22:12:04 +08:00
Stephen Chung
5ac33ce64d Do not export FloatWrapper under no_float. 2021-09-04 18:43:18 +08:00
Stephen Chung
e8b811af28 Add test for minimal build Dynamic size. 2021-09-04 11:59:07 +08:00
Stephen Chung
6a2c9f0293 Add ASTNode::position(). 2021-09-03 20:47:45 +08:00
Stephen Chung
cbe08fb64e Merge branch 'bug-fixes' 2021-09-03 10:19:58 +08:00
Stephen Chung
71711998f1 Fix bug in catch error variable. 2021-09-03 10:05:58 +08:00
Stephen Chung
65fbfe36e7 Merge branch 'bug-fixes' 2021-09-02 22:49:17 +08:00
Stephen Chung
457be797a2 Fixed bug in using error variable within catch block. 2021-09-02 22:17:45 +08:00
Stephen Chung
7b2b26aa0d Separate is_valid_function_name. 2021-08-30 15:42:47 +08:00
Stephen Chung
b6d38a8fc9 Fix metadata build. 2021-08-30 10:25:24 +08:00
Stephen Chung
6faa6358f0 Simplify code by merging Engine::global_namespace with Engine::global_modules. 2021-08-30 10:09:28 +08:00
Stephen Chung
6f3de4c803 Fix doc test. 2021-08-27 12:10:58 +08:00
Stephen Chung
aec4417bd5 Refine expect messages. 2021-08-26 23:58:41 +08:00
Stephen Chung
2a760eb44b Update doc-comments. 2021-08-24 12:04:53 +08:00
Stephen Chung
db3049e574 Engine::register_type_XXX available under no_object. 2021-08-23 23:10:54 +08:00
Stephen Chung
58352e00bd Prevent spill-over of new variables in Engine::call_fn. 2021-08-17 23:24:41 +08:00
Stephen Chung
b6eac65601 Simplify code. 2021-08-17 18:14:16 +08:00
Stephen Chung
9c6cea3c9f Add Scope::set_or_push. 2021-08-17 15:51:14 +08:00
Stephen Chung
0354f154ce Add Scope::is_constant. 2021-08-17 15:51:14 +08:00
Stephen Chung
114c93f430 Fix bug in custom syntax starting with disabled stardard keyword. 2021-08-17 15:51:14 +08:00
Stephen Chung
c1b4c81e75 Scope::set_value takes name that implements Into<Cow<str>>. 2021-08-17 15:51:14 +08:00
Stephen Chung
288d575046 Add log10 for Decimal. 2021-08-17 15:50:56 +08:00
Stephen Chung
06f217d526 Move deprecated functions into separate file. 2021-08-17 15:50:56 +08:00
Stephen Chung
180ad77224 Change Engine::consume_XXX to Engine::run_XXX. 2021-08-17 15:50:56 +08:00
Stephen Chung
e0125a1033 Allow self-terminating custom syntax. 2021-08-17 15:50:56 +08:00
Stephen Chung
3127f9a8af Add new constant from functions for Dynamic. 2021-08-17 15:50:56 +08:00
Stephen Chung
ffb1531e0e New constants for Dynamic. 2021-08-17 15:50:56 +08:00
Stephen Chung
94674679d9 Rename as_string and as_immutable_string. 2021-08-17 15:50:55 +08:00
Stephen Chung
b21deaf052 Support $symbol$ in custom syntax. 2021-08-17 15:50:55 +08:00
Stephen Chung
e0cae4546c Polyfiill some functions for decimal+no_float. 2021-08-17 15:50:54 +08:00
Stephen Chung
224a2dfb60 Fix bug in dotting-indexing. 2021-08-17 15:32:48 +08:00
Stephen Chung
8a8bc2adfb Improve FnPtr debug display. 2021-08-17 15:32:12 +08:00
Stephen Chung
3610b5eb7e Change some inline(always) into inline. 2021-08-14 15:10:37 +08:00
Stephen Chung
0f46bc7725 Fix builds. 2021-08-13 14:04:27 +08:00
Stephen Chung
dba4510456 Better function parameter names. 2021-08-13 13:42:39 +08:00
Stephen Chung
9b56c1ba78 Optimize loops better. 2021-08-04 17:40:26 +08:00
Stephen Chung
4807fdf1cf Loops cannot be pure. 2021-08-04 17:37:56 +08:00
Stephen Chung
81770f00e0 Rename variables and constants for bit flags. 2021-08-04 11:16:11 +08:00
Stephen Chung
1d82a11f0b Change AST nodes to use bitflags for options. 2021-08-03 22:19:25 +08:00
Stephen Chung
0944261b88 Merge Stmt::Let and Stmt::Const into Stmt::Var. 2021-08-01 11:59:53 +08:00
Stephen Chung
29133cf973 Satisfy clippy. 2021-07-26 22:22:27 +08:00
Stephen Chung
2c50738c6c Change field names of EvalState. 2021-07-26 10:03:46 +08:00
Stephen Chung
c7498503ba Use lower case for feature marker. 2021-07-25 22:56:05 +08:00
Stephen Chung
6cb710652b Fix doc link. 2021-07-25 11:51:26 +08:00
Stephen Chung
8531567ee9 Fix builds. 2021-07-24 14:23:14 +08:00
Stephen Chung
df482d3574 Satisfy clippy. 2021-07-24 14:11:16 +08:00
Stephen Chung
b8485b1909 Fix bug in indexing. 2021-07-24 12:27:33 +08:00
Stephen Chung
106c8ab5d1 Fix builds. 2021-07-14 22:33:47 +08:00
Stephen Chung
e3668227c0 Remove absolute path for files in the current directory. 2021-07-14 18:32:22 +08:00
Stephen Chung
7c93622b57 Handle more data types in Expr::from_dynamic. 2021-07-14 14:00:10 +08:00
Stephen Chung
cb312539fb Fix ImmutableString docs. 2021-07-14 13:58:50 +08:00
Stephen Chung
925325820e Make some Position functions const. 2021-07-14 13:58:18 +08:00
Stephen Chung
0e77c4f9a0 Short-circuit optimizations for special keywords. 2021-07-14 13:57:58 +08:00
Stephen Chung
5def8f04bd Remove From<Dynamic> for Expr in favor of Expr::from_dynamic. 2021-07-14 13:53:04 +08:00
Stephen Chung
dad1fe8392 Handle more data types in Expr::from_dynamic. 2021-07-14 13:52:40 +08:00
Stephen Chung
713f8ea672 Implement more methods for custom iterators. 2021-07-12 13:05:38 +08:00
Stephen Chung
e0673a2f1a Change some #[inline(always)] to [#inline]. 2021-07-10 11:06:13 +08:00
Stephen Chung
4d25fd0192 Remove unnecessary AsRef<str>. 2021-07-10 10:11:14 +08:00
Stephen Chung
d517a0219b Revert "Remove unnecessary imports."
This reverts commit d6220f0d8d.
2021-07-08 23:03:36 +08:00
Stephen Chung
d6220f0d8d Remove unnecessary imports. 2021-07-08 22:42:50 +08:00
Stephen Chung
75a8a4d4e3 Enable json command in REPL. 2021-07-08 14:09:31 +08:00