Commit Graph

1301 Commits

Author SHA1 Message Date
Stephen Chung
65621b79b1 Fix volatile warnings. 2021-01-16 14:46:03 +08:00
Ilya Lakhin
421baebbc1 Exposing AST functions shared module under internals feature 2021-01-16 01:38:50 +07:00
Stephen Chung
c4b6c31bf0 Use ahash as default hasher. 2021-01-15 23:52:56 +08:00
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