Commit Graph

383 Commits

Author SHA1 Message Date
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
4b622a8830 Enable export let/export const short-hand. 2020-11-09 12:21:11 +08:00
Stephen Chung
760f6c3678 Fix no_function build. 2020-11-08 10:56:33 +08:00
Stephen Chung
07a8a43298 Optimize data structures. 2020-11-06 16:27:40 +08:00
Stephen Chung
c287a61b93 Streamline ScriptFnDef. 2020-11-04 12:34:54 +08:00
Stephen Chung
2168fd5361 Expr::Stmt takes a statements block. 2020-11-04 11:49:02 +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
d7d6f74dfd Add constant NO_POS. 2020-11-02 12:50:27 +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
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
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
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
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
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
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
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
6e5c903241 Fix no_module build. 2020-10-18 22:10:08 +08:00
Stephen Chung
dc4c47e008 Fix no_function and no_module builds. 2020-10-18 17:29:11 +08:00
Stephen Chung
82e6dd446a Encapsulate register_fn_raw parameters into NativeCallContext. 2020-10-18 17:02:17 +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
39474d6420 Streamline function pointers and currying. 2020-10-17 13:49:16 +08:00
Stephen Chung
3c7805d514 Encapsulate environment in ScriptFnDef. 2020-10-13 09:38:14 +08:00
Stephen Chung
c4f00afbee Disallow ! in module function calls. 2020-10-12 16:59:59 +08:00
Stephen Chung
612ecc4ebc Move StaticVec definition to lib.rs. 2020-10-10 13:41:55 +08:00
Stephen Chung
7ede299aae Allow expressions in constants. 2020-10-09 11:15:25 +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
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
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
1e13e6be5f Doc formatting. 2020-10-03 18:49:11 +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
e8d5f78f88 Simplify code. 2020-10-01 23:31:27 +08:00
Stephen Chung
03dce86328 Support Dynamic as function default return value. 2020-09-26 16:27:38 +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
J Henry Waugh
c8dffff515 Fix clippy::perf lint errors 2020-09-20 13:07:46 -05:00
Stephen Chung
d1ab9a2848 Fix bug on unary function hashes. 2020-09-11 22:09:09 +08:00
Stephen Chung
a72f797da1 Merge branch 'plugins' into plugins_dev 2020-08-23 17:54:37 +08:00
Stephen Chung
7cd345b128 Fix bug in closure capture for no_object. 2020-08-23 17:46:39 +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
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
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
da3cce58d3 Minor refactor. 2020-08-08 22:59:05 +08:00
Ilya Lakhin
45d021c7ef Function names capturing as external variables bug 2020-08-08 17:55:58 +07: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
2aa08c0dd9 get_constant_value for FnPointer. 2020-08-03 23:12:42 +08:00
Stephen Chung
4079164bfd Implement closures. 2020-08-03 12:10:20 +08:00
Stephen Chung
60891e694f Streamline code and feature gates. 2020-07-31 22:30:23 +08:00
Ilya Lakhin
89f75bbf0c Merge remote-tracking branch 'schungx/closures' into closures 2020-07-31 13:05:16 +07: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
Stephen Chung
a7ff207636 Use Scope::flatten_clone for capturing. 2020-07-30 23:29:30 +08:00
Stephen Chung
98b294c699 Implement capturing. 2020-07-30 18:18:28 +08:00
Stephen Chung
691e04292f Put externals in ScriptFnDef. 2020-07-30 13:28:06 +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
b63ff56e09 Make sure we keep the starting position of each statement (for future uses). 2020-07-28 10:26:20 +08:00
Stephen Chung
a3a167424b Allow Rust functions in FnPtr::call_dynamic. 2020-07-27 12:52:32 +08:00
Stephen Chung
ec5082c328 Better handling of reserved keywords. 2020-07-26 22:25:30 +08:00
Stephen Chung
6b600704a3 Avoid warnings. 2020-07-26 15:53:22 +08:00
Stephen Chung
c825de6f77 Mark internal data structures with [INTERNALS]. 2020-07-25 16:05:08 +08:00
Stephen Chung
284e58e8a1 Improve documentation on internal types. 2020-07-25 15:52:27 +08:00
Stephen Chung
a58207aaa9 Change ScriptFnDef to use ImmutableString. 2020-07-25 14:06:13 +08:00
Stephen Chung
abf66850f6 Enable custom syntax without internals. 2020-07-22 17:05:13 +08:00
Stephen Chung
e6c3f8134d Avoid copying property name for map property access. 2020-07-21 20:59: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
d119e13b79 Allow binding of this pointer in FnPtr calls. 2020-07-17 10:18:07 +08:00