Commit Graph

781 Commits

Author SHA1 Message Date
Stephen Chung
a5d4a0abb9 Disable on_progress with unchecked. 2021-04-25 15:27:58 +08:00
Stephen Chung
c82a47ac26 Unchecked index access. 2021-04-24 14:47:20 +08:00
Stephen Chung
61b559a58f Refine op-assignment. 2021-04-24 11:55:40 +08:00
Stephen Chung
fc782c5563 Refine posistion display. 2021-04-23 14:24:53 +08:00
Stephen Chung
a54fbb32ff Add no_position feature. 2021-04-22 23:02:25 +08:00
Stephen Chung
fe37edd123 Add Stmt::FnCall. 2021-04-21 18:16:24 +08:00
Stephen Chung
cc546fcaab Add version to repl. 2021-04-21 17:39:45 +08:00
Stephen Chung
815f7ba09e Remove Expr::FnPointer. 2021-04-20 23:40:52 +08:00
Stephen Chung
ce384d8bb0 Change FnPtr to SmartString. 2021-04-20 23:28:04 +08:00
Stephen Chung
8f1bff2ded Change hash to hashes. 2021-04-20 22:26:08 +08:00
Stephen Chung
bd145bd080 Do not unnecessarily reindex module. 2021-04-17 22:19:48 +08:00
Stephen Chung
eefdc09352 Allow shadowing of global. 2021-04-17 18:40:16 +08:00
Stephen Chung
9a8da93145 Delay creation of global module until actually needed. 2021-04-17 18:10:57 +08:00
Stephen Chung
1be7e60be2 Automatic global module. 2021-04-17 17:25:35 +08:00
Stephen Chung
01f0cc028b Use no-std-compat to build no-std. 2021-04-17 15:15:54 +08:00
Stephen Chung
199df9aa4a Use deref for Target. 2021-04-17 13:36:51 +08:00
Stephen Chung
6c92011ea1 Hide is_shared and is_locked under feature gates. 2021-04-17 12:03:29 +08:00
Stephen Chung
1f987ec61a Streamine StmtBlock. 2021-04-16 13:15:11 +08:00
Stephen Chung
980a13ca42 Add switch case conditions. 2021-04-16 12:04:33 +08:00
Stephen Chung
40fda5139d Support negative index counting from end. 2021-04-10 15:00:03 +08:00
Stephen Chung
4aaf957d73 Gate doc-comment tokenizing. 2021-04-09 23:13:33 +08:00
Stephen Chung
f17a826f99 Refine debug print-out. 2021-04-06 23:18:41 +08:00
Stephen Chung
d3cfb3c605 Optimize position in variable access. 2021-04-05 23:59:15 +08:00
Stephen Chung
94fc5af285 Store short index in variable access. 2021-04-05 23:06:48 +08:00
Stephen Chung
a3ee0f4245 Fix no_index build. 2021-04-05 18:32:20 +08:00
Stephen Chung
e6c878edf3 Implement string interpolation. 2021-04-04 13:13:07 +08:00
Stephen Chung
b089d5b8f4 Fix bug in property setter op-assignment. 2021-04-03 11:12:35 +08:00
Stephen Chung
a738f750f9 Implement string functions with to_string/to_debug. 2021-04-02 19:26:55 +08:00
Stephen Chung
889edbef71 Allow cross-loading of relative file paths in FileModuleResolver. 2021-04-02 12:34:39 +08:00
Stephen Chung
98afb2e7d6 Fix feature builds. 2021-03-31 10:16:38 +08:00
Stephen Chung
a049f7b5ba Optimize data structures. 2021-03-30 23:55:29 +08:00
Stephen Chung
e306a92ea0 Change Map keys to Identifier. 2021-03-29 17:14:22 +08:00
Stephen Chung
e5249cc1ae Extract Identifier type. 2021-03-29 11:36:02 +08:00
Stephen Chung
7bdc2e3d20 Extract constant arguments from function calls. 2021-03-28 19:04:25 +08:00
Stephen Chung
c4fe1782df Streamline string handling. 2021-03-24 13:17:52 +08:00
Stephen Chung
3d0d5d1708 Streamline code. 2021-03-24 10:02:50 +08:00
Stephen Chung
0d7f2c16cc Reduce indirections. 2021-03-23 20:04:54 +08:00
Stephen Chung
f9429c06f9 Use template for object map literal. 2021-03-23 18:25:40 +08:00
Stephen Chung
f70225ca1d Change HashMap to BTreeMap. 2021-03-23 12:13:53 +08:00
Stephen Chung
a82f0fc738 Allow non-Dynamic in return_raw. 2021-03-22 11:18:09 +08:00
Stephen Chung
6667a22c0c Code style and docs. 2021-03-17 13:30:47 +08:00
Stephen Chung
5172ade179 Code style edits. 2021-03-16 18:16:40 +08:00
Stephen Chung
d9df6aabc8 Change precedence to own type. 2021-03-14 10:47:29 +08:00
Stephen Chung
58d28fb468 Fix no-std build. 2021-03-13 19:08:49 +08:00
Stephen Chung
558ffeaf3e Add FnResolutionCacheEntry. 2021-03-13 18:46:08 +08:00
Stephen Chung
61b0c7b2b3 Optimize imports layout. 2021-03-12 22:30:08 +08:00
Stephen Chung
728ed81173 Optimize layout. 2021-03-10 22:12:48 +08:00
Stephen Chung
352408fd36 Flatten statement blocks. 2021-03-10 12:27:10 +08:00
Stephen Chung
2ff2789326 Fix Stmt size. 2021-03-09 23:48:40 +08:00
Stephen Chung
b11b8d6d39 Reduce redirections in Stmt. 2021-03-09 23:30:48 +08:00
Stephen Chung
9daa894e25 Pack method call args more tightly. 2021-03-09 18:11:43 +08:00
Stephen Chung
975bb3d6bf Map in operator to contains function call. 2021-03-09 13:44:54 +08:00
Stephen Chung
7805540b7b Improve in statement. 2021-03-09 11:55:49 +08:00
Stephen Chung
795a3afa81 Use reference for method call parameters, add position info. 2021-03-09 00:07:05 +08:00
Stephen Chung
62928f8613 Revise function hashing. 2021-03-08 15:30:32 +08:00
Stephen Chung
330d3f87af Use namespace for ScriptFnDef. 2021-03-07 22:10:54 +08:00
Stephen Chung
e87f981674 Fix sync build. 2021-03-06 22:07:20 +08:00
Stephen Chung
a126d05c3f Skip evaluate condition for loop statement. 2021-03-06 16:05:22 +08:00
Stephen Chung
65ef32af19 Calculate whether contains global functions during indexing. 2021-03-05 20:07:35 +08:00
Stephen Chung
4c5ea8decc Fix switch of non-hashable value. 2021-03-05 10:33:48 +08:00
Stephen Chung
0589572d19 Refine inlining. 2021-03-04 18:13:47 +08:00
Stephen Chung
2707b887c6 Fix shared value assignments. 2021-03-04 10:24:14 +08:00
Stephen Chung
ade290da7e Simplify lifetimes. 2021-03-03 22:49:57 +08:00
Stephen Chung
ed568a9395 Make RhaiResult internal. 2021-03-03 22:49:29 +08:00
Stephen Chung
2c8b15c740 Private global functions are still exposed. 2021-03-03 11:40:27 +08:00
Stephen Chung
e3e53bd399 Introduce RhaiResult. 2021-03-02 15:02:28 +08:00
Stephen Chung
67d277aa21 Disallow overriding keywords. 2021-03-01 22:44:56 +08:00
Stephen Chung
b466d58192 Remove unnecessary AsRef and impl IntoIterator. 2021-03-01 15:58:11 +08:00
Stephen Chung
061fce1f02 No more pub_only. 2021-03-01 15:39:49 +08:00
Stephen Chung
1300ad8677 No need to copy sub-modules. 2021-03-01 14:54:20 +08:00
Stephen Chung
8eee21ff38 Use object map as catch error value. 2021-02-28 14:38:34 +08:00
Stephen Chung
f03983a9ca Expose Engine::map_type_name. 2021-02-25 11:04:01 +08:00
Stephen Chung
9495d3f733 Separate op-assignment with other function calls. 2021-02-25 10:59:22 +08:00
Stephen Chung
baaa0461bf Limit Dynamic parameters to 16. 2021-02-24 22:40:18 +08:00
Stephen Chung
37540fda12 Fix bug with op-assignment. 2021-02-24 16:17:04 +08:00
Stephen Chung
4ac05aee8b Disallow implicit comparisons between different numeric types. 2021-02-24 15:45:29 +08:00
Stephen Chung
71680e3c77 Extract op assignment into function. 2021-02-24 11:04:54 +08:00
Stephen Chung
6f876e85cc Always call native for op-assignment operators. 2021-02-23 20:32:50 +08:00
Stephen Chung
123e9d6901 Short-circuits op-assignment for indexing and dotting. 2021-02-23 20:03:28 +08:00
Stephen Chung
ba2b0630f7 Add support for Dynamic wildcard arguments. 2021-02-23 16:06:36 +08:00
Stephen Chung
ac3d8e35d4 Add splitn, rsplit and rsplitn equivalents to strings. 2021-02-23 11:56:04 +08:00
Stephen Chung
72334f0c42 Lower release stack overflow protection limit. 2021-02-20 14:05:47 +08:00
Stephen Chung
724ad05916 Add wasm64 as potential target. 2021-02-19 15:50:48 +08:00
Stephen Chung
cc90b5ffab Remove unnecessary lifetimes. 2021-02-17 19:28:07 +08:00
Stephen Chung
2dd5aceb1d Fix panic of continue/break/return in try-catch block. 2021-02-09 14:22:21 +08:00
Stephen Chung
58528db45c Encapsulate functions resolution cache into State API. 2021-02-07 17:56:29 +08:00
Stephen Chung
a76bed2f46 Use eval_statements_block when at global. 2021-02-07 17:06:33 +08:00
Stephen Chung
f388d22c0f Fix no_module build., 2021-02-07 15:52:06 +08:00
Stephen Chung
aafff4fb93 Use stacked functions resolution caches to further improve performance. 2021-02-07 15:41:40 +08:00
Stephen Chung
903b6d6795 Rename set_doc_comments to enable_doc_comments. 2021-01-28 16:59:19 +08:00
Stephen Chung
8aae3ac46c Add function name to NativeCallContext. 2021-01-21 21:49:25 +08:00
Stephen Chung
65621b79b1 Fix volatile warnings. 2021-01-16 14:46:03 +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
a5d6392107 Use NonZero for limits. 2021-01-06 13:46:53 +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
70a0d6ce58 Make id_raw return Option<&ImmutableString> 2021-01-03 11:25:25 +08: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
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
13f5cec291 Fix call stack limits. 2020-12-29 12:29:45 +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
88f63fa24b Refine docs. 2020-12-26 23:21:16 +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
8506640073 Use NonZeroU64 for function hashes. 2020-12-24 16:32: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
2e7ec8f1db IdentX -> Ident. 2020-12-22 16:45:56 +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
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
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
17310ef576 Encapsulate structures. 2020-12-14 23:05:13 +08:00
Stephen Chung
ecc08271d9 Include actual tokens in custom syntax node. 2020-12-13 14:31:24 +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
a0979d0c35 Code cleanup 2020-11-25 09:36:06 +08:00
Stephen Chung
b43223a94f Add get_fn_metadata_list. 2020-11-23 19:11:32 +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
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
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
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
a8cdb661f8 Optimize Imports. 2020-11-19 10:14:43 +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
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
937b45a187 Add Engine::load_module. 2020-11-15 23:14:16 +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
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
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
69a0f044f4 Use interned strings to prepare for match statement. 2020-11-12 22:36:13 +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
1e07e4356e Re-index imported modules if they are not yet indexed. 2020-11-08 14:29:54 +08:00
Stephen Chung
b3d318ef7f Module resolver returns shared module. 2020-11-07 23:33:21 +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
2168fd5361 Expr::Stmt takes a statements block. 2020-11-04 11:49:02 +08:00
Stephen Chung
b9de8eaa7f Minor code refactor. 2020-11-02 23:54:19 +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
c55fc5a9a5 Optimize Scope. 2020-11-01 22:46:46 +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
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
f5ffbfbe06 Code structure cleanup. 2020-10-28 22:18:44 +08:00
Stephen Chung
f56c3fe9cb Add Ident/IdentX to AST. 2020-10-28 19:11:17 +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
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
b607a3a9ba Add raw API for custom syntax. 2020-10-25 21:57:18 +08:00
Stephen Chung
2c7c719cd5 Minor cleanup before release. 2020-10-22 12:26:44 +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
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
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