Commit Graph

55 Commits

Author SHA1 Message Date
Jakub Dąbek
6be3b7d80e Make Function able to hold capturing closures.
This commit "reverts" a change introduced in bee98999,
by making `Function` be simultaneously `Fn` and `Clone`.
2021-08-15 20:11:00 +02:00
Sebastian Schmidt
fc2f5ac50d Add test case for potential error.
Relates to #89.
2021-08-01 15:13:58 +03:00
Dennis Marttinen
fbbecc766f
Add support for scientific notation of the form <coefficient>e{+,-,}<exponent> 2021-07-20 20:34:51 +03:00
Sebastian Schmidt
77659b8181 Add more string comparison test cases. 2021-07-13 15:06:43 +03:00
Sebastian Schmidt
97c5fc1c21 Add tests for evaluating operator tree and fix correct error for eval_number functions. 2021-07-13 14:55:23 +03:00
Sebastian Schmidt
e80fd20804 Increase test coverage and fix wrong error in shortcut method. 2021-07-13 14:28:25 +03:00
Sebastian Schmidt
8b493be1dd Increase test coverage.
Implement more tests and exclude modules from test that do not make sense to be tested.
2021-07-13 13:41:16 +03:00
Sebastian Schmidt
7ebf7e61d5 Increase test coverage.
Implement more tests and exclude modules from test that do not make sense to be tested.
2021-07-13 13:39:47 +03:00
Sebastian Schmidt
6a30bd24e2 Format code. 2021-06-22 11:43:58 +02:00
Sebastian Schmidt
bd9a314baa Increase test coverage. 2021-06-22 11:41:51 +02:00
Edwin Svensson
a25b347c17
fix tests 2021-05-31 01:15:01 +02:00
Edwin Svensson
8491bc61fc
add common math functions 2021-05-30 08:52:28 +02:00
Sebastian Schmidt
bee98999db Make Function clone.
To achieve this, the function type wrapped by Function was changed to remove the `Box`.

Relates to #73
2021-05-28 14:12:26 +03:00
Sebastian Schmidt
1316ae63d0 Update code formatting. 2021-05-28 08:56:21 +03:00
Sebastian Schmidt
782f233d7d Add more string comparison tests
Relates to #68
2019-08-30 12:43:10 +03:00
Sebastian Schmidt
2d1704b9a3 Implement better error messages for addition with incompatible types
Implements #60
2019-08-29 16:36:35 +03:00
Sebastian Schmidt
a3faefb893 Fix panic when adding number to string
For no reason, unwraps were used in the operator module.

Fixes #59
2019-08-29 13:36:18 +03:00
Sebastian Schmidt
b7233a3337 Implement operator assignments
Implements #34
2019-08-29 13:10:12 +03:00
Sebastian Schmidt
b9c4b34a2f Make builtin len support tuples
Implements #41
2019-08-29 11:10:54 +03:00
Sebastian Schmidt
15cdb3eb50 Refactor regex tests into own module 2019-08-29 10:58:01 +03:00
Sebastian Schmidt
2399df16a1 Run rustfmt 2019-08-29 10:02:05 +03:00
Sebastian Schmidt
6ace829117 Create mutable context when using eval functions without context
While this is a tiny hit on performance, it is something that the user probably wants.
It specifically prevents the user from seeing ContextNotManipulable errors when using the full power of evalexpr in the simplest eval calls.

Implements #45
2019-08-29 09:44:14 +03:00
Sebastian Schmidt
596d4d37b1 Refactor serde tests into own module 2019-08-29 09:21:34 +03:00
Sebastian Schmidt
e6c19077b6 Implement value decomposition API
* Removed expect_... methods and replaced them with .as_...() methods. This removes the need to import the free-standing methods every time and makes the code cleaner.
 * Changed all the examples appropriately.

Implements #53
2019-08-29 08:56:49 +03:00
Sebastian Schmidt
502ec0adce Format code 2019-05-04 13:54:19 +02:00
Sebastian Schmidt
6f533ca925 Merge branch '52_remove_automatic_function_argument_decomposition' 2019-05-04 13:53:47 +02:00
Sebastian Schmidt
f6c2ef2fb6 Remove automatic function argument decomposition
Relates to #52
2019-05-04 13:43:29 +02:00
Sebastian Schmidt
21b308f3ae Format code 2019-04-26 17:37:59 +02:00
Sebastian Schmidt
6f77471354 Fixed aggregation operator
Manage sequence operators, which currently are `Chain` and `Token` on the stack without ever inserting unfinished sequence operator nodes into another node.

Relates to #44
2019-04-22 19:08:55 +02:00
Sebastian Schmidt
d576cec9b9 Add flattening of operator chains when building operator tree
Relates to #44
2019-04-22 16:20:33 +02:00
Sebastian Schmidt
6c078c49e5 Refactor operators into an enum
(This commit is not formatted properly)

Relates to #46
2019-04-14 16:54:35 +02:00
Quest
dbf3949af6 Namespace string builtins into "str::". 2019-04-12 23:45:29 +02:00
Quest
d72334c246 Rename builtin upcase,downcase -> to_uppercase, to_lowercase. 2019-04-12 23:45:29 +02:00
Quest
7c6b6d4319 Rename matches,replace -> regex_{matches,replace}.
Also simplify their error handling.
2019-04-12 23:45:29 +02:00
Quest
be54931f76 Builtin string functions - downcase, len, match(regex), replace(regex), trim, upcase. New dependency regex. 2019-04-12 23:35:33 +02:00
Quest
a9c45307dd Support addition and comparison of strings. 2019-04-05 23:07:54 +02:00
Sebastian Schmidt
67d68cd974 Add string constants
* Implement string parsing in tokenizer
 * Implement escape sequences `\"` and `\\`
 * Document changes
 * Update change log

Relates to #35
2019-03-30 11:54:26 +01:00
Sebastian Schmidt
9d27969eac Implement and test chain operator
Relates to #26
2019-03-28 11:34:54 +01:00
Sebastian Schmidt
83269068a2 Add the assignment operator
Relates to #25
2019-03-28 11:12:47 +01:00
Sebastian Schmidt
5bc4bcb702 Add crate level shortcut evaluations for Value::Empty
Relates to #28
2019-03-28 10:32:42 +01:00
Sebastian Schmidt
7d36ebe8df Add Node shortcut evaluations for Value::Empty
Relates to #28
2019-03-28 10:26:49 +01:00
Sebastian Schmidt
3c108d5960 Add crate shortcut methods to eval with context mut
Relates to #30
2019-03-28 09:48:12 +01:00
Sebastian Schmidt
e266f4fc0d Merge ContextMut with Context and add eval_<type>_with_context_mut methods
Trait objects of `ContextMut` cannot be converted into `Context`, even though `ContextMut` requires `Context`.

Relates to #30
2019-03-28 09:22:48 +01:00
Sebastian Schmidt
0acbcd8958 Format code 2019-03-28 08:44:04 +01:00
Sebastian Schmidt
d5544cdbf2 Add eval_number[_with_context] crate methods
Relates to #20
2019-03-27 18:59:06 +01:00
Sebastian Schmidt
720b2f90c2 Add Node::eval_number[_with_context] methods
Relates to #20
2019-03-27 18:55:51 +01:00
Sebastian Schmidt
b18521b8aa Format code 2019-03-27 18:35:16 +01:00
Sebastian Schmidt
9283d5412f Rename Context to ContextMut and Configuration to Context
Get rid of two different words for the same concept.

Relates to #22
2019-03-27 18:09:33 +01:00
Sebastian Schmidt
3da6019dae Add Context trait
* Rename `HashMapConfiguration` to `HashMapContext`
 * Rename `EmptyConfiguration` to `EmptyContext`
 * Implement `Context` for both predefined contexts
 * Update tests and doctests

Relates to #22
2019-03-27 17:45:06 +01:00
Sebastian Schmidt
fd879193b6 Rename Error to EvalexprError and add EvalexprResult
Relates to #27
2019-03-27 16:33:46 +01:00