Commit Graph

237 Commits

Author SHA1 Message Date
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
0306d15c04 Split core and standard libraries into packages. 2020-04-21 00:11:25 +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
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
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
5796e520ec Support Dynamic return values. 2020-04-13 10:27:08 +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
ff8eca8a5e Add parse_json. 2020-04-10 17:14:07 +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
bcff6bfd71 Remove no_stdlib feature in favor of Engine::new_raw(). 2020-04-08 10:19:03 +08:00
Stephen Chung
b74c85f04c Fix max call depth and add test. 2020-04-07 23:13:47 +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
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
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
a79f2a209c Make Engine Send+Sync. 2020-04-03 17:17:00 +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
4ea2fb88ae Add continue statement. 2020-04-01 16:22:18 +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
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
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
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
5aea997672 Refine Scope API. 2020-03-25 11:27:18 +08:00
Stephen Chung
d21f66b911 Fixing lint warnings 2020-03-24 16:57:35 +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
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
0dc51f8e59 Removee debug_msgs feature. 2020-03-18 22:03:50 +08:00
Stephen Chung
a9c65a962c Split no_stdlib and no_std into two features. 2020-03-18 12:04:26 +08:00
Stephen Chung
8efe080412 Handle break and return better. 2020-03-18 10:42:27 +08:00
Stephen Chung
abe5365bfd Improve error messages to lists. 2020-03-18 10:40:07 +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
705fbd0c1b Improve error messages to lists. 2020-03-16 23:51:32 +08:00
Stephen Chung
f36caa6dc3 Add optimize_full pseudo feature. 2020-03-16 12:40:42 +08:00
Stephen Chung
372321dfe3 Add full optimization level for aggressive optimizing. 2020-03-15 22:39:58 +08:00
Stephen Chung
01cf777961 Use matches! macro. 2020-03-14 23:41:15 +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
d5adee2209 Allow chained assignments. 2020-03-14 11:51:45 +08:00
Stephen Chung
9844ae8665 Add constants. 2020-03-13 18:12:41 +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
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
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
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
3e7adc2e51 More comments in code. 2020-03-08 19:54:02 +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
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
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
d8ec7ed141 Rephrase error messages. 2020-03-06 10:50:20 +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
3af421ae5f Fix problems with script-defined functions. 2020-03-03 23:31:16 +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