Commit Graph

193 Commits

Author SHA1 Message Date
Stephen Chung
a8be700b9f Simplify op-assignment. 2020-03-07 13:39:28 +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
ea82ee81d6 Fix call_fn to take &ast instead of ast. 2020-03-07 00:29:45 +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
07e396b3f5 Allow chaining of array indexing operations. 2020-03-06 10:50:52 +08:00
Stephen Chung
d8ec7ed141 Rephrase error messages. 2020-03-06 10:50:20 +08:00
Stephen Chung
c7801e1d7e Fix off-by-one error message on indexing. 2020-03-06 09:55:00 +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
b4d56accd4 Reverse commit fa13588f69. Limit input script size not meaningful. 2020-03-04 09:33:35 +08:00
Stephen Chung
b421c8ac50 Minor refactor. 2020-03-03 23:31:29 +08:00
Stephen Chung
3af421ae5f Fix problems with script-defined functions. 2020-03-03 23:31:16 +08:00
Stephen Chung
01bee6e16e Accept up to 20 parameters in functions. 2020-03-03 23:17:42 +08:00
Stephen Chung
71a3c79915 Fix number parsing. 2020-03-03 21:39:25 +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
Stephen Chung
71ec23e621 Minor code refactoring. 2020-03-03 16:24:03 +08:00
Stephen Chung
95d0b2e620 Better error messages for function definitions. 2020-03-03 16:23:55 +08:00
Stephen Chung
a1591ae45b Better API for Scope. 2020-03-03 15:20:20 +08:00
Stephen Chung
fa13588f69 Limit script size to avoid overflowing positions. 2020-03-03 13:30:46 +08:00
Stephen Chung
366188234b Pretty-print common type names. 2020-03-02 23:16:19 +08:00
Stephen Chung
a4a9102fc5 Add remaining integer types. 2020-03-02 22:32:08 +08:00
Stephen Chung
0e96e1080c Comprehensive error line number/character position during evaluation. 2020-03-02 22:13:14 +08:00
Stephen Chung
0707fad1ca Refactor tests. 2020-03-02 22:11:56 +08:00
Stephen Chung
ed8d2ac20f Add else if control flow. 2020-03-02 17:04:56 +08:00
Stephen Chung
cc87214750 Simplify code. 2020-03-02 17:04:45 +08:00
Stephen Chung
103c62fb43 Include io::Error in file API's. 2020-03-02 16:29:50 +08:00
Stephen Chung
adaa65f953 Allow script functions to override built-in functions. 2020-03-02 15:19:41 +08:00
Stephen Chung
a5e09295f8 Allow comparisons between different types (returning false). 2020-03-02 14:28:42 +08:00
Stephen Chung
22a505b57b Short-curcuit boolean operators. 2020-03-02 12:08:03 +08:00
Stephen Chung
bedfe55005 Minor code refactoring. 2020-03-02 00:11:00 +08:00
Stephen Chung
a64b01692b Use impl Fn style. 2020-03-01 19:26:57 +08:00
Stephen Chung
b152ed88f0 Move built-in functions into separate module. 2020-03-01 17:37:47 +08:00
Stephen Chung
e93fd7d3fe Properly handle char types. 2020-03-01 13:30:22 +08:00
Stephen Chung
5f135353c0 Change precedence to i8. 2020-02-29 21:18:48 +08:00
Stephen Chung
17f0001b11 Fix string handling - error for unterminated strings. 2020-02-29 21:10:31 +08:00
Stephen Chung
4b3cf95871 Simplify position handling. 2020-02-29 20:12:10 +08:00
Stephen Chung
c9daab3754 Simplify code by removing redirections. 2020-02-29 17:10:51 +08:00
Stephen Chung
8723eedca9 Rename RegisterBoxFn to RegisterDynamicFn. 2020-02-28 23:38:39 +08:00
Stephen Chung
8128c0cf24 Add pad and truncate array functions. 2020-02-25 16:23:59 +08:00
Stephen Chung
80a9abada6 Introduce to_int and to_float conersion functions. 2020-02-25 15:02:50 +08:00
Stephen Chung
51abc4a2c1 Simplify API by introducing the Dynamic and Array type aliases. 2020-02-25 15:02:27 +08:00
Stephen Chung
60a7d51537 Allow override of print and debug. 2020-02-25 10:40:48 +08:00
Stephen Chung
e4e471fd20 Add line/position in compilation errors; Add compile to AST; FIx infinite loop in close parens. 2020-02-24 23:25:52 +08:00
Stephen Chung
b3247204c6 Include filename in ErrorCantOpenScriptFile. 2020-02-24 11:06:33 +08:00
Stephen Chung
157aa2be94 Add for statement and range function; New register_box_fn for functions returning Box<dyn Any> (which should not be boxed again); Register standard utility functions in library (e.g. print, string concat). 2020-02-23 22:48:46 +08:00
Stephen Chung
b2747b076e Add bouncs check to array index access. 2020-02-23 14:09:40 +08:00
Stephen Chung
829621a3d4 Trap array out-of-bound index access error. 2020-02-23 13:59:50 +08:00
timfish
4217e96d19 Remove unused enums and simplify test assertions 2019-10-09 12:06:32 +01:00
timfish
c34af7979a Format 2019-09-30 18:58:01 +01:00
timfish
53bb0a38f0 Use std::any::type_name 2019-09-30 18:57:21 +01:00
timfish
82fd20b2b1 Rust 2018 2019-09-18 11:21:07 +01:00
timfish
d7d0507f5a Fix readme and a couple of mis-named types? 2019-09-16 22:14:14 +01:00
David Kushner
0a11cadebf fix ambiguous calls to type_id preventing compilation on nightly 2019-04-17 13:28:14 -07:00
steve donovan
7ff1c39e01 Engine should be Clone 2018-07-22 17:06:13 +02:00
steve donovan
3fb2f543bb Engine::register_type_name for nice error messages for arbitrary types 2018-07-22 11:43:21 +02:00
steve donovan
2bf3f5e957 better not-found error messages for variables and functions 2018-07-16 13:01:11 +02:00
Juan Ibiapina
e534e907e8 Use default rust directory structure for tests 2018-06-13 10:56:29 +02:00
russ morris
2f46af64dd added unit type as () 2018-05-22 16:44:41 -07:00
Lukáš Hozda
8d07d8e00a lock debug messages behind 'debug_msgs' feature 2018-02-09 22:27:41 +01:00
Lukáš Hozda
ccc16f42f9 make engine clone-able 2017-12-31 19:58:50 +01:00
Lukáš Hozda
b318ec24a9 rename OpEquals to OpAssign, as all of them are compound assignment operators 2017-12-21 12:32:18 +01:00
Lukáš Hozda
5edcfc2156 minor refactor 2017-12-21 12:28:59 +01:00
torkleyy
76a1e3056b Add better funcion call syntax 2017-12-20 22:16:53 +01:00
torkleyy
71ebd0d4d1 Use &mut Any instead of &mut Box<Any> 2017-12-20 21:52:26 +01:00
torkleyy
348a680980 Fix build and all tests 2017-12-20 21:09:53 +01:00
torkleyy
3672414212 Simplify and fix code 2017-12-20 17:37:12 +01:00
torkleyy
aec1fdcb78 Revert debugging changes 2017-12-20 16:39:03 +01:00
torkleyy
a0fb5036f6 Minor tweaks, fix bug 2017-12-20 16:32:04 +01:00
torkleyy
f09545921f Rewrite Rhai function dispatching 2017-12-20 12:16:14 +01:00
russ
3a5a1d2aff i64 and f64 exponent implementation 2017-11-23 23:56:22 -08:00
Lukáš Hozda
8fbeecb31b export EvalAltResult, because it was public already and might be needed for some eval() and consume() calls 2017-11-03 18:49:27 +01:00
russ
037a9cdc67 separated tests for mergability 2017-11-03 09:58:51 -07:00
Lukáš Hozda
17ebeeeb89 add a test for unary after new binary ops 2017-11-01 23:09:30 +01:00
Lukáš Hozda
3c8feab630 allow unary after compound and new binary operators 2017-11-01 23:09:07 +01:00
russ
7f6edf732f resolved merge conflicts 2017-11-01 11:17:53 -07:00
russ
6d151bc2b9 minor refactor for sanity 2017-10-31 22:10:46 -07:00
russ
6cff70f2a3 binary, hex, octal literal types 2017-10-31 22:02:36 -07:00
russ
4fed05c20a bugfix for binary and, modulo, binary ops tests 2017-10-31 15:06:13 -07:00
Lukáš Hozda [magnusi]
896c2f7a08
Merge pull request #43 from luciusmagn/master
fix version in README, continue documenting
2017-10-31 13:43:46 +01:00
russ
f1cd71a72b candidate compound assignment implementation 2017-10-30 22:55:20 -07:00
russ
e5e58fce98 sync'd latest master 2017-10-30 08:08:44 -07:00
Lukáš Hozda
9448c19581 fix version in README, continue documenting 2017-10-30 13:08:40 +01:00
Lukáš Hozda
50b8fe365a fix warning in lib.rs doctest 2017-10-30 08:53:11 +01:00
Lukáš Hozda [magnusi]
b95c402e3f
Merge branch 'master' into master 2017-10-30 08:48:19 +01:00
russ
e042e1e31d candidate increment/decrement implementation 2017-10-29 22:03:35 -07:00
russ
18c6892df3 take 2, 100% fewer variable name conflicts 2017-10-29 20:32:41 -07:00
Lukáš Hozda
47ce39062f initial documentation (WIP) 2017-10-28 22:33:00 +02:00
Lukáš Hozda
32c252d4d2 allow unary operators as the first token after if or while 2017-10-28 20:58:22 +02:00
Lukáš Hozda
ebbab0d259 bump version, remove unneeded cause() fn as it now has a provided implementation 2017-10-28 17:44:53 +02:00
Lukáš Hozda
caf8a411aa impl loop and add tests for both unary operators and loops 2017-10-28 16:40:38 +02:00
Lukáš Hozda
679f0de6b6 implement unary + and -, add useful functions to Token 2017-10-28 16:08:24 +02:00
Lukáš Hozda
b8157a1121 implement comments 2017-10-28 12:39:29 +02:00