Commit Graph

2248 Commits

Author SHA1 Message Date
Stephen Chung
1c7884f0d8 Switch to fxhash for fast hashing. 2021-01-15 23:30:45 +08:00
Stephen Chung
92c7fd9e5b Better error messages. 2021-01-15 17:13:04 +08:00
Stephen Chung
3f44e2893c Wrap up 0.19.10. 2021-01-14 19:07:03 +08:00
Stephen Chung
fe65bf6137 Fix bug in optimizer. 2021-01-12 23:52:50 +08:00
Stephen Chung
8c47d61456 Refine documentation and comments. 2021-01-11 23:09:33 +08:00
Stephen Chung
5b9a18f5b8 Fix FileModuleResolver::clear_cache_for_path. 2021-01-10 19:34:26 +08:00
Stephen Chung
14fe4f9f1b Change resolve_ast return type. 2021-01-09 23:26:50 +08:00
Stephen Chung
0b6657d1b1 Fix clippy. 2021-01-09 17:13:34 +08:00
Stephen Chung
e5b345bca4 Fix feature builds. 2021-01-09 17:06:01 +08:00
Stephen Chung
ad250fc973 Recursive self-contained AST. 2021-01-09 16:52:22 +08:00
Stephen Chung
637f47d259 Split AST::set_source into set_source/clear_source. 2021-01-09 15:20:07 +08:00
Stephen Chung
1513e6ab6a Fix internals build. 2021-01-09 00:49:50 +08:00
Stephen Chung
bfe9ac2188 Fix feature builds. 2021-01-09 00:40:44 +08:00
Stephen Chung
0f1f6c4ad3 Add Engine::compile_to_self_contained. 2021-01-09 00:24:55 +08:00
Stephen Chung
b96c832141 Add EvalAltResult::clear_position(). 2021-01-08 14:29:57 +08:00
Stephen Chung
ec18bd26a2 Handle no-std without sync. 2021-01-07 22:52:20 +08:00
Stephen Chung
96b1e7777b Update URL links. 2021-01-07 17:30:06 +08:00
Stephen Chung
e059ca009c Fix feature builds. 2021-01-06 18:22:45 +08:00
Stephen Chung
a5d6392107 Use NonZero for limits. 2021-01-06 13:46:53 +08:00
Stephen Chung
3fbcefe0ed Move HashableHashMap to utils. 2021-01-05 18:37:07 +08:00
Stephen Chung
d5891d4802 Remove eval_expr_as_target. 2021-01-05 18:01:42 +08:00
Stephen Chung
cf9d35166d Remove hashing of the entire script by making Expr and Stmt Hash. 2021-01-04 11:58:24 +08:00
Stephen Chung
e2a47b2a65 Disallow duplicated function definitions. 2021-01-03 20:54:08 +08:00
Stephen Chung
103af43f68 Fix typo in sync. 2021-01-03 13:46:08 +08:00
Stephen Chung
33f7c8557c Put source into AST. 2021-01-03 13:30:01 +08:00
Stephen Chung
d3894e8aef Add #[inline] 2021-01-03 13:29:42 +08:00
Stephen Chung
70a0d6ce58 Make id_raw return Option<&ImmutableString> 2021-01-03 11:25:25 +08:00
Stephen Chung
e3b7aa47a0 Merge branch 'master' of https://github.com/schungx/rhai 2021-01-03 11:15:57 +08:00
Ilya Lakhin
85ec781a35 Module::id_raw became crate-public 2021-01-03 09:29:50 +07:00
Ilya Lakhin
acbf5d8723 AST::set_source affects internal module id 2021-01-03 09:29:50 +07:00
Stephen Chung
1bbf473ec7 Add source info to native calls. 2021-01-03 00:20:13 +08:00
Stephen Chung
ef48f47b74 Refine docs and comments etc. 2021-01-02 23:30:10 +08:00
Stephen Chung
5a3bbaa322 Reduce size of FnPtr. 2021-01-02 13:37:40 +08:00
Stephen Chung
05fa8460a3 Remove unnecessary err.fill_position() 2021-01-02 13:29:16 +08:00
Stephen Chung
0a69caaf6d Refine API for contexts. 2021-01-01 17:05:06 +08:00
Stephen Chung
8f7a588ac3 Fix no_std. 2020-12-30 22:37:22 +08:00
Stephen Chung
ba7f8c6391 Propagate source info. 2020-12-30 21:12:51 +08:00
Stephen Chung
386e34aacd Fix no_module feature. 2020-12-30 15:37:39 +08:00
Stephen Chung
db5b855dea Replace - with &ndash; 2020-12-29 23:01:34 +08:00
Stephen Chung
a45876856d Enhance rhai-repl. 2020-12-29 22:04:31 +08:00
Stephen Chung
049ad3b6fd Move rhai-repl and rhai-doc to bin. 2020-12-29 15:36:42 +08:00
Stephen Chung
2858aa3b2f Avoid calling token mapper if none is specified. 2020-12-29 13:12:11 +08:00
Stephen Chung
13f5cec291 Fix call stack limits. 2020-12-29 12:29:45 +08:00
Stephen Chung
41c6f985f5 Fix bug with tokenizing identifiers. 2020-12-29 11:37:15 +08:00
Stephen Chung
eca8212f38 More code refinements. 2020-12-29 10:41:20 +08:00
Stephen Chung
e481a8019d Simplify code and better error messages. 2020-12-28 14:21:13 +08:00
Stephen Chung
5c813ca7c0 Code cleanup. 2020-12-28 09:49:54 +08:00
Stephen Chung
6b8d78d64c Streamline parsing. 2020-12-27 16:50:48 +08:00
Stephen Chung
48af8719e7 Fix closure property access. 2020-12-27 11:50:24 +08:00
Stephen Chung
88f63fa24b Refine docs. 2020-12-26 23:21:16 +08:00
Stephen Chung
66d3af256e Enhance custom operators. 2020-12-26 23:21:09 +08:00
Stephen Chung
0a35c4cb41 Change custom precedence to Option<NonZeroU8>. 2020-12-26 17:42:19 +08:00
Stephen Chung
dc4e52e795 Code enhancements. 2020-12-26 13:05:57 +08:00
Stephen Chung
822fe80105 Reduce redirections. 2020-12-25 11:02:29 +08:00
Stephen Chung
8f969b1ab5 Reduce indirections. 2020-12-24 23:22:50 +08:00
Stephen Chung
363085efc3 Map actual 0 hash to 42. 2020-12-24 18:43:04 +08:00
Stephen Chung
8506640073 Use NonZeroU64 for function hashes. 2020-12-24 16:32:43 +08:00
Stephen Chung
c81a59435b Make Scope Clone + Hash. 2020-12-24 09:42:03 +08:00
Stephen Chung
9fd7e01197 Simplify code. 2020-12-23 23:29:19 +08:00
Stephen Chung
08e7ad8c09 Add deprecated packages API. 2020-12-23 15:30:35 +08:00
Stephen Chung
cebbc2b607 Fix duplicate Ident export. 2020-12-23 12:11:53 +08:00
Stephen Chung
f55a56c6bc Engine::register_global_module and Engine::register_static_module must be passed shared Module. 2020-12-23 10:08:43 +08:00
Stephen Chung
15fb03218c Rename packages to global modules. 2020-12-22 23:45:14 +08:00
Stephen Chung
eb46ec8296 Simplify Imports. 2020-12-22 22:36:36 +08:00
Stephen Chung
0157f912e0 Remove PackageLibrary and PackagesCollection. 2020-12-22 22:36:30 +08:00
Stephen Chung
2a7e6c0884 Fixup docs. 2020-12-22 22:35:25 +08:00
Stephen Chung
2e7ec8f1db IdentX -> Ident. 2020-12-22 16:45:56 +08:00
Stephen Chung
206400b187 Fix serde feature. 2020-12-22 15:27:27 +08:00
Stephen Chung
10da4d8976 LexError directly to ParseError. 2020-12-22 11:55:51 +08:00
Stephen Chung
8c41e549f7 Add Engine::gen_fn_metadata_with_ast_to_json. 2020-12-22 11:13:13 +08:00
Stephen Chung
ff67efc6d5 Add source to contexts. 2020-12-21 23:12:45 +08:00
Stephen Chung
5ac83f0f46 Add context source to on_debug. 2020-12-21 22:04:46 +08:00
Stephen Chung
2955a4ab64 Fix unary operators binding. 2020-12-21 17:39:37 +08:00
Stephen Chung
730a7320d6 Run eval with new State. 2020-12-20 23:46:46 +08:00
Stephen Chung
cec27846ea Simplify code. 2020-12-20 23:25:11 +08:00
Stephen Chung
f99703f951 Add Engine::disable_doc_comments and smarter doc-comments treatment. 2020-12-20 20:05:23 +08:00
Stephen Chung
22039b24b3 Add export to JSON. 2020-12-20 12:27:47 +08:00
Stephen Chung
c6a3ce2cd5 Add metadata export to JSON. 2020-12-19 19:42:18 +08:00
Stephen Chung
0182b2d3f4 Correct speed claim and others in docs. 2020-12-19 17:46:34 +08:00
Stephen Chung
d73f3a1d60 Add functions lookup cache. 2020-12-18 23:47:17 +08:00
Stephen Chung
db7b9cb0f9 Native only if function call is not a valid identifier. 2020-12-18 23:03:56 +08:00
Stephen Chung
882b26d2a1 Change ScriptFnMetadata to hold references. 2020-12-18 16:31:44 +08:00
Stephen Chung
719f0babbf Fix comments parsing. 2020-12-18 16:07:19 +08:00
Stephen Chung
f8c14ba1c4 Add look-ahead to custom syntax parser. 2020-12-15 19:23:30 +08:00
Stephen Chung
17310ef576 Encapsulate structures. 2020-12-14 23:05:13 +08:00
Stephen Chung
6f2fecb76b Add type iterator docs. 2020-12-14 15:15:05 +08:00
Stephen Chung
ecc08271d9 Include actual tokens in custom syntax node. 2020-12-13 14:31:24 +08:00
Stephen Chung
87174de051 Add doc-comment to function metadata. 2020-12-12 20:09:29 +08:00
Stephen Chung
26449a9f1c Add ScriptFnMetadata. 2020-12-12 18:44:28 +08:00
Stephen Chung
1087c338bd Change output of AST::iter_functions. 2020-12-12 16:31:13 +08:00
Stephen Chung
dbdb8f43b7 Change AST to struct. 2020-12-12 15:57:55 +08:00
Stephen Chung
40b6a014ae Provide Position to debug. 2020-12-12 11:47:18 +08:00
Stephen Chung
5443368359 Pass Position into function calls. 2020-12-12 11:15:09 +08:00
Stephen Chung
4438c358d5 on_progress takes u64. 2020-12-12 10:10:27 +08:00
Stephen Chung
bed29da71a Use ImmutableString. 2020-12-11 12:57:07 +08:00
Stephen Chung
99dd7a6481 Share constant variables for closures. 2020-12-09 21:06:36 +08:00
Stephen Chung
dbee0eb0f5 Rename AccessType to ReadWrite and ReadOnly. 2020-12-09 18:37:52 +08:00
Stephen Chung
7598ec136f Fix feature builds. 2020-12-08 23:09:12 +08:00
Stephen Chung
f22a04fc74 Move constancy into Dynamic. 2020-12-08 22:47:38 +08:00
Stephen Chung
8e8069f819 Do not propagate constants if shadowed. 2020-12-08 22:20:29 +08:00
Stephen Chung
aff207d4f4 Bump version. 2020-12-07 22:21:02 +08:00
Stephen Chung
bd52333802 Add namespace test. 2020-12-07 21:54:52 +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
b098160262 New CI test. 2020-11-28 16:58:02 +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
86009c70c8 Allow floating point numbers ending in a period. 2020-11-23 22:51:21 +08:00
Stephen Chung
36aa827e15 Simply interned strings dict. 2020-11-23 21:12:57 +08:00
Stephen Chung
2d73468723 Add doc on Engine::gen_fn_signatures. 2020-11-23 20:27:20 +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
9edd494000 Fix builds. 2020-11-22 17:32:10 +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
254fd16e62 Fix type sizes test. 2020-11-21 17:39:43 +08:00
Stephen Chung
97368da762 Reserve begin/end. 2020-11-21 15:44:17 +08:00
Stephen Chung
eb4636f219 Fix LexError::ImproperSymbol. 2020-11-21 15:15:14 +08:00
Stephen Chung
0046fe7e73 Prefer Engine::disable_symbol to disable eval. 2020-11-21 15:08:18 +08:00
Stephen Chung
2be757fda0 Make shadowing variables in custom syntax work. 2020-11-21 13:05:57 +08:00
Stephen Chung
17cd305af7 Restore previous always_search when exiting block. 2020-11-21 12:25:39 +08:00
Stephen Chung
6069a4cf55 do loop. 2020-11-20 22:23:37 +08:00
Stephen Chung
b34e7840b0 Fix serde build 2020-11-20 21:07:31 +08:00
Stephen Chung
783803ec46 Update comments with links. 2020-11-20 16:52:28 +08:00
Stephen Chung
15afd83da5 Merge Expr::True/False into BoolConstant. 2020-11-19 22:29:50 +08:00
Stephen Chung
b87fa87a75 Fix internals. 2020-11-19 14:08:58 +08:00
Stephen Chung
5e4ede6f07 global_module -> global_namespace. 2020-11-19 13:56:03 +08:00
Stephen Chung
a00d6ba99e Optimize IndexChainValue usage. 2020-11-19 13:51:59 +08:00
Stephen Chung
0e4743e7c7 Share environment when making module from AST. 2020-11-19 10:52:45 +08:00
Stephen Chung
1de85d749d Optimize AST. 2020-11-19 10:41:08 +08:00
Stephen Chung
d35a7eeaa8 Optimize PackagesCollection. 2020-11-19 10:24:43 +08:00
Stephen Chung
a8cdb661f8 Optimize Imports. 2020-11-19 10:14:43 +08:00
Stephen Chung
21c641d21f Set namespace in Module::set_fn_XXX_mut calls. 2020-11-17 15:11:58 +08:00
Stephen Chung
038e3c2554 Add FnNamespace for module functions. 2020-11-17 12:23:53 +08:00
Stephen Chung
999a87f86e Fix no_optimize build. 2020-11-16 23:32:44 +08:00
Stephen Chung
7ef3bd6b20 Fix no_function build. 2020-11-16 23:25:19 +08:00
Stephen Chung
699220057f Fix bug. 2020-11-16 23:17:34 +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
cd62104296 More Dynamic constants. 2020-11-16 13:56:07 +08:00
Stephen Chung
b6d35ab310 Fix no_module build. 2020-11-16 09:30:17 +08:00
Stephen Chung
b75964e383 Add Dynamic::UNIT. 2020-11-15 23:14:29 +08:00
Stephen Chung
937b45a187 Add Engine::load_module. 2020-11-15 23:14:16 +08:00
Stephen Chung
fbe9425794 Add discriminant to Dynamic::hash. 2020-11-15 18:39:23 +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
a63f14b59c Expr::Switch -> Stmt::Switch. 2020-11-14 23:43:36 +08:00
Stephen Chung
0182117759 Change Stmt Variant names. 2020-11-14 22:55:23 +08:00
Stephen Chung
fce2c62f02 Reformat code files. 2020-11-14 22:43:56 +08:00
Stephen Chung
28de155f08 Add Expr::DynamicConstant. 2020-11-14 19:04:49 +08:00
Stephen Chung
89254a04c4 Fix tests. 2020-11-14 17:22:01 +08:00
Stephen Chung
56fbe39b7b Use references for switch expressions, if possible. 2020-11-14 16:08:48 +08:00
Stephen Chung
b0c66eb5e5 Add benchmarks for switch statement. 2020-11-13 19:35:51 +08:00
Stephen Chung
bc07b4fa84 Fix builds. 2020-11-13 18:49:23 +08:00
Stephen Chung
55b4907f19 Add switch expression. 2020-11-13 18:32:18 +08:00
Stephen Chung
7d1b971b39 More interned strings. 2020-11-13 10:43:54 +08:00
Stephen Chung
27619b86db Fix builds. 2020-11-12 23:09:27 +08:00
Stephen Chung
69a0f044f4 Use interned strings to prepare for match statement. 2020-11-12 22:36:13 +08:00
Stephen Chung
8e5a53bc0d Implement Hash for Dynamic. 2020-11-12 21:53:26 +08:00
Stephen Chung
41c815f355 Optimize in-place. 2020-11-12 12:37:42 +08:00
Stephen Chung
7b27dcdd62 Fix error messages. 2020-11-11 13:25:45 +08:00
Stephen Chung
958762079e Change modules to namespace. 2020-11-10 23:26:50 +08:00
Stephen Chung
c41f5aefcb Change sub-modules to shared. 2020-11-09 22:44:20 +08:00
Stephen Chung
e69444293c Encapsulate imported modules into AST. 2020-11-09 21:52:23 +08:00
Stephen Chung
821e64adc4 Allow multiple exports. 2020-11-09 14:38:33 +08:00
Stephen Chung
173f8474d6 Fix no_module build. 2020-11-09 12:50:18 +08:00
Stephen Chung
4b622a8830 Enable export let/export const short-hand. 2020-11-09 12:21:11 +08:00
Stephen Chung
48886eacc8 Add == and != to arrays and maps. 2020-11-08 23:00:37 +08:00
Stephen Chung
487a073caf Fix recursive file import bug. 2020-11-08 23:00:03 +08:00
Stephen Chung
232ba27548 Add NativeCallContext::new. 2020-11-08 18:15:23 +08:00
Stephen Chung
b926eba501 Fix doc test. 2020-11-08 16:49:59 +08:00
Stephen Chung
1e07e4356e Re-index imported modules if they are not yet indexed. 2020-11-08 14:29:54 +08:00
Stephen Chung
760f6c3678 Fix no_function build. 2020-11-08 10:56:33 +08:00
Stephen Chung
b3d318ef7f Module resolver returns shared module. 2020-11-07 23:33:21 +08:00
Stephen Chung
d5d70367fa Fix no-std buld. 2020-11-06 19:22:00 +08:00
Stephen Chung
6bc5ba6668 Enable functions to use global imports. 2020-11-06 19:17:07 +08:00
Stephen Chung
07a8a43298 Optimize data structures. 2020-11-06 16:27:40 +08:00
Stephen Chung
3f6db1d9d4 Remove extra export of LexError. 2020-11-04 20:20:55 +08:00
Stephen Chung
a5d22ddd45 Make FuncInfo a struct. 2020-11-04 14:37:46 +08:00
Stephen Chung
b390586bcc Fix optimization of Stmt::Expr. 2020-11-04 13:11:37 +08:00
Stephen Chung
c287a61b93 Streamline ScriptFnDef. 2020-11-04 12:34:54 +08:00
Stephen Chung
f75942715d Remove clippy warnings. 2020-11-04 12:34:34 +08:00
Stephen Chung
2168fd5361 Expr::Stmt takes a statements block. 2020-11-04 11:49:02 +08:00
Stephen Chung
32f41c69bd Refine code and docs. 2020-11-03 21:50:14 +08:00
Stephen Chung
f74d947c6b Fix constant assignment. 2020-11-03 13:08:19 +08:00
Stephen Chung
b9de8eaa7f Minor code refactor. 2020-11-02 23:54:19 +08:00
Stephen Chung
cc304ba513 Fix serde build. 2020-11-02 13:18:37 +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
b07a2aa79c Pack Imports. 2020-11-01 23:42:00 +08:00
Stephen Chung
717e8e7eee Remove unnecessary clone. 2020-11-01 22:55:19 +08:00
Stephen Chung
c55fc5a9a5 Optimize Scope. 2020-11-01 22:46:46 +08:00
Stephen Chung
a2e2b5e2ef Add f32_float feature. 2020-11-01 15:48:48 +08:00
Stephen Chung
629e02f9da Use Ident. 2020-11-01 00:04:02 +08:00
Stephen Chung
abbee80e5d Do not box ModuleRef. 2020-10-31 23:51:59 +08:00
Stephen Chung
42eac410b7 Optimize Expr. 2020-10-31 23:26:21 +08:00
Stephen Chung
89811c8dfc Pack Stmt and Expr some more. 2020-10-31 14:13:45 +08:00
Stephen Chung
3e23cf943e Add to_float from f32 to f64. 2020-10-30 14:19:19 +08:00
Stephen Chung
a73584cd36 Fix no_std. 2020-10-29 12:00:02 +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
bed6364dcb Simplify hash calculation. 2020-10-28 22:30:29 +08:00
Stephen Chung
f5ffbfbe06 Code structure cleanup. 2020-10-28 22:18:44 +08:00
Stephen Chung
53adc58f63 Fix no_closure build. 2020-10-28 19:21:45 +08:00
Stephen Chung
f56c3fe9cb Add Ident/IdentX to AST. 2020-10-28 19:11:17 +08:00
Stephen Chung
00b1051732 Optimize Stmt/Expr reflections. 2020-10-28 14:10:48 +08:00
Stephen Chung
427af14f1b Don't wrap system errors from function calls. 2020-10-28 14:10:46 +08:00
Stephen Chung
30e11f137b Move ErrorAssignmentToUnknownLHS to ParseError. 2020-10-28 10:26:36 +08:00
Stephen Chung
4b087d0e69 Fix test. 2020-10-27 23:45:04 +08:00
Stephen Chung
51fca1e757 Move Assignment to Stmt. 2020-10-27 23:21:20 +08:00
Stephen Chung
fd2ba54b49 Introduce BinaryExpr. 2020-10-27 23:00:05 +08:00
Stephen Chung
f62f7908ab Pack Stmt tighter. 2020-10-27 19:23:43 +08:00
Stephen Chung
93b5df6b3c Pack Stmt structure. 2020-10-27 18:18:19 +08:00
Stephen Chung
01663a6581 Refine docs. 2020-10-27 11:30:38 +08:00
Stephen Chung
4add90b215 Change parser output to String. 2020-10-27 09:56:37 +08:00
Stephen Chung
54d68c1061 Fix bug. 2020-10-26 21:49:49 +08:00
Stephen Chung
7496c77ac9 Custom syntax parser function takes &[String]. 2020-10-26 19:46:58 +08:00
Stephen Chung
b467b18722 Fix no_std build. 2020-10-25 22:08:02 +08:00
Stephen Chung
b607a3a9ba Add raw API for custom syntax. 2020-10-25 21:57:18 +08:00
Stephen Chung
f670d55871 Fix Send+Sync for EvalAltResult. 2020-10-25 21:48:18 +08:00
Stephen Chung
65432330c4 Add Module::fill_with. 2020-10-25 00:39:47 +08:00
Stephen Chung
2c7c719cd5 Minor cleanup before release. 2020-10-22 12:26:44 +08:00
Stephen Chung
e89d12c42f Reserve thread keyword. 2020-10-21 14:45:20 +08:00
Stephen Chung
3660e42b96 Refactor try/catch code. 2020-10-21 14:45:10 +08:00
Stephen Chung
ad60db5bae Reduce max fn call level. 2020-10-21 10:10:46 +08:00
Stephen Chung
44dc5f95c3 Fix serde feature. 2020-10-20 23:29:56 +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
13f1ae577b Use plugins to define functions. 2020-10-19 23:49:01 +08:00
Stephen Chung
ccba5f2188 Move custom syntax into separate function. 2020-10-19 19:21:40 +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
d1f9f4096d Update badges 2020-10-19 17:26:47 +08:00
Stephen Chung
c8c4ca21ad Update docs. 2020-10-19 14:26:15 +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
dc4c47e008 Fix no_function and no_module builds. 2020-10-18 17:29:11 +08:00
Stephen Chung
232ff91957 Fix doc test. 2020-10-18 17:08:57 +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
aa6d00f253 Fix bug. 2020-10-17 20:01:31 +08:00
Stephen Chung
f903eda8ab Catch Fn and eval in method call at parse time. 2020-10-17 18:18:29 +08:00
Stephen Chung
7a4905209c Introduce EvalAltResult::ErrorSystem. 2020-10-17 16:34:07 +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
a16fc71935 Encapsulate RwLock and RefCell into Locked. 2020-10-16 23:41:56 +08:00
Stephen Chung
f995d09d8b Fix bug with calling scripted function. 2020-10-16 21:16:06 +08:00
Stephen Chung
e62df6cbed Remove none for array. 2020-10-16 21:02:16 +08:00
Stephen Chung
54d5b29390 Remove clone. 2020-10-15 23:44:05 +08:00
Stephen Chung
1e21a7f7e7 Introduce IndexChainValue. 2020-10-15 23:30:30 +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
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
3df8d6c398 Fix typo. 2020-10-13 17:16:19 +08:00
Stephen Chung
13c4d0bbb3 Adjust precedence of in. 2020-10-13 16:01:42 +08:00
Stephen Chung
9dceeaf114 Reserve ** operator. 2020-10-13 15:51:59 +08:00
Stephen Chung
037e8334d4 Reset modulo precedence. 2020-10-13 15:49:09 +08:00
Stephen Chung
28697e0380 Remove support for script-line native functions. 2020-10-13 14:40:02 +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
3c7805d514 Encapsulate environment in ScriptFnDef. 2020-10-13 09:38:14 +08:00
Stephen Chung
0b4129fb98 Raise precedence of ~ and %. 2020-10-13 09:33:16 +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
6d0851de44 Reverse function call parameter change. 2020-10-12 19:36:34 +08:00
Stephen Chung
21b989afd5 Refine function call parameters size. 2020-10-12 17:00:58 +08:00
Stephen Chung
c4f00afbee Disallow ! in module function calls. 2020-10-12 16:59:59 +08:00
Stephen Chung
e343bcfa8f Change Option<usize> to usize for variable resolver index. 2020-10-11 22:41:26 +08:00
Stephen Chung
fd5a932611 Implement variable resolver. 2020-10-11 21:58:11 +08:00
Stephen Chung
9d93dac8e7 Reserve some more symbols. 2020-10-10 22:14:10 +08:00
Stephen Chung
994e5a4251 Move some concat functions to builtin. 2020-10-10 22:13:55 +08:00
Stephen Chung
dd9f58f323 Merge ser/de modules. 2020-10-10 13:43:14 +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
59b380b130 Allow propagation for pushed scope constants. 2020-10-09 13:26:32 +08:00
Stephen Chung
630ec51624 Simplify let/const statement. 2020-10-09 13:25:53 +08:00
Stephen Chung
1f74b36496 Add EntryType::is_constant. 2020-10-09 13:23:44 +08:00
Stephen Chung
a4b674d015 Trap elapsed error when timestamp is later than now. 2020-10-09 12:51:26 +08:00
Stephen Chung
7ede299aae Allow expressions in constants. 2020-10-09 11:15:25 +08:00
Stephen Chung
d511aac7a4 Reduce max call stack size for debug. 2020-10-08 23:00:01 +08:00
Stephen Chung
1272eeb81a Add/remove #[inline] attributes. 2020-10-08 22:25:50 +08:00
Stephen Chung
b2d603ec06 Refine Add/AddAssign for AST and Module. 2020-10-07 23:25:08 +08:00
Stephen Chung
ec19103478 Fix serde typo. 2020-10-07 15:51:00 +08:00
Stephen Chung
d7bfe13b3e Add convenient functions and operators for Module and module resolvers. 2020-10-07 15:40:36 +08:00
Stephen Chung
1523981e4e Add AST::combine and AST::combine_filtered. 2020-10-07 12:11:25 +08:00
Stephen Chung
3340760b35 Fix no_std build. 2020-10-07 11:44:06 +08:00
Stephen Chung
ae1157a140 Remove Expr::get_constant_str and change Expr::get_constant_value not to panic. 2020-10-06 22:09:26 +08:00
Stephen Chung
8809d25d3c Add Dynamic::from(&str) 2020-10-06 21:25:05 +08:00
Stephen Chung
1de44c7ecd Reserve $ symbol. 2020-10-05 23:02:50 +08:00
Stephen Chung
44f8d9e429 Refine Module::iter_script_fn_info. 2020-10-05 21:52:39 +08:00
Stephen Chung
2f6bb643aa Remove Module::get_script_function_by_signature. 2020-10-05 18:07:40 +08:00
Stephen Chung
82d48df734 Merge data type mismatch errors. 2020-10-05 13:45:57 +08:00
Stephen Chung
b67a743306 Do not eagerly evaluate is_def_fn and is_def_var. 2020-10-05 12:14:34 +08:00
Stephen Chung
29bf790286 Fix no_function build. 2020-10-05 12:09:45 +08:00
Stephen Chung
4356d02828 Fix no_object builds. 2020-10-05 12:05:46 +08:00
Stephen Chung
0d0affd5e9 Eagerly evaluate built-in operators for OptimizationLevel::Simple. 2020-10-05 10:27:31 +08:00
Stephen Chung
a962debf0d Simplify target back propagation. 2020-10-04 10:40:44 +08:00
Stephen Chung
23d0f52284 Better error messages. 2020-10-03 23:27:30 +08:00
Stephen Chung
1e13e6be5f Doc formatting. 2020-10-03 18:49:11 +08:00
Stephen Chung
fbfb7677c1 Add is_def_var and is_def_fn. 2020-10-03 16:25:58 +08:00
Stephen Chung
eec3f4e1bf Module:;eval_ast_as_new defaults to merging namespaces. 2020-10-03 11:42:54 +08:00
Stephen Chung
a72f70846f Make merged namespace more efficient. 2020-10-02 23:14:33 +08:00
Stephen Chung
08ca90a136 Use ImmutableString for import alias. 2020-10-02 18:52:18 +08:00
Stephen Chung
038b058e63 Use shared AST module. 2020-10-02 16:21:18 +08:00
Stephen Chung
d2c94ba07c Add more module tests. 2020-10-02 14:55:02 +08:00
Stephen Chung
e8d5f78f88 Simplify code. 2020-10-01 23:31:27 +08:00
Stephen Chung
2290c72de1 Fix tests. 2020-09-30 23:27:41 +08:00
Stephen Chung
a04ed02b54 Simplify macro system and update doc comments. 2020-09-30 22:55:40 +08:00
Stephen Chung
e526b53b42 No need to merge module if empty. 2020-09-30 09:57:21 +08:00
Stephen Chung
c7dfbd48a6 Restore call_fn_dynamic. 2020-09-29 18:37:00 +08:00
Stephen Chung
69054f1b69 Change lib to &Module. 2020-09-29 18:17:41 +08:00
Stephen Chung
ea78fa2b27 Change SharedPluginFunction to Shared<FnPlugin> 2020-09-29 13:06:48 +08:00
Stephen Chung
2123b0a279 Module::eval_ast_as_new will merge global and module namespaces if private_namespace is true. 2020-09-28 18:53:03 +08:00
Stephen Chung
5e43f2e5a4 Better error handling messages. 2020-09-28 11:19:49 +08:00
Stephen Chung
a1cf852bb9 Merge in function pointer arguments. 2020-09-28 11:01:25 +08:00
Stephen Chung
f92d992165 Handle timestamps in serde. 2020-09-27 22:34:07 +08:00
Stephen Chung
e1ce67adc2 Add TimeStamp variant. 2020-09-27 22:15:35 +08:00
Stephen Chung
516f7b60d9 Fix no_std build. 2020-09-27 18:47:20 +08:00
Stephen Chung
a2694114d1 Better panic messages. 2020-09-27 11:14:50 +08:00
Stephen Chung
726b030616 Implement +/- operators for timestamp. 2020-09-26 19:45:33 +08:00
Stephen Chung
e0483f2a50 Implement Dynamic::From<Instant> 2020-09-26 19:41:04 +08:00
Stephen Chung
03dce86328 Support Dynamic as function default return value. 2020-09-26 16:27:38 +08:00
Stephen Chung
e62d1cd3ff Better error message for setter. 2020-09-26 12:34:06 +08:00
Stephen Chung
4efe6b90e7 Add string::split(). 2020-09-25 23:02:49 +08:00
Stephen Chung
da9aa60256 Wrap file module functions in ErrorInModule. 2020-09-25 20:24:03 +08:00
Stephen Chung
39bbff878c Fix doc test. 2020-09-25 20:00:49 +08:00
Stephen Chung
f406fc0ac0 Fix function calls. 2020-09-25 19:07:24 +08:00
Stephen Chung
599fe846cb Add complete_namespace to Module::eval_ast_as_new. 2020-09-25 18:07:39 +08:00
Stephen Chung
93f53fa417 Refactor module.rs into files structure. 2020-09-25 10:59:21 +08:00
Stephen Chung
e637bfa51d Change pure to independent. 2020-09-25 09:39:18 +08:00
Stephen Chung
6a53c446d3 Fix no_function build. 2020-09-24 23:32:54 +08:00
Stephen Chung
c4ec93080e New FileModuleResolver. 2020-09-24 22:50:28 +08:00
Stephen Chung
b8aeaa84de Add functions to iterate script function definitions. 2020-09-24 16:10:25 +08:00
Stephen Chung
9fcbda1ba4 Add reverse function to arrays. 2020-09-24 10:51:21 +08:00
Stephen Chung
d91d983c74 Enable dots on numbers to parse as method calls. 2020-09-23 22:48:28 +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
02f37870e5 Better position of string literal errors. 2020-09-22 19:18:06 +08:00
Stephen Chung
41a16c9cf7 Use modules. 2020-09-22 19:17:50 +08:00
Stephen Chung
e7566da7d2 Fix no_std build. 2020-09-22 18:06:36 +08:00
Stephen Chung
594dcc3a06 Disallow registering indexers for arrays, maps and strings. 2020-09-22 17:57:56 +08:00
Stephen Chung
283495a02f Setters should have no return value. 2020-09-22 12:14:26 +08:00
Stephen Chung
8095ebc9e4 Remove unused imports. 2020-09-21 18:00:46 +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
a49b58002a Fix doc tests. 2020-09-20 15:55:11 +08:00
Stephen Chung
c7a675e18a Fix no_object builds. 2020-09-20 14:52:38 +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
5a7a0f11ae Fix doc test. 2020-09-20 10:51:37 +08:00
Stephen Chung
cfe28c9282 Remove Position parameter from plugin call function. 2020-09-20 10:51:37 +08:00
Stephen Chung
3341f40fd2 Refine docs. 2020-09-20 10:50:58 +08:00
Stephen Chung
39546b7053 Enable &str and String parameters in module functions. 2020-09-19 18:12:23 +08: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
db59aed14e Fix bug in optimizer for if statements with empty true blocks. 2020-09-14 22:24:55 +08:00
Stephen Chung
6c69a40083 Allow scripted functions in packages. 2020-09-11 22:32:59 +08:00
Stephen Chung
a75aba8a85 Rename calc_fn_spec to calc_fn_hash. 2020-09-11 22:24:44 +08:00
Stephen Chung
d1ab9a2848 Fix bug on unary function hashes. 2020-09-11 22:09:09 +08:00
Stephen Chung
fed65676a2 cargo fmt. 2020-09-10 17:42:34 +08: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
1dacf21a84 Fix no_std builds by pulling in num-traits. 2020-08-23 18:28:55 +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
4fff90d19b Merge branch 'master' into plugins 2020-08-23 17:54:02 +08:00
Stephen Chung
7cd345b128 Fix bug in closure capture for no_object. 2020-08-23 17:46:39 +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
196e145c96 Derive standard traits for Limits. 2020-08-23 16:29:32 +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
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
0b04d05afe Do not parse closures when allow_anonymous_fn is false. 2020-08-22 11:08:27 +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
6e54b22b31 Merge branch 'master' into plugins_dev 2020-08-20 17:02:57 +08:00
Stephen Chung
24610688d3 Fix no_std build. 2020-08-20 17:02:25 +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
980aba77a9 Use &mut. 2020-08-19 12:53:33 +08:00
Stephen Chung
c55b0d7883 Fix bug with plugin method call detection. 2020-08-19 12:50:23 +08:00
Stephen Chung
6a3e123306 Use split_first_mut instead of split_at_mut. 2020-08-18 23:19:26 +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
d024f912e0 Merge branch 'master' into plugins_dev 2020-08-18 22:02:44 +08:00
Stephen Chung
e3f2157c6a Treat leading #{ in Engine::parse_json. 2020-08-18 22:01:13 +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
7fcbfcc7fd codegen: explicit import of format! macro 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
489b1ca00e Add Module::combine. 2020-08-15 00:08:00 +08: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
2495b367e5 Merge branch 'plugins' of https://github.com/schungx/rhai into plugins 2020-08-14 13:40:33 +08:00
J Henry Waugh
b27ebb318d Rearrange imports to support no_std 2020-08-13 23:04:30 -05: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
fdcaa90cd9 Clean up plugin module for no_module macro support 2020-08-12 23:57:57 -05:00
J Henry Waugh
28572544d8 Split register export macro, add Engine support 2020-08-12 23:36:35 -05:00
J Henry Waugh
59e3ca0e79 Remove Dynamic::downcast_clone 2020-08-11 19:09:49 -05:00
Stephen Chung
a5b4d61dff Fix docs. 2020-08-11 13:46:09 +08:00
Stephen Chung
564d3bc339 Add more closure tests. 2020-08-09 22:12:50 +08:00
Ilya Lakhin
39ee74112c no-closure feature issue fixed 2020-08-09 18:42:33 +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
45d021c7ef Function names capturing as external variables bug 2020-08-08 17:55:58 +07:00
Stephen Chung
f68c5a699d Fix sync feature. 2020-08-08 17:04:21 +08:00
Stephen Chung
fbad20eb0d Merge branch 'master' into plugins 2020-08-08 16:26:52 +08:00
Stephen Chung
5a1a141ce3 Improve shared value treatment. 2020-08-08 16:24:10 +08:00
Stephen Chung
7b258ac410 Add more inlining. 2020-08-08 11:46:30 +08:00
Stephen Chung
5e6d5e8e80 Expand getter/setter/indexer API. 2020-08-07 11:10:38 +08:00
J Henry Waugh
75bcbb74eb Fix unrelated CI failure for features 2020-08-06 19:41:19 -05:00
J Henry Waugh
be315aebaf Fix breakage due to write_lock() 2020-08-06 18:36:19 -05:00
Stephen Chung
6475e4e20e Merge branch 'master' into plugins 2020-08-06 23:17:20 +08:00
Stephen Chung
b604ea3e93 Fix serde doc test. 2020-08-06 22:47:10 +08:00
Stephen Chung
130bcfe293 Fix serde. 2020-08-06 21:19:54 +08:00
Stephen Chung
4465a44673 Fix typos. 2020-08-06 10:31:32 +08:00
Stephen Chung
26c5b10ef7 Merge branch 'master' into plugins 2020-08-06 10:31:15 +08:00
Stephen Chung
2f395492de Simply error code. 2020-08-06 10:17:32 +08:00
Stephen Chung
ffe52bf437 Allow omitting the alias in import statement. 2020-08-05 23:23:53 +08:00
Stephen Chung
ae11dbbefe Fix feature flags. 2020-08-05 22:53:01 +08:00
Stephen Chung
5ea08d2b50 Bump version. 2020-08-05 17:55:36 +08:00
Stephen Chung
8a0d0e3e20 Unbox error return for Engine::register_custom_syntax. 2020-08-05 10:00:20 +08:00
Stephen Chung
9f302d4ef5 Update docs and tests. 2020-08-04 18:39:24 +08:00
Stephen Chung
b0ab6e95f5 Fix currying in map closure calls. 2020-08-04 18:38:33 +08:00
Stephen Chung
24346b9728 Merge branch 'master' into plugins 2020-08-04 16:51:22 +08:00
Stephen Chung
4878a69503 Add docs for closures. 2020-08-04 16:27:55 +08:00
Stephen Chung
3d6c83c6d8 Fix serde builds. 2020-08-04 09:47:48 +08:00
Stephen Chung
4a7bf893e6 Refine flatten clone for scope. 2020-08-03 23:13:09 +08:00
Stephen Chung
2aa08c0dd9 get_constant_value for FnPointer. 2020-08-03 23:12:42 +08:00
Stephen Chung
3b6d35368f Handle shared for loop variable. 2020-08-03 23:11:38 +08:00
Stephen Chung
abe74e7f44 Handle Dynamic::from(FnPtr). 2020-08-03 23:11:24 +08:00
Stephen Chung
e1a70fe958 Add FnPtr to standard packages. 2020-08-03 23:11:08 +08:00
Stephen Chung
3fc35c4f87 Merge from master. 2020-08-03 13:28:29 +08:00
Stephen Chung
dddd8133df Set unshared value in let/const statement. 2020-08-03 12:38:56 +08:00
Stephen Chung
4079164bfd Implement closures. 2020-08-03 12:10:20 +08:00
J Henry Waugh
3136188801 Improve proc macro hygiene 2020-08-02 19:27:35 -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
747c0345f2 Do not convert a function call into a method call if the object is shared. 2020-08-02 13:51:07 +08:00
Stephen Chung
b86c87253b Prevent data races. 2020-08-02 13:33:51 +08:00
J Henry Waugh
d01203cb5d New Procedural Macros Crate v0.1 2020-08-01 11:52:32 -05:00
Stephen Chung
1daf91df30 Avoid storing shared value inside shared value. 2020-08-01 22:28:17 +08:00
Stephen Chung
cc53b21731 Avoid hard-coding variable type for shared. 2020-08-01 22:28:13 +08:00
Stephen Chung
af2f8acb5d Refine indexer set. 2020-08-01 12:21:15 +08:00
Stephen Chung
a2858e0fd3 Refine feature gates 2020-08-01 12:19:27 +08:00
Stephen Chung
5873bccd50 Fix no_index and no_object. 2020-07-31 23:37:30 +08:00
Stephen Chung
60891e694f Streamline code and feature gates. 2020-07-31 22:30:23 +08:00
Stephen Chung
8d0623d07f Add is_shared function. 2020-07-31 18:43:34 +08:00
Stephen Chung
0295e109ad Fix features 2020-07-31 18:06:01 +08:00
Stephen Chung
d563b878aa Fix no_std builds. 2020-07-31 17:26:49 +08:00
Stephen Chung
df8587ac91 Make sure both shared and take can be called in both styles. 2020-07-31 17:06:40 +08:00
Stephen Chung
e70e0ff4e2 Fixup. 2020-07-31 16:39:38 +08:00
Stephen Chung
871fcb38be Minor style changes and make sure no_shared works on all. 2020-07-31 16:03:08 +08:00
Ilya Lakhin
5d1f5cc2b4 Dynamic::read renamed to Dynamic::clone_inner_data 2020-07-31 13:10:05 +07: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
Stephen Chung
49392d57d7 Fix no_std feature. 2020-07-31 12:40:16 +08:00
Stephen Chung
cb005506e2 Simplify function calling. 2020-07-31 12:11:16 +08: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
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
a7ff207636 Use Scope::flatten_clone for capturing. 2020-07-30 23:29:30 +08: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
e505a06839 Add comparison operators to ImmutableString. 2020-07-30 13:28:25 +08:00
Stephen Chung
691e04292f Put externals in ScriptFnDef. 2020-07-30 13:28:06 +08:00
J Henry Waugh
5785fa6b74 Fix Plugins API for no_std 2020-07-29 16:57:13 -05:00
Stephen Chung
6e663eecb4 Fix fn_call. 2020-07-29 23:39:32 +08:00
Stephen Chung
d63f926701 Merge branch 'master' into plugins 2020-07-29 23:37:51 +08:00
Stephen Chung
721c578407 Use HashMap for externals. 2020-07-29 23:34:48 +08:00
Stephen Chung
1465ba2315 Refactor auto-currying. 2020-07-29 22:43:50 +08:00
Stephen Chung
a5a3bbd399
Merge pull request #19 from Eliah-Lakhin/closures
Autocurry feature
2020-07-29 21:24:43 +08:00
Ilya Lakhin
8fc16b40e6 Code style issues fixed 2020-07-29 20:17:18 +07:00
Ilya Lakhin
a856a8bbcb max_expr_depth bug fix 2020-07-29 19:04:33 +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
afbcd0fc0b Replace StaticVec with SmallVec. 2020-07-29 16:10:06 +08:00
Stephen Chung
4510d3a659 Merge branch 'master' into plugins 2020-07-29 14:17:40 +08: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
288e0a4d14 add unicode_xid, test 2020-07-29 08:25:37 +09:00
ekicyou
9b0375b870 add unicode-xid 2020-07-29 07:03:21 +09:00
ekicyou
79022b1858 refactoring 2020-07-29 06:54:23 +09:00
ekicyou
c6d5bd000d move is_valid_identifier 2020-07-29 06:24:41 +09:00
ekicyou
56a8120d75 add get_identifier 2020-07-29 05:26:57 +09:00
Stephen Chung
411539f3be Minimize usage of downcast_ref. 2020-07-28 19:11:46 +08:00
Stephen Chung
37ea24afe9 Improve docs. 2020-07-28 19:11:37 +08:00
Stephen Chung
0c703c0361 Merge branch 'master' into plugins 2020-07-28 11:08:57 +08:00
Stephen Chung
b63ff56e09 Make sure we keep the starting position of each statement (for future uses). 2020-07-28 10:26:20 +08:00
Stephen Chung
b70fd35f4a Revise docs. 2020-07-28 10:25:57 +08:00
Stephen Chung
f05cd1fdf3 Add shared and sync to reserved keywords. 2020-07-28 10:25:26 +08: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
4bda306815 Merge branch 'master' into plugins 2020-07-26 22:38:35 +08:00
Stephen Chung
2dd4d9bcf9 Avoid warnings with only_i32. 2020-07-26 22:37:33 +08:00
Stephen Chung
ec5082c328 Better handling of reserved keywords. 2020-07-26 22:25:30 +08:00
Stephen Chung
ce20248792 Add more reserved keywords. 2020-07-26 21:57:30 +08:00
Stephen Chung
878ba0b794 Remove register_raw_fn_XXX API's. 2020-07-26 18:17:55 +08:00
Stephen Chung
3d36a25c90 Add back PluginFunction. 2020-07-26 16:10:38 +08:00
Stephen Chung
4691f7860c Merge branch 'master' into plugins 2020-07-26 16:09:27 +08:00
Stephen Chung
6b600704a3 Avoid warnings. 2020-07-26 15:53:22 +08:00
Stephen Chung
25ee4b4f82 Merge branch 'master' into plugins 2020-07-26 14:07:29 +08:00
Stephen Chung
e7af008d74 Avoid warnings. 2020-07-26 13:51:09 +08:00
Stephen Chung
8e33cbfe34 Merge branch 'master' into plugins 2020-07-26 10:05:56 +08:00
Stephen Chung
353df6bea1 Avoid warnings in standard build. 2020-07-26 10:03:59 +08:00
Stephen Chung
d278f3725c Merge branch 'master' into plugins 2020-07-25 16:16:09 +08:00
Stephen Chung
9d900a6722 Remove _Private. 2020-07-25 16:09:13 +08:00
Stephen Chung
94c2f64473 Merge branch 'master' of https://github.com/jonathandturner/rhai 2020-07-25 16:05:11 +08:00
Stephen Chung
c825de6f77 Mark internal data structures with [INTERNALS]. 2020-07-25 16:05:08 +08:00
Stephen Chung
22169582bb
Merge pull request #196 from udoprog/tokenize-numeric-literal
Avoid scanning over slices to validate numerical literals
2020-07-25 16:03:17 +08:00
Stephen Chung
6a96be3382 Merge branch 'master' of https://github.com/jonathandturner/rhai 2020-07-25 15:58:37 +08:00
John-John Tedro
1aab77df1c Avoid scanning over slices to validate numerical literals 2020-07-25 09:52:54 +02:00
Stephen Chung
284e58e8a1 Improve documentation on internal types. 2020-07-25 15:52:27 +08:00
Stephen Chung
252b6cb8f3
Merge pull request #197 from udoprog/seal-variant
Seal Variant trait to prevent downstream implementations
2020-07-25 15:50:51 +08:00
Stephen Chung
8109e26538
Merge pull request #198 from udoprog/unbreak-no-std
Unbreak no std
2020-07-25 15:39:25 +08:00
John-John Tedro
261273bac3 Unbreak no_std 2020-07-25 09:21:30 +02:00
John-John Tedro
e7aaec8e3a Seal Variant trait to prevent downstream implementations 2020-07-25 09:20:19 +02:00
John-John Tedro
d920613d57 Avoid shadowing call errors in get_indexed_mut 2020-07-25 08:13:11 +02:00
Stephen Chung
a58207aaa9 Change ScriptFnDef to use ImmutableString. 2020-07-25 14:06:13 +08:00
Stephen Chung
463d669ab5 Avoid shadowing indexer errors. 2020-07-25 09:55:33 +08:00
Stephen Chung
af41850da0 Merge branch 'master' of https://github.com/jonathandturner/rhai 2020-07-25 09:39:31 +08:00
John-John Tedro
ea22591e36 Support u128/i128 types during serialization 2020-07-24 19:08:59 +02:00
Stephen Chung
2b0aacde23 Fix Module::set_indexer_set_fn. 2020-07-24 23:16:54 +08:00
John-John Tedro
96aa5ed39e set_indexer_set_fn to support setting generic value 2020-07-24 16:20:47 +02:00
Stephen Chung
1c58bdb2a1 Merge branch 'master' into plugins 2020-07-23 18:46:25 +08:00
Stephen Chung
bff266d4e1 Move function calling to separate source file. 2020-07-23 18:40:42 +08:00
Stephen Chung
a2ddd2175e Merge branch 'master' into plugins 2020-07-23 16:12:09 +08:00
Stephen Chung
1a48a2d8ba Refine currying docs. 2020-07-23 15:49:09 +08:00
Stephen Chung
dc7f847a8e Merge branch 'master' of https://github.com/schungx/rhai 2020-07-23 10:13:10 +08:00
Stephen Chung
b913b521dc Improve currying. 2020-07-23 10:12:51 +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
e103c8e66c Refine string docs. 2020-07-22 21:32:56 +08:00
Stephen Chung
abf66850f6 Enable custom syntax without internals. 2020-07-22 17:05:13 +08:00
Stephen Chung
d7d9f42802 Merge branch 'master' into plugins 2020-07-22 13:33:24 +08:00
Stephen Chung
35374f5b3b Simplify custom syntax. 2020-07-22 13:08:51 +08:00
Stephen Chung
187824e684 Improve inlining of Dynamic methods. 2020-07-22 13:05:24 +08:00
Stephen Chung
61a1355c59 Add no-std example. 2020-07-21 22:32:24 +08:00
Stephen Chung
c36e459feb Merge branch 'master' into plugins 2020-07-21 21:09:04 +08:00
Stephen Chung
e6c3f8134d Avoid copying property name for map property access. 2020-07-21 20:59:12 +08:00
Stephen Chung
ec3074106e Display type name when printing Dynamic values that have no built-in format. 2020-07-21 20:58:53 +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
cf36dc5a57 Support for anonymous functions. 2020-07-19 17:14:55 +08:00
Stephen Chung
2f33edb762 FIx no_std. 2020-07-19 09:10:22 +08:00
Stephen Chung
3ae7cf4018 Improve treatment of disabled symbols and custom symbols. 2020-07-17 14:50:23 +08:00
Stephen Chung
a7f564fe37 Merge branch 'master' into plugins 2020-07-17 11:44: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
67f8dcf032 Merge branch 'master' into plugins 2020-07-12 11:48:55 +08:00
Stephen Chung
8449f8c55e Make API chainable. 2020-07-12 11:46:53 +08:00
Stephen Chung
e57c15c3e2 Merge branch 'master' into plugins 2020-07-11 15:11:20 +08:00
Stephen Chung
2a8d63fd5f Refine custom syntax. 2020-07-11 15:09:17 +08:00
Stephen Chung
d95761d064 Merge branch 'master' into plugins 2020-07-10 22:06:02 +08:00
Stephen Chung
ebffbf0f98 Refine docs and add custom syntax. 2020-07-10 22:01:47 +08:00
Stephen Chung
7436fc1c05 Fix bug in tokenizing reserved symbols. 2020-07-10 11:41:56 +08:00
Stephen Chung
f36b4a69ae FIXED - method calls inside dot chain. 2020-07-09 22:21:07 +08:00
Stephen Chung
99164ebceb Add custom syntax. 2020-07-09 19:54:28 +08:00
Stephen Chung
e33760a7d4 Fix bug in StaticVec. 2020-07-09 13:27:21 +08:00
Stephen Chung
72c034ccd1 Merge branch 'master' into plugins 2020-07-08 13:50:15 +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
d92a514f48 Add reserved symbols. 2020-07-08 12:09:18 +08:00
Stephen Chung
236ba40784 Add ModuleResolversCollection. 2020-07-07 23:44:23 +08:00
Stephen Chung
ff6d205c1d Make Modules::set_raw_fn public. 2020-07-07 22:59:23 +08:00
Stephen Chung
b71d9acdc2 Merge branch 'master' into plugins 2020-07-06 23:14:44 +08:00
Stephen Chung
2b3f10f2c5 Define functions anywhere during parsing. 2020-07-06 22:57:50 +08:00
Stephen Chung
3b7a7426cf Merge branch 'master' into plugins 2020-07-06 21:52:47 +08:00
Stephen Chung
f5ff759fcc Merge branch 'master' of https://github.com/schungx/rhai 2020-07-06 21:31:03 +08:00
Stephen Chung
d0711394f0 Expose FnPtr and move name checking into 2020-07-06 21:30:35 +08:00
Alvin Wong
4a3a32dc3a Fix serializing externally-tagged enum representations 2020-07-06 21:11:41 +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
Alvin Wong
8bc1b25edd Fix only_i32 build 2020-07-06 15:30:55 +08:00
Stephen Chung
fbe15d25b6 Merge branch 'master' into plugins 2020-07-06 13:11:46 +08:00
Stephen Chung
3e45d5d9a5 Refine docs and API. 2020-07-06 13:01:57 +08:00
Stephen Chung
d9fe6a1980 Add boolean xor operator and readjust % precedence. 2020-07-06 12:24:28 +08:00
Stephen Chung
05a4b466d1 New register_raw_fn_n shortcuts. 2020-07-06 12:06:57 +08:00
Stephen Chung
ea86888638 Add new &Module parameter to native functions. 2020-07-06 12:04:02 +08:00
Stephen Chung
495d202af4 Add new AST API. 2020-07-06 10:02:54 +08:00
Stephen Chung
a27f89b524 Add new register_fn_raw API. 2020-07-05 23:08:44 +08:00
Stephen Chung
4052ad3df1 Assignments return () and no compound assignments. 2020-07-05 23:07:02 +08:00
Stephen Chung
ef2d28d423 Merge branch 'master' into plugins 2020-07-05 18:12:35 +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
368b4a480b Reformat code. 2020-07-04 22:53:00 +08:00
Stephen Chung
d626bf9f5b Refine no_function feature. 2020-07-04 16:21:15 +08:00
Stephen Chung
b3b3a083b8 Add docs on serde feature. 2020-07-04 15:39:40 +08:00
Stephen Chung
2b2deba5e0 Remove serde from default feature. 2020-07-03 22:48:33 +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
bdc7b69266 Remove feature gate for Instant. 2020-07-02 22:16:09 +08:00
Stephen Chung
9c9f550200 Minor refactor. 2020-07-02 21:46:08 +08:00
Stephen Chung
e14cfbd9d7 Restore plugins code. 2020-07-02 12:47:24 +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
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
063851a6ad Merge branch 'tokenizer' 2020-06-28 15:51:37 +08:00
Stephen Chung
527d41d0e3 No modules in scope. 2020-06-28 15:49:24 +08:00
Stephen Chung
aac04a5e53 Remove modules from Scope and use separate stack. 2020-06-27 23:56:24 +08:00
Stephen Chung
549ef6bf7f Add oop.rhai script. 2020-06-27 17:34:39 +08:00
Stephen Chung
04d2fb5001 Fix no_std. 2020-06-26 23:24:47 +08:00
Stephen Chung
ab347fa14e Add Module::iter_script_fn. 2020-06-26 22:33:27 +08:00
Stephen Chung
74c82bbd9c Refactor. 2020-06-26 22:03:21 +08:00
Stephen Chung
8c632ed928 Remove println. 2020-06-26 19:54:12 +08:00
Stephen Chung
31eaf321d0 Refactor tokenizer. 2020-06-26 19:44:50 +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
ab60c2e1d2 Add scope command to repl. 2020-06-24 22:45:34 +08:00
Stephen Chung
d5eb2887ff Refactor Dynamic. 2020-06-23 19:24:26 +08:00
Stephen Chung
3b1719e0bc Introduce ChainType to prepare for more chaining operators. 2020-06-23 17:36:07 +08:00
Stephen Chung
54c5c139f9 Add internals feature. 2020-06-23 10:43:24 +08:00
Stephen Chung
a9b168ba99 Refine docs. 2020-06-22 22:02:49 +08:00
Stephen Chung
7cc1a3f5dc Change Map keys to ImmutableString to facilitate fast keys(). 2020-06-21 16:37:05 +08:00
Stephen Chung
ffe0c559be Remove scope parameter from ModuleResolver::resolve. 2020-06-20 21:49:45 +08:00
Stephen Chung
478bc7ab30 Change README to point to the Rhai book. 2020-06-20 12:23:32 +08:00
Stephen Chung
cc57a2344e Fix doc test. 2020-06-20 10:49:15 +08:00
Stephen Chung
35fa61cd4b Do not export fn_native. 2020-06-18 18:39:28 +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
84fbcb03b3 Add WASM section. 2020-06-17 15:45:11 +08:00
Stephen Chung
7f4f737ff2 Gate WASM target. 2020-06-17 09:54:17 +08:00
Stephen Chung
b6e1f652b6 Fix bug when setting character in string via a method call. 2020-06-16 23:49:11 +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
dc540755e7 Revert plugins. 2020-06-16 09:40: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
4603f8026f Add getters for Engine setting fields. 2020-06-15 23:20:50 +08:00
Stephen Chung
fcb5059570 Do not check for data oversize when unchecked. 2020-06-15 22:04:14 +08:00
Stephen Chung
9bd2d4c981 Merge branch 'master' into plugins 2020-06-15 21:52:15 +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
31d2fa410b Streamline code. 2020-06-14 22:44:59 +08:00
Stephen Chung
f26c12b8ea Better error messages for unrecognized tokens. 2020-06-14 19:13:11 +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
27ad7bbebe Merge branch 'master' into plugins 2020-06-14 00:14:52 +08:00
Stephen Chung
22d30c95c9 Add maximum data size limits. 2020-06-14 00:09:16 +08:00
Stephen Chung
f004575590 Fix namespace error in no_std. 2020-06-13 17:03:49 +08:00
Stephen Chung
b24fdd7a4d Change call_fn_dynamic to accept any type that is IntoIterator<Item=Dynamic>. 2020-06-12 19:54:55 +08:00
Stephen Chung
96e5a1c56d Merge branch 'master' into plugins 2020-06-12 18:04:30 +08:00
Stephen Chung
9d91349513 Refine position display in error messages. 2020-06-12 18:04:16 +08:00
Stephen Chung
6cc27eb9f4 Better error messages. 2020-06-11 23:21:39 +08:00
Stephen Chung
d92613eaf6 Fix parse positions. 2020-06-11 23:08:00 +08:00
Stephen Chung
d03f6ed983 Merge branch 'master' into plugins 2020-06-11 22:45:20 +08:00
Stephen Chung
e4cca7620f Better debug formatting for StaticVec. 2020-06-11 22:18:30 +08:00
Stephen Chung
8f55a15ab0 Collect parse settings into struct type. 2020-06-11 22:03:47 +08:00
Stephen Chung
0ac3a7d8b4 Use type alias TokenStream. 2020-06-11 18:13:33 +08:00
Stephen Chung
95f94a3348 Add strings example. 2020-06-09 12:21:21 +08:00
Stephen Chung
b4b835f80a Remove unnecessary "sync" feature gates. 2020-06-08 14:10:16 +08:00
Stephen Chung
a4cabc1ac7 Better String parameter error message. 2020-06-08 14:10:06 +08:00
Stephen Chung
d4ebb3c96d Merge branch 'master' into plugins 2020-06-08 10:26:51 +08:00
Stephen Chung
ead366aac8 Better String parameter error message. 2020-06-08 10:26:32 +08:00
Stephen Chung
5fb4b04cb0 Put type on transmute call. 2020-06-08 10:26:12 +08:00
Stephen Chung
e942ef358c Transparently convert &str to ImmutableString for register_fn. 2020-06-07 17:54:33 +08:00
Stephen Chung
6841beb351 Merge branch 'master' into plugins 2020-06-06 13:25:46 +08:00
Stephen Chung
5f40a1376a Implement index setters. 2020-06-06 13:06:00 +08:00
Stephen Chung
ea806ba100 Merge branch 'master' into plugins 2020-06-05 15:39:44 +08:00
Stephen Chung
56eb659d5a Unify all functions into CallableFunction type, remove FunctionsLib. 2020-06-05 15:14:42 +08:00
Stephen Chung
1442cc9b7a Merge branch 'master' into plugins 2020-06-03 11:15:55 +08:00
Stephen Chung
ec6e3daabb Refactor. 2020-06-03 10:44:36 +08:00
jhwgh1968
27b8f9929d Basic Implementation of Plugins and Plugin Functions 2020-06-02 21:44:28 -05:00
Stephen Chung
b8da1691d3 Consolidate callbacks. 2020-06-02 13:33:16 +08:00
Stephen Chung
b70d38e820 Avoid passing position until error. 2020-06-01 15:25:22 +08:00
Stephen Chung
a5d8ce2e49 Merge branch 'master' into plugins 2020-06-01 14:14:47 +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
8e876b0b86 Merge branch 'master' into plugins 2020-06-01 10:58:26 +08:00
Stephen Chung
cec6748ac6 Remove no_module gates to prepare for plugins. 2020-06-01 10:58:14 +08:00
Stephen Chung
c6e5f672c9 More benchmarks and examples. 2020-05-31 23:44:49 +08:00
Stephen Chung
840afe74bb Simplify eval_dot_index_chain. 2020-05-31 15:51:26 +08:00
Stephen Chung
d7d49a5196 Fix bug in chained dot/index expression. 2020-05-31 14:27:16 +08:00
Stephen Chung
76d792011f Add Engine::call_fn_dynamic. 2020-05-31 12:37:19 +08:00
Stephen Chung
5f727335a6 Add type info. 2020-05-31 12:36:42 +08:00
Stephen Chung
13c49387ef Add OptimizationLevel::is_simple 2020-05-31 12:36:31 +08:00
Stephen Chung
c9de37e8d1 Hash functions only once via custom hasher. 2020-05-31 00:02:23 +08:00
Stephen Chung
6924b62939 Merge branch 'master' into plugins 2020-05-30 13:51:54 +08:00
Stephen Chung
acd0f6b56b != defaults to true for different parameter types. 2020-05-30 13:49:40 +08:00
Stephen Chung
4c46c7e26b Register property versions of some methods. 2020-05-30 10:30:21 +08:00
Stephen Chung
666a618e40 Add register getter/setter/indexer to modules. 2020-05-30 10:28:17 +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
acd4685145 Convert function calls to method calls to use &mut first argument. 2020-05-28 23:57:09 +08:00
Stephen Chung
a9a95b3c2d Merge branch 'master' into plugins 2020-05-28 14:09:27 +08:00
Stephen Chung
e84d4a88e9 Do not check function call depth if no_function. 2020-05-28 14:08:07 +08:00
Stephen Chung
30782212e4 Add set_fn_4/mut for modules. 2020-05-28 14:07:34 +08:00
Stephen Chung
0b259d0062 Move += for ImmutableString to Engine. 2020-05-28 10:33:28 +08:00
Stephen Chung
854634afa0 Allow native overriding implementation of assignment operators. 2020-05-27 13:22:10 +08:00
Stephen Chung
24a93ef824 Add missing imports. 2020-05-26 23:05:44 +08:00
Stephen Chung
27c7cc4af7 Fix syntax error. 2020-05-26 23:05:21 +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
bbed4c6ef4 Docs. 2020-05-24 23:42:40 +08:00
Stephen Chung
fd6dad0253 Remove builtin check. 2020-05-24 23:42:16 +08:00
Stephen Chung
0374311cf6 Optimize hot path of operators calling. 2020-05-24 16:40:00 +08:00
Stephen Chung
1798d4d6a0 Fix function call optimizations. 2020-05-24 11:57:46 +08:00
Stephen Chung
d56634cac7 Complete built-in operators. 2020-05-24 00:29:06 +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
Stephen Chung
8d12dc2fc1 Add Dynamic::as_float. 2020-05-22 21:49:53 +08:00
Stephen Chung
e224550861 Move boxing of ParseError into ParseErrorType. 2020-05-22 18:28:13 +08:00
Stephen Chung
2f0ab18b70 Merge register_result_fn and register_dynamic_fn. 2020-05-22 13:09:17 +08:00
Stephen Chung
3408086240 Copy values differently. 2020-05-22 13:08:57 +08:00
Stephen Chung
800a7bf283 Remove unnecessary traits and types. 2020-05-21 17:11:01 +08:00
Stephen Chung
cd570558c3 Remove count_args macro. 2020-05-21 09:31:31 +08:00
Stephen Chung
39cd1c8413 Merge branch 'master' into plugins 2020-05-21 09:30:03 +08:00
Stephen Chung
80fcc40710 Use function pointers for iterators. 2020-05-20 19:27:23 +08:00
Stephen Chung
c98633dd2b Add EvalPackage. 2020-05-20 11:12:22 +08:00
Stephen Chung
5db1fd3712 Do not optimize eval_expression scripts. 2020-05-20 00:06:19 +08:00
Stephen Chung
4a1fd66b9f Reduce Rc/Arc wrapping for functions. 2020-05-19 22:25:57 +08:00
Stephen Chung
ab76a69b12 Avoid repeating empty TypeId's when calculating hash. 2020-05-19 20:07:51 +08:00
Stephen Chung
3295060dba Unify all functions under CallableFunction type. 2020-05-19 19:03:06 +08:00
Stephen Chung
a22f338b03 Back out NativeCallable trait. 2020-05-19 10:13:37 +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
f4a528a88a Add release notes. 2020-05-18 09:36:34 +08:00
Stephen Chung
8b5550eeb6 Complete StaticVec implementation. 2020-05-17 22:19:49 +08:00
Stephen Chung
a2c50879fe Fix dropping issues with StaticVec and use it everywhere. 2020-05-17 00:24:07 +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
5d5ceb4049 Consolidate all unsafe code under one single file. 2020-05-14 18:27:22 +08:00
Stephen Chung
5c61827c7c Force-cast local variable names when pushing into scope. 2020-05-14 11:21:56 +08:00
Stephen Chung
cabceb7498 Better handling of errors during function calls. 2020-05-13 21:58:38 +08:00
Stephen Chung
9d8d074940 Consistent naming of methods. 2020-05-13 20:22:05 +08:00
Stephen Chung
5a02548ebc Allocate packages with higher functions capacity. 2020-05-13 19:39:34 +08:00
Stephen Chung
30e5e2f034 Use modules to implement packages. 2020-05-13 19:21:42 +08:00
Stephen Chung
8e8816cb0c Add compile_scripts_with_scope. 2020-05-13 11:57:07 +08:00
Stephen Chung
996a54279c Pre-calculate property getter/setter function names. 2020-05-13 10:19:18 +08:00
Stephen Chung
d6fd5416b0 Add replace function for characters 2020-05-12 23:30:55 +08:00
Stephen Chung
ec67879759 Derive more standard traits. 2020-05-12 18:48:25 +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
33c9be7efc Reformat. 2020-05-11 23:48:50 +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
4a8710a4a9 Create NativeCallable trait. 2020-05-11 13:36:50 +08:00
Stephen Chung
314ec5e4d2 Remove checks for number of arguments. 2020-05-11 10:29:33 +08:00
Stephen Chung
7ea341833c Merge branch 'master' into plugins 2020-05-10 21:59:27 +08:00
Stephen Chung
8aa0e2ceb4 Use StaticVec to avoid most allocations with function arguments. 2020-05-10 21:25:47 +08:00
Stephen Chung
974512d650 Use StaticVec to build arguments list. 2020-05-10 16:56:17 +08:00
Stephen Chung
80debbc432 Refactor. 2020-05-10 00:19:13 +08:00
Stephen Chung
95490adf0b Merge branch 'master' into plugins 2020-05-10 00:14:03 +08:00
Stephen Chung
29159b359b Refactor. 2020-05-10 00:13:49 +08:00
Stephen Chung
a7bfac21bd Reducing boxing and sizes of Expr/Stmt. 2020-05-09 21:46:38 +08:00
Stephen Chung
17e4adc049 Move hash calculation out of loop. 2020-05-09 16:21:11 +08:00
Stephen Chung
79f39bd702 Pre-calculate function call hashes. 2020-05-09 16:15:50 +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
eb52bfa28a Add export statement. 2020-05-08 16:49:24 +08:00
Stephen Chung
89d75b1b11 Fix compilation errors for no_module. 2020-05-08 14:50:48 +08:00
Stephen Chung
e0745ef069 Do not build index for multiple packages to avoid Engine creation regression. 2020-05-08 13:27:51 +08:00
Stephen Chung
e6fabe58cc Unify function hash calculations, pre-hash module-qualified function calls. 2020-05-08 11:34:56 +08:00
Stephen Chung
5f12391ec6 Use hashed lookup for module-qualified functions and variables. 2020-05-08 00:19:08 +08:00
Stephen Chung
7f6ce29447 Add try_cast to cast any type to another. 2020-05-07 19:16:50 +08:00
Stephen Chung
c607c7c428 Move Engine functions and iterators lib to Packages API. 2020-05-07 15:25:50 +08:00
Stephen Chung
f3c0609377 Catch more assignment errors at parse time. 2020-05-07 12:25:09 +08:00
Stephen Chung
fb64adca93 Move fn_lib into State, and use StaticVec for function call arguments in dotting/indexing chains. 2020-05-07 10:00:10 +08:00
Stephen Chung
8e60976cfa Merge branch 'namespace' 2020-05-07 09:32:00 +08:00
Stephen Chung
34327f6e54 Avoid copying arguments in packages. 2020-05-06 23:52:47 +08:00
Stephen Chung
ae776f1e11 Avoid recreating array in loop. 2020-05-06 23:19:55 +08:00
Stephen Chung
1934811838 Merge branch 'master' into namespace 2020-05-06 22:58:15 +08:00
Stephen Chung
898bb229e8 Merge branch 'master' into plugins 2020-05-06 22:57:16 +08:00
Stephen Chung
e966f5d49e Fix bug with let statement without expression. 2020-05-06 22:54:34 +08:00
Stephen Chung
59eaad1fdf Create module from file. 2020-05-06 22:26:52 +08:00
Stephen Chung
fa4d391e4b Merge branch 'master' into plugins 2020-05-06 20:00:02 +08:00
Stephen Chung
d75a8bc6cd Make sure all features compile correctly. 2020-05-06 19:45:17 +08:00
Stephen Chung
88fec57394 Make module_resolver optional and remove NullModuleResolver. 2020-05-06 16:09:44 +08:00
Stephen Chung
c9571d375a Add position to script error. 2020-05-06 00:09:04 +08:00
Stephen Chung
82e1af7acd Implement module resolvers. 2020-05-05 23:57:25 +08:00
Stephen Chung
87e0e783bc Display timestamp. 2020-05-05 20:54:56 +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
c03b162b7e Refactor code base and split into more module files. 2020-05-05 12:24:13 +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
2bdd174f16 Add import statement. 2020-05-04 19:36:58 +08:00
Stephen Chung
b94fa31e21 Merge branch 'master' into namespace 2020-05-04 18:06:39 +08:00
Stephen Chung
798e1df298 Do not error when a property is read-only. 2020-05-04 18:06:09 +08:00
Stephen Chung
ead9716f6d Add namespacing syntax. 2020-05-04 17:43:54 +08:00
Stephen Chung
4bf07182dc Merge branch 'namespace' of https://github.com/schungx/rhai into namespace 2020-05-04 10:42:57 +08:00
Stephen Chung
7da9d265d3 Avoid copying parameters for function calls. 2020-05-04 10:41:58 +08:00
jhwgh1968
7011e4068f Start on namespaces 2020-05-03 12:19:01 -05:00
Stephen Chung
3d05cc96cd Remove downcast_XXX from Variant. 2020-05-03 22:17:28 +08:00
Stephen Chung
d83b829810 Avoid copying arguments for function calls. 2020-05-03 16:54:24 +08:00
Stephen Chung
3f9c4c32da Merge branch 'master' into plugins 2020-05-02 11:57:45 +08:00
Stephen Chung
fc99b981a1 Fix panic when string character index is OOB. 2020-05-01 23:39:55 +08:00
Stephen Chung
c7c7fe3dfc Reduce size of Expr and Stmt by Boxing strings. 2020-05-01 17:32:39 +08:00
Stephen Chung
5c5e1db61e Cleanup code. 2020-05-01 10:17:19 +08:00
Stephen Chung
4f91e7fbcf Avoid copying in Dynamic. 2020-04-30 22:52:36 +08:00
Stephen Chung
10756cdaf2 Merge branch 'master' into plugins 2020-04-29 16:33:47 +08:00
Stephen Chung
21c3edb31e Streamline. 2020-04-29 16:11:54 +08:00
Stephen Chung
304c658f89 Use scope offset for variable access. 2020-04-28 23:05:03 +08:00
Stephen Chung
9ad9dd52ab Reduce unnecessary Cow's in Expr. 2020-04-28 19:39:36 +08:00
Stephen Chung
6351c07bc6 Fix compiling for all features. 2020-04-28 19:39:28 +08:00
Stephen Chung
ec036e4039 Merge branch 'master' into plugins 2020-04-27 22:52:37 +08:00
Stephen Chung
41366d08fe Fix tests and packages for all features. 2020-04-27 22:52:20 +08:00
Stephen Chung
d3a97dc86b Remove EntryRef from Scope. 2020-04-27 22:49:09 +08:00
Stephen Chung
d043300ae2 Reduce unnecessary Option's. 2020-04-27 21:28:31 +08:00
Stephen Chung
c2bb1f48c2 Reduce size of scope entry. 2020-04-27 21:14:34 +08:00
Stephen Chung
43fdf3f962 FunctionsLib always exist. 2020-04-27 20:43:55 +08:00
Stephen Chung
b3e4659790 Encapsulate index values into StaticVec type. 2020-04-27 20:25:20 +08:00
Stephen Chung
5afeba6fd1 No need to return value for Scope::get. 2020-04-27 11:24:58 +08:00
Stephen Chung
07c5abcc02 Remove RefCell in Scope. 2020-04-27 09:36:31 +08:00
Stephen Chung
ce121ed6af Add comments and minor refactor. 2020-04-26 21:48:49 +08:00
Stephen Chung
f5c7d7cd0d Reduce memory footprint of Target. 2020-04-26 19:37:32 +08:00
Stephen Chung
33d3e34908 Deep linking for dot/index chains. 2020-04-26 18:04:07 +08:00
Stephen Chung
5da9bc0f98
Merge pull request #6 from schungx/master
Avoid copying iterator sources.
2020-04-26 17:03:28 +08:00
jhwgh1968
e59f6939f7 Added basic Plugin trait and test 2020-04-25 19:15:06 -05:00
Stephen Chung
9998cf8890 Avoid copying iterator sources. 2020-04-24 22:54:56 +08:00
Stephen Chung
3cb3dc8e4f Fix shift function. 2020-04-24 20:05:34 +08:00
Stephen Chung
fb8459d4de Remove unnecessary usings. 2020-04-24 20:05:28 +08:00
Stephen Chung
b6d839c8a9 Fix no_std build. 2020-04-24 12:39:24 +08:00
Stephen Chung
5aaaa7be3b Simplify parsing by expecting the tokens stream will never be exhausted. 2020-04-23 13:24:24 +08:00
Stephen Chung
a4bf572d5a Filter out reg_test so it doesn't prevent compiling. 2020-04-23 13:23:25 +08:00
Stephen Chung
5b41985ccc Fix doc test in on_debug. 2020-04-23 13:22:53 +08:00
Stephen Chung
e7cc403381 Warn against eval in method-call style. 2020-04-23 13:22:28 +08:00
Stephen Chung
05bad53011 Encapsulate function calls and handle map property access more efficiently. 2020-04-23 10:21:02 +08:00
Stephen Chung
ef9d870a82 Remove builtin.rs 2020-04-22 19:28:00 +08:00
Stephen Chung
fbfea60903 Disallow assignments in expressions. 2020-04-22 17:37:06 +08:00
Stephen Chung
7df36033c4 Warn against === and !==. 2020-04-22 17:36:51 +08:00
Stephen Chung
9a1c715aad Refine package API. 2020-04-22 14:55:40 +08:00
Stephen Chung
c40c0a0bc3 Add From<Vec<T>> and From<HashMap<String, T>> for Dynamic. 2020-04-22 14:07:34 +08:00
Stephen Chung
c69647d9fd Change Dynamic::from_xxx to From<xxx> impl. 2020-04-22 12:12:13 +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
0a75479637 Refine packages plumbing. 2020-04-21 23:01:10 +08:00
Stephen Chung
e394824bf3 Fixes. 2020-04-21 00:24:25 +08:00
Stephen Chung
0306d15c04 Split core and standard libraries into packages. 2020-04-21 00:11:25 +08:00
Stephen Chung
976f3a7f6d Avoid an allocation in each function registration. 2020-04-20 12:43:34 +08:00
Stephen Chung
a1e33af5a0 Reduce size of Position by limiting resolution to 16 bits. 2020-04-20 11:08:54 +08:00
Stephen Chung
642533aef6 Extract function registration into a macro to prepare for future packages support. 2020-04-19 22:58:44 +08:00
Stephen Chung
b23fd6e20a Reshuffle code sections. 2020-04-19 18:33:02 +08:00
Stephen Chung
d3d62c7dd9 Anticipate number of functions to be registered. 2020-04-19 13:40:11 +08:00
Stephen Chung
1ebdf6dcfc Add one more level of Boxing for Dynamic::Variant to reduce size. 2020-04-18 12:36:10 +08:00
Stephen Chung
a0bc49c867 Reduce size of Dynamic by boxing large types. 2020-04-18 11:10:03 +08:00
Stephen Chung
f5fff828e8 Box errors to reduce return type footprint. 2020-04-18 00:14:33 +08:00
Stephen Chung
65d611b976 FIX: no_float errors. 2020-04-17 20:08:41 +08:00
Stephen Chung
c5f66e932b Simplify parsing by introducing an EOF token. 2020-04-17 20:01:41 +08:00
Stephen Chung
5d9a99cefc Refine postfix operators handling. 2020-04-17 19:00:52 +08:00
Stephen Chung
3a93ab8240 Make FunctionsLib a HashMap. 2020-04-16 23:58:57 +08:00
Stephen Chung
f8e9d66a0b Remove lifetime from Engine. 2020-04-16 23:31:48 +08:00
Stephen Chung
4f2350734f Avoid copying indexed value if not necessary. 2020-04-16 12:08:28 +08:00
Stephen Chung
1ace4b474c Favor matching on Union's instead of downcast::<T>, as_xxx() or is::<T>. 2020-04-16 10:24:30 +08:00
Stephen Chung
c799a4567a Remove IndexSourceType. 2020-04-16 00:05:07 +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
78cd53db09 Streamline tokens reading and reformat code for easier reading. 2020-04-15 21:41:28 +08:00
Stephen Chung
f600e59401 Fix bug with casting from float. 2020-04-13 23:31:05 +08:00
Stephen Chung
20bc66c5f6 Merge branch 'master' into enum-Dynamic 2020-04-13 21:34:20 +08:00
Stephen Chung
2e9a5f7a89 Add sub_string, crop and index_of to String. 2020-04-13 12:29:22 +08:00
Stephen Chung
5796e520ec Support Dynamic return values. 2020-04-13 10:27:08 +08:00
Stephen Chung
adaf086e90 Add i128, u128 and make timestamp functions safe. 2020-04-13 09:49:12 +08:00
Stephen Chung
5152a40e93 Change Dynamic to enum. 2020-04-12 23:00:06 +08:00
Stephen Chung
bc0d43d68f Simplify code. 2020-04-11 18:09:03 +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
81894e52cb Do not optimize single-use AST's. 2020-04-10 21:02:38 +08:00
Stephen Chung
4b2cff715e Optimize property access for object maps. 2020-04-10 21:02:13 +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
adbfceb5be Do not omit error enum variants. 2020-04-10 12:16:39 +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
660ce6cc79 Change parameter input to script. 2020-04-08 16:57:15 +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
e0bb2e5c97 Change optimize_ast to take optimization level as parameter. 2020-04-08 09:30:50 +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
32672b184b Avoid copying strings. 2020-04-06 12:29:01 +08:00
Stephen Chung
2bb195cd65 Add doc tests to Scope. 2020-04-05 23:43:40 +08:00
Stephen Chung
c4498d147d Add set_value to Scope. 2020-04-05 19:17:48 +08:00
Stephen Chung
44d6a5e466 Reduce cloning. 2020-04-05 17:44:48 +08:00
Stephen Chung
e0514a4ec0 Remove ref modifiers. 2020-04-05 12:37:07 +08:00
Stephen Chung
3f247fd695 Allow passing in custom Scope to call_fn. 2020-04-05 12:17:31 +08:00
Stephen Chung
ae9a975576 Make downcast_ref, downcast_mut and is<T> public. 2020-04-05 09:56:52 +08:00
Stephen Chung
29150faef2 Improve AST evaluation efficiency by sharing functions. 2020-04-04 22:00:44 +08:00
Stephen Chung
d1cffac420 Reduce overhead of Engine by not creating hash maps until used. 2020-04-04 13:05:20 +08:00
Stephen Chung
12a379dd57 Add stepped range function and keys/values for maps. 2020-04-04 12:20:24 +08:00
Stephen Chung
92b549b828 Add features info in docs. 2020-04-03 19:42:01 +08:00
Stephen Chung
c6216c0823 Add back doc for on_print and on_debug. 2020-04-03 17:18:30 +08:00
Stephen Chung
a79f2a209c Make Engine Send+Sync. 2020-04-03 17:17:00 +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
246a865abd Fix doc test. 2020-04-01 10:21:49 +08:00
Stephen Chung
d7ac57c060 Minor code cleanup. 2020-04-01 09:51:33 +08:00
Stephen Chung
dcf5eaf64d Add to_string to prepare for string interpolation. 2020-03-31 10:00:17 +08:00
Stephen Chung
c17dc34f86 Refine code. 2020-03-30 22:19:37 +08:00
Stephen Chung
01c0b51017 Change object maps to #{ ... } 2020-03-30 17:40:26 +08:00
Stephen Chung
0a8b324fec Merge branch 'object_maps' 2020-03-30 16:13:12 +08:00
Stephen Chung
9f3113b11c Encapsulate getters/setters. 2020-03-30 16:10:50 +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
a541a4507f Remove internal function. 2020-03-27 16:46:19 +08:00
Stephen Chung
796690f506 Detect duplicated parameters in function definitions. 2020-03-27 16:46:08 +08:00
Stephen Chung
337a96394f Limit function calls depth. 2020-03-27 14:34:01 +08:00
Stephen Chung
cc8554d095 Add merge/+ to AST. 2020-03-27 11:50:24 +08:00
Stephen Chung
56df5c49c8 Encapsulate FunctionsLib to hold script-defined functions. 2020-03-26 20:26:05 +08:00
Stephen Chung
8679982b4b Use references for function call args. 2020-03-26 10:56:28 +08:00
Stephen Chung
ea4d3fa6b8 Avoid I and O as generic parameters. 2020-03-26 10:56:18 +08:00
Stephen Chung
6308e54119 Simplify. 2020-03-26 10:55:50 +08:00
Stephen Chung
a5a161ec88 Format getter/setter function name using constants. 2020-03-26 10:55:33 +08:00
Stephen Chung
2bb2e871ab Remove regnster_fn support for first argument of &type (not used). 2020-03-25 17:21:58 +08:00
Stephen Chung
5aea997672 Refine Scope API. 2020-03-25 11:27:18 +08:00
Stephen Chung
3bc02a99ad Format comments. 2020-03-25 11:27:09 +08:00
Stephen Chung
599b81ad8a Remove ScopeEntry and VariableType from public. 2020-03-25 11:24:29 +08:00
Stephen Chung
180c4dee08 Document macros. 2020-03-25 11:24:06 +08:00
Stephen Chung
d21f66b911 Fixing lint warnings 2020-03-24 16:57:35 +08:00
Stephen Chung
3ea482567f Simplify code style. 2020-03-24 16:46:47 +08:00
Stephen Chung
156ebd7ea4 Avoid copying tokens. 2020-03-24 11:21:20 +08:00
Stephen Chung
7b06715299 FIX - Errors in no_std. 2020-03-24 11:21:09 +08:00
Stephen Chung
3677bd3651 Make Token smaller by boxing LexError. 2020-03-24 09:49:37 +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
1d98f65342 Disallow statement expressions in if and while guards to reduce code confusion. 2020-03-20 19:50:58 +08:00
Stephen Chung
ed996e71d6 Enable dot operations on constant variables. 2020-03-20 19:27:02 +08:00
Stephen Chung
283602cdd8 Do not call function when optimizing if there is a script-defined function overridding it. 2020-03-19 22:29:02 +08:00
Stephen Chung
702b2010f2 Add contains to Scope. 2020-03-19 20:55:49 +08:00
Stephen Chung
6a6c5f30de Add eval function. 2020-03-19 19:53:42 +08:00
Stephen Chung
cc8ec12691 Add more comments and examples. 2020-03-19 13:52:10 +08:00
Stephen Chung
b3efb8b264 Disallow variable names starting with _ + digit. 2020-03-18 23:09:53 +08:00
Stephen Chung
0dc51f8e59 Removee debug_msgs feature. 2020-03-18 22:03:50 +08:00
Stephen Chung
019e73bc7e Allow empty statements. 2020-03-18 18:41:18 +08:00
Stephen Chung
a9c65a962c Split no_stdlib and no_std into two features. 2020-03-18 12:04:26 +08:00
Stephen Chung
ecded729ad Finalize no_std support. 2020-03-18 10:50:51 +08:00
Stephen Chung
ca20faf170 Add code comments. 2020-03-18 10:43:59 +08:00
Stephen Chung
8efe080412 Handle break and return better. 2020-03-18 10:42:27 +08:00
Stephen Chung
d2951bfb6b Make sure return is not an error. 2020-03-18 10:40:07 +08:00
Stephen Chung
b26ca753c2 Mandatory semiclolons separating statements. 2020-03-18 10:40:07 +08:00
Stephen Chung
c3d4a1b5e9 Optimize type_of. 2020-03-18 10:40:07 +08:00
Stephen Chung
abe5365bfd Improve error messages to lists. 2020-03-18 10:40:07 +08:00
Stephen Chung
ef8d428f42 Add code comments. 2020-03-18 10:36:50 +08:00
Trangar
c8a9df0a0a Added no_std support 2020-03-17 19:26:11 +01:00
Stephen Chung
6ca39a019b Handle break and return better. 2020-03-17 17:33:37 +08:00
Stephen Chung
706e0a0c4c Make sure return is not an error. 2020-03-17 16:52:06 +08:00
Stephen Chung
2f7ca3935b Mandatory semiclolons separating statements. 2020-03-17 14:29:22 +08:00
Stephen Chung
ad2601972a Optimize type_of. 2020-03-17 10:27:43 +08:00
Stephen Chung
705fbd0c1b Improve error messages to lists. 2020-03-16 23:51:32 +08:00
Stephen Chung
08abf07f83 Add string literal indexing and functon default value to optimizer. 2020-03-16 12:41:52 +08:00
Stephen Chung
f36caa6dc3 Add optimize_full pseudo feature. 2020-03-16 12:40:42 +08:00
Stephen Chung
2c90fea764 Catch illegal variable names. 2020-03-16 12:38:01 +08:00
Stephen Chung
372321dfe3 Add full optimization level for aggressive optimizing. 2020-03-15 22:39:58 +08:00
Stephen Chung
f80e499e84 Minor code cleanup. 2020-03-14 23:41:21 +08:00
Stephen Chung
01cf777961 Use matches! macro. 2020-03-14 23:41:15 +08:00
Stephen Chung
b9e4040635 Deprecate Error::description. 2020-03-14 23:39:45 +08:00
Stephen Chung
b87dc1b281 Only map to expressions for constants. 2020-03-14 20:08:18 +08:00
Stephen Chung
dd36f3387a Fixup code to make sure all feature builds succeed. 2020-03-14 20:06:40 +08:00
Stephen Chung
973153e832 Add no_optimize feature to disable optimizations. 2020-03-14 20:06:10 +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
504fd56f1f More documentation on chained assignment. 2020-03-14 14:57:59 +08:00
Stephen Chung
360fab7760 Merge branch 'chained-assignments' 2020-03-14 14:41:48 +08:00
Stephen Chung
cb6171ebcd Merge branch 'constants' 2020-03-14 14:33:56 +08:00
Stephen Chung
b3a22d942a Allow AST optimization based on external Scope. 2020-03-14 14:30:44 +08:00
Stephen Chung
d5adee2209 Allow chained assignments. 2020-03-14 11:51:45 +08:00
Stephen Chung
e5ed2f4be5 Update api.rs 2020-03-13 23:09:45 +08:00
Stephen Chung
c7a6777b70
Merge branch 'master' into master 2020-03-13 18:27:53 +08:00
Stephen Chung
9844ae8665 Add constants. 2020-03-13 18:12:41 +08:00
Jarkko Kuukkanen
6c72e3c48b
Change filename to path for clarity 2020-03-13 12:07:51 +02:00
Jarkko Kuukkanen
8c1c37666d
Make every file evaluation use PathBuf instead of str 2020-03-13 11:53:14 +02:00
Stephen Chung
2a181e5aab FIX - fix minus/negative number conflict. 2020-03-13 16:54:00 +08:00
Stephen Chung
9bd66c7db3 Minor improvements to the optimizer. 2020-03-12 23:46:52 +08:00
Stephen Chung
55dcd2f0f4 Fix call_fn calls with only one argument. 2020-03-12 15:30:42 +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
1765d302b9 Minor refactor. 2020-03-12 12:40:28 +08:00
Stephen Chung
66edd28fb3 Do not optimize AST for dump_ast. 2020-03-12 12:39:33 +08:00
Stephen Chung
0d1a240292 Expand range function to cover all integer types. 2020-03-12 12:32:26 +08:00
Stephen Chung
a02c0cfaa0 More optimizations. 2020-03-11 23:43:10 +08:00
Stephen Chung
952932f64c Reduce cloning. 2020-03-11 23:43:04 +08:00
Stephen Chung
7c4d22d98a Add no_function feature to disable script-defined functions. 2020-03-11 13:28:12 +08:00
Stephen Chung
047f064cd1 Add dump_ast function for debugging. 2020-03-11 11:39:15 +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
cc772c6e2a Add no_float feature to disable floating-point. 2020-03-10 18:32:01 +08:00
Stephen Chung
52b5732bcb Add no_inidex feature to disable arrays and indexing. 2020-03-10 17:10:33 +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
2d80ee2f18 Refine optimizer. 2020-03-10 11:22:41 +08:00
Stephen Chung
feaad4e0da Group use of std under one root. 2020-03-10 10:07:44 +08:00
Stephen Chung
bae9946291 Allow engine to retain functions across runs. 2020-03-10 09:30:12 +08:00
Stephen Chung
55e7af7b04 Add AST optimizer. 2020-03-09 21:57:07 +08:00
Stephen Chung
c467ffd58d Comment out optimizer for successful build. 2020-03-09 21:52:43 +08:00
Stephen Chung
5b5fd162be Use ? operator in tests. 2020-03-09 21:09:53 +08:00
Stephen Chung
1ca9db4379 Fix i64.powi() to i64.pos() 2020-03-09 14:15:32 +08:00
Stephen Chung
b9d562eba4 Add standard math functions and make power functions checked. 2020-03-09 11:42:10 +08:00
Stephen Chung
e54fb54da2 Catch indexing errors at compile time. 2020-03-09 10:41:17 +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
3e7adc2e51 More comments in code. 2020-03-08 19:54:02 +08:00
Stephen Chung
daa581bac7 Add append to strings. 2020-03-08 09:19:04 +08:00
Stephen Chung
a264abffa4 Allow arbitrary number of indexing in dot getter chain. 2020-03-07 23:57:01 +08:00
Stephen Chung
eed7bef974 Allow chaining of indexing (one level) and dotting. 2020-03-07 22:50:46 +08:00
Stephen Chung
df6950f8f7 Fix arrayindexed property access. 2020-03-07 20:55:03 +08:00
Stephen Chung
d055638e83 Properly detect invalid assignment LHS at compile time. 2020-03-07 17:32:15 +08:00
Stephen Chung
a8be700b9f Simplify op-assignment. 2020-03-07 13:39:28 +08:00
Stephen Chung
22cb69a16b Allow block expressions. 2020-03-07 10:39:00 +08:00
Stephen Chung
473e40e8a4 Catch more invalid LHS for assignments. 2020-03-07 10:16:20 +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
c917aa0a5a Code cleanup. 2020-03-06 23:49:52 +08:00
Stephen Chung
d2296ab33b Allow dot operator on function results; change debug print info for function registration. 2020-03-06 21:08:51 +08:00
Stephen Chung
07e396b3f5 Allow chaining of array indexing operations. 2020-03-06 10:50:52 +08:00
Stephen Chung
d8ec7ed141 Rephrase error messages. 2020-03-06 10:50:20 +08:00
Stephen Chung
c7801e1d7e Fix off-by-one error message on indexing. 2020-03-06 09:55:00 +08:00
Stephen Chung
3d3b939ba6 Simplify code, document logic, refactor and better error messages. 2020-03-06 01:05:02 +08:00
Stephen Chung
883f08c026 Enable more indexing expressions. 2020-03-05 20:28:03 +08:00
Stephen Chung
c9395049e2 Remove no-std feature and rename stdlib to no_stdlib. 2020-03-05 10:18:46 +08:00
Stephen Chung
347f6d607a Add no-std and stdlib features. 2020-03-04 23:44:32 +08:00
Stephen Chung
ba2aac4960 General code cleanup. 2020-03-04 23:06:05 +08:00
Stephen Chung
bb56a7a843 Code refactor, bug fixes, code docs. 2020-03-04 22:00:01 +08:00
Stephen Chung
b4d56accd4 Reverse commit fa13588f69. Limit input script size not meaningful. 2020-03-04 09:33:35 +08:00
Stephen Chung
b421c8ac50 Minor refactor. 2020-03-03 23:31:29 +08:00
Stephen Chung
3af421ae5f Fix problems with script-defined functions. 2020-03-03 23:31:16 +08:00
Stephen Chung
01bee6e16e Accept up to 20 parameters in functions. 2020-03-03 23:17:42 +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
71ec23e621 Minor code refactoring. 2020-03-03 16:24:03 +08:00
Stephen Chung
95d0b2e620 Better error messages for function definitions. 2020-03-03 16:23:55 +08:00
Stephen Chung
a1591ae45b Better API for Scope. 2020-03-03 15:20:20 +08:00
Stephen Chung
fa13588f69 Limit script size to avoid overflowing positions. 2020-03-03 13:30:46 +08:00
Stephen Chung
366188234b Pretty-print common type names. 2020-03-02 23:16:19 +08:00
Stephen Chung
a4a9102fc5 Add remaining integer types. 2020-03-02 22:32:08 +08:00
Stephen Chung
0e96e1080c Comprehensive error line number/character position during evaluation. 2020-03-02 22:13:14 +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
cc87214750 Simplify code. 2020-03-02 17:04:45 +08:00
Stephen Chung
103c62fb43 Include io::Error in file API's. 2020-03-02 16:29:50 +08:00
Stephen Chung
adaa65f953 Allow script functions to override built-in functions. 2020-03-02 15:19:41 +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
bedfe55005 Minor code refactoring. 2020-03-02 00:11:00 +08:00
Stephen Chung
a64b01692b Use impl Fn style. 2020-03-01 19:26:57 +08:00
Stephen Chung
b152ed88f0 Move built-in functions into separate module. 2020-03-01 17:37:47 +08:00
Stephen Chung
e93fd7d3fe Properly handle char types. 2020-03-01 13:30:22 +08:00
Stephen Chung
5f135353c0 Change precedence to i8. 2020-02-29 21:18:48 +08:00
Stephen Chung
17f0001b11 Fix string handling - error for unterminated strings. 2020-02-29 21:10:31 +08:00
Stephen Chung
4b3cf95871 Simplify position handling. 2020-02-29 20:12:10 +08:00
Stephen Chung
c9daab3754 Simplify code by removing redirections. 2020-02-29 17:10:51 +08:00