Commit Graph

610 Commits

Author SHA1 Message Date
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