Commit Graph

650 Commits

Author SHA1 Message Date
Stephen Chung
d36e2d22d1 Minor refactor. 2021-12-02 12:49:46 +08:00
Stephen Chung
ba0a6c667e Add FnPtr::call_within_context. 2021-11-29 12:43:59 +08:00
Stephen Chung
95dc2ad502 Remove fields and parameters under no_function. 2021-11-29 09:43:35 +08:00
Stephen Chung
dca47d5233 Remove volatile warnings for types and functions exposed unter internals. 2021-11-28 22:03:02 +08:00
Stephen Chung
f49ff28b82 Fix test. 2021-11-28 10:49:48 +08:00
Stephen Chung
30bfdd841a Add FnPtr::call. 2021-11-27 16:28:34 +08:00
Stephen Chung
dc7444596b Add test for capturing closures in array method. 2021-11-23 22:56:31 +08:00
Stephen Chung
a757dfe89d Add blobs. 2021-11-23 14:58:54 +08:00
Stephen Chung
6ad7b344bf Add into_array and into_typed_array. 2021-11-23 12:45:59 +08:00
Stephen Chung
de906053ed Deprecate call_fn_dynamic into call_fn_raw. 2021-11-15 11:13:00 +08:00
Stephen Chung
615c3acad6 Use actual outer scope for function-bang calls. 2021-11-14 22:48:57 +08:00
Stephen Chung
6b27ca19d5 Add function call bang test. 2021-11-10 22:10:03 +08:00
Stephen Chung
c8b59bd9ca Fix test. 2021-11-08 23:24:03 +08:00
Stephen Chung
5083df3096 Propagate constants to functions for Engine::XXX_with_scope calls. 2021-11-08 22:16:28 +08:00
Stephen Chung
09e6b21729 Move mutable runtime global state to Imports. 2021-11-08 09:27:08 +08:00
Stephen Chung
71ad158b6a Fix builds. 2021-11-07 18:25:32 +08:00
Stephen Chung
68c0ee08c0 Reduce usage of Default::default() to make it easier to refactor. 2021-11-07 18:12:37 +08:00
Stephen Chung
61cc3d0bf2 Merge branch 'v1.1-fixes' 2021-11-05 23:26:00 +08:00
Stephen Chung
eeca8c90aa Make sure the global namespace is always searched first. 2021-11-05 23:22:05 +08:00
Stephen Chung
affbb81d8a Add NativeCallContext::position. 2021-11-05 19:35:33 +08:00
Stephen Chung
5e275d4593 Fix no_function build. 2021-10-29 18:14:07 +08:00
Stephen Chung
00659d65d9 Implement global module in EvalState. 2021-10-27 17:52:48 +08:00
Stephen Chung
79dd3f8186 Add $$ marker to custom syntax. 2021-10-25 22:41:42 +08:00
Stephen Chung
9d1ab2c8a1 Add test for parsing overflow. 2021-10-18 16:40:54 +08:00
Stephen Chung
b091fea17b Add event handler test. 2021-10-16 13:59:12 +08:00
Stephen Chung
87d48948f9 Merge branch 'bug-fixes' 2021-09-28 16:55:33 +08:00
Stephen Chung
7ce8887343 Fix no_index build. 2021-09-28 16:36:31 +08:00
Stephen Chung
85dcd6e754 Fix bug with changing property of value obtained via index getter. 2021-09-28 15:59:46 +08:00
Stephen Chung
c4a00f5269 Change consume to run. 2021-09-27 10:59:38 +08:00
Stephen Chung
fe47058add Merge branch 'bug-fixes' 2021-09-27 10:34:46 +08:00
Stephen Chung
6df2178460 Assume property getters are pure. 2021-09-27 10:34:24 +08:00
Stephen Chung
6e7fbfa66f Add pop to string. 2021-09-20 16:25:23 +08:00
Stephen Chung
cbe08fb64e Merge branch 'bug-fixes' 2021-09-03 10:19:58 +08:00
Stephen Chung
71711998f1 Fix bug in catch error variable. 2021-09-03 10:05:58 +08:00
Stephen Chung
65fbfe36e7 Merge branch 'bug-fixes' 2021-09-02 22:49:17 +08:00
Stephen Chung
457be797a2 Fixed bug in using error variable within catch block. 2021-09-02 22:17:45 +08:00
Stephen Chung
0354f154ce Add Scope::is_constant. 2021-08-17 15:51:14 +08:00
Stephen Chung
114c93f430 Fix bug in custom syntax starting with disabled stardard keyword. 2021-08-17 15:51:14 +08:00
Stephen Chung
180ad77224 Change Engine::consume_XXX to Engine::run_XXX. 2021-08-17 15:50:56 +08:00
Stephen Chung
e0125a1033 Allow self-terminating custom syntax. 2021-08-17 15:50:56 +08:00
Stephen Chung
94674679d9 Rename as_string and as_immutable_string. 2021-08-17 15:50:55 +08:00
Stephen Chung
b21deaf052 Support $symbol$ in custom syntax. 2021-08-17 15:50:55 +08:00
Stephen Chung
224a2dfb60 Fix bug in dotting-indexing. 2021-08-17 15:32:48 +08:00
Stephen Chung
d9f1f663ee Simplify custom syntax test. 2021-08-11 19:27:15 +08:00
Stephen Chung
278b840e13 Fix unchecked build. 2021-08-04 18:57:52 +08:00
Stephen Chung
4807fdf1cf Loops cannot be pure. 2021-08-04 17:37:56 +08:00
Stephen Chung
1d82a11f0b Change AST nodes to use bitflags for options. 2021-08-03 22:19:25 +08:00
Stephen Chung
8ea6424d50 Rename syntax to custom_syntax. 2021-08-02 10:16:28 +08:00
Stephen Chung
0944261b88 Merge Stmt::Let and Stmt::Const into Stmt::Var. 2021-08-01 11:59:53 +08:00
Stephen Chung
b8485b1909 Fix bug in indexing. 2021-07-24 12:27:33 +08:00
Stephen Chung
694ac5b5bd General code fixups. 2021-07-04 16:40:15 +08:00
Stephen Chung
b4da054bab Catch more parse errors. 2021-07-04 00:15:27 +08:00
Stephen Chung
3e0fd33db4 Fix optimizer test. 2021-07-01 12:33:16 +08:00
Stephen Chung
8c802dcd58 Fix optimizer bug. 2021-07-01 12:27:29 +08:00
Stephen Chung
fc349f67f8 Make more functions const. 2021-06-29 23:17:31 +08:00
Stephen Chung
bd35999b75 Remove unnecessary Box::new(). 2021-06-29 21:58:05 +08:00
Stephen Chung
03cb398edf Better implementation for Expression::get_literal_value. 2021-06-16 12:24:36 +08:00
Stephen Chung
68ea8c27fd Fix unchecked.
Do not duplicate data size checking.
2021-06-12 10:26:50 +08:00
Stephen Chung
79d9977cd5 Change take_string and take_immutable_string to as_XXX. 2021-06-10 10:45:44 +08:00
Stephen Chung
a5031969ca New custom syntax expression types. 2021-06-10 10:16:39 +08:00
Stephen Chung
65b7135324 Fix tests. 2021-06-07 11:54:10 +08:00
Stephen Chung
1e66f1963a Add counter variable to for statement. 2021-06-07 11:01:16 +08:00
Stephen Chung
989cb702c0 Use chars() to iterate strings. 2021-06-07 09:47:49 +08:00
Stephen Chung
a530fbf4ff Remove unnecessary raw stirngs. 2021-06-05 15:26:43 +08:00
Stephen Chung
71684f5e2a Implement bit-fields. 2021-06-02 14:29:18 +08:00
Stephen Chung
cc3e2d79a5 Replace unwrap with expect. 2021-05-22 19:14:24 +08:00
Stephen Chung
2ade56fd94 Fix no_index build. 2021-05-18 21:38:09 +08:00
Stephen Chung
dc9b4d7f4d Indexer as fallback to property. 2021-05-18 20:12:30 +08:00
Stephen Chung
941e09d29d Guard against setters mutating constants, and allow pure setters. 2021-05-15 11:41:42 +08:00
Stephen Chung
202285f9ab Disallow pure setters. 2021-05-13 10:34:24 +08:00
Stephen Chung
97c8194d17 No need to specify number of variables added/removed for custom syntax. 2021-05-11 10:58:28 +08:00
Stephen Chung
aad842fe50 Remove Engine::enable_doc_comments. 2021-05-03 13:07:51 +08:00
Stephen Chung
ed18b3f32a Fix unchecked test. 2021-04-25 15:27:43 +08:00
Stephen Chung
41d3709db1 Fix decimal build. 2021-04-24 15:53:02 +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
0f66c67f82 Do not unnecessarily use raw strings. 2021-04-20 12:01:35 +08:00
Stephen Chung
46b22ddd96 Fix tests. 2021-04-19 18:08:29 +08:00
Stephen Chung
ea866cead5 More array tests. 2021-04-19 17:02:17 +08:00
Stephen Chung
1be7e60be2 Automatic global module. 2021-04-17 17:25:35 +08:00
Stephen Chung
208e5fdbf4 New switch errors. 2021-04-16 13:28:36 +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
0f2e7e3825 Fix builds and tests. 2021-04-06 23:28:22 +08:00
Stephen Chung
f17a826f99 Refine debug print-out. 2021-04-06 23:18:41 +08:00
Stephen Chung
7ec49a9510 Fix f32_feature with serde. 2021-04-06 23:18:28 +08:00
Stephen Chung
a3ee0f4245 Fix no_index build. 2021-04-05 18:32:20 +08:00
Stephen Chung
00784d39ad PropertyExpected for map literal with interpolated key. 2021-04-05 14:51:26 +08:00
Stephen Chung
e6ea006ac6 Fix builds. 2021-04-05 00:05:56 +08:00
Stephen Chung
0807c474a1 Revise using string interpolation. 2021-04-04 23:22:45 +08:00
Stephen Chung
aacb7f0b24 Ensure no interpolation for normal strings. 2021-04-04 15:37:59 +08:00
Stephen Chung
20aaf1826a Fix builds. 2021-04-04 15:06:13 +08:00
Stephen Chung
e6c878edf3 Implement string interpolation. 2021-04-04 13:13:07 +08:00
Stephen Chung
ab0ea87f9c Allow sync in test. 2021-04-03 12:10:08 +08:00
Stephen Chung
b1452f4c35 Fix no_object build. 2021-04-03 12:00:22 +08:00
Stephen Chung
f7ad1cec39 Fix builds. 2021-04-03 11:49:16 +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
b14d18934a Add Dynamic::clone_cast. 2021-03-30 18:57:16 +08:00
Stephen Chung
e36e490a30 Support back-tick at EOL for literal strings. 2021-03-30 13:59:27 +08:00
Stephen Chung
d2ded7733a Add support for line continuation and multi-line string literals. 2021-03-30 00:21:09 +08:00
Stephen Chung
7bdc2e3d20 Extract constant arguments from function calls. 2021-03-28 19:04:25 +08:00
Stephen Chung
ea970631ff Fix test formatting. 2021-03-27 18:08:34 +08:00
Stephen Chung
6d1700728a Intern module registration strings. 2021-03-24 09:56:25 +08:00
Stephen Chung
1200ffcd2b Add test with &str parameter. 2021-03-17 22:32:22 +08:00
Stephen Chung
80c7e9310e Fix unchecked build. 2021-03-17 15:26:37 +08:00
Stephen Chung
4581943435 Remove public_only parameters. 2021-03-17 09:58:08 +08:00
Stephen Chung
082ecaa739 Fix feature builds. 2021-03-15 23:03:26 +08:00
Stephen Chung
12e3a5b050 Add test of functions with context. 2021-03-15 21:30:45 +08:00
Stephen Chung
e9f280f917 Deprecate Module::set_fn_XXX API. 2021-03-15 12:39:06 +08:00
Stephen Chung
d0922adb5b Deprecate RegisterFn and RegisterResultFn. 2021-03-15 11:36:30 +08:00
Stephen Chung
4e3fdf6dab Revamp statement block optimization. 2021-03-13 23:43:05 +08:00
Stephen Chung
cbad703b00 Flatten data structures and more aggressive inlining. 2021-03-10 13:32:09 +08:00
Stephen Chung
352408fd36 Flatten statement blocks. 2021-03-10 12:27:10 +08:00
Stephen Chung
b11b8d6d39 Reduce redirections in Stmt. 2021-03-09 23:30:48 +08:00
Stephen Chung
975bb3d6bf Map in operator to contains function call. 2021-03-09 13:44:54 +08:00
Stephen Chung
57140cbeeb Fix internals build. 2021-03-08 15:55:26 +08:00
Stephen Chung
62928f8613 Revise function hashing. 2021-03-08 15:30:32 +08:00
Stephen Chung
4da5af8aae Do not flatten arguments passed by value. 2021-03-06 21:25:49 +08:00
Stephen Chung
e14bef4b10 Trap &mut String parameters. 2021-03-06 14:41:35 +08:00
Stephen Chung
fe633ea7d3 Fix bug when passing shared string variable to &str parameter. 2021-03-06 10:44:55 +08:00
Stephen Chung
f92e6f3983 Fix metadata build. 2021-03-05 23:56:00 +08:00
Stephen Chung
426f841aa2 Fix serde build. 2021-03-05 23:41:20 +08:00
Stephen Chung
a251219730 Remove public Dynamic::as_str. 2021-03-05 23:00:27 +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
01664ef7ee Fix range overflow panics. 2021-03-04 23:47:52 +08:00
Stephen Chung
ed568a9395 Make RhaiResult internal. 2021-03-03 22:49:29 +08:00
Stephen Chung
dfc1ea692f Implement built-in operators with macros. 2021-03-03 21:46:48 +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
fc10df7d63 Keyword can no longer be overloaded. 2021-03-01 17:17:13 +08:00
Stephen Chung
061fce1f02 No more pub_only. 2021-03-01 15:39:49 +08:00
Stephen Chung
6aa0be546f Replace String::from("...") with "...".into(). 2021-02-26 11:21:05 +08:00
Stephen Chung
3f4dba9dbc Build in operators between string and char. 2021-02-25 13:29:49 +08:00
Stephen Chung
49e5382ab0 Do not return default for comparisons between same types. 2021-02-25 10:59:11 +08:00
Stephen Chung
4ac05aee8b Disallow implicit comparisons between different numeric types. 2021-02-24 15:45:29 +08:00
Stephen Chung
93d970235e Fix no_object. 2021-02-23 19:31:43 +08:00
Stephen Chung
36420f0b99 Implement print/debug functions via Dynamic parameters. 2021-02-23 19:08:05 +08:00
Stephen Chung
9a9adbefcc Wrap eval errors in ErrorInFunctionCall. 2021-02-18 14:33:12 +08:00
Stephen Chung
3650b04c38 Add Decimal number type. 2021-02-13 20:57:56 +08:00
Stephen Chung
8ffb6c03b5 Add scientific notation to floats. 2021-02-11 19:20:30 +08:00
Stephen Chung
61638d6566 Use ** for power/exponentiation. 2021-02-10 12:41:27 +08:00
Stephen Chung
8c26b49a39 Change trig functions to take/return radians. 2021-02-10 12:10:50 +08:00
Stephen Chung
a76bed2f46 Use eval_statements_block when at global. 2021-02-07 17:06:33 +08:00
Stephen Chung
903b6d6795 Rename set_doc_comments to enable_doc_comments. 2021-01-28 16:59:19 +08:00
Stephen Chung
f76daadcba Refine FuncArgs trait. 2021-01-28 15:29:55 +08:00