Commit Graph

52 Commits

Author SHA1 Message Date
Nick
d427405f47 contains and contians any - remove comment 2023-05-10 12:37:43 -05:00
Nick
8b8af31eb8 contains + contains_any builtins 2023-05-10 12:31:33 -05:00
Nick
76d480c465 Some function to check if tuple contains value 2023-05-08 08:36:13 -05:00
Natan Freeman
927e0e4075 Replaces f64 and i64 with FloatType and IntType. 2022-09-14 21:36:36 +03:00
ISibboI
687f762115
Merge branch 'main' into random 2022-04-07 16:20:41 +03:00
Ophir LOJKINE
27bd1a32d7 add comment
Fixes https://github.com/ISibboI/evalexpr/pull/101#discussion_r838444554
2022-03-30 14:44:19 +02:00
Ophir LOJKINE
bce31e24ae new function: random()
random() returns a random number between 0 and 1
2022-03-30 14:39:26 +02:00
Ophir LOJKINE
9d5ef651ae cargo fmt 2022-03-23 18:09:23 +01:00
Ophir LOJKINE
8eedf720e7 Implement changes requested in PR
https://github.com/ISibboI/evalexpr/pull/101#issuecomment-1076466426
2022-03-23 16:33:53 +01:00
Ophir LOJKINE
3c4a429e8d Remove is_sumbnormal 2022-03-23 13:11:41 +01:00
Ophir LOJKINE
ea42cf6355 Add support for is_nan, is_finite, and other floating-point testing functions 2022-03-23 13:04:09 +01:00
Ophir LOJKINE
65bf8adc9c remove duplicated code 2022-03-14 16:08:08 +01:00
Ophir LOJKINE
af77f1703e remove unnecessary clone 2022-03-14 15:58:42 +01:00
Ophir LOJKINE
7522df14b7 remove dead code 2022-03-14 15:50:08 +01:00
Ophir LOJKINE
9eedc8e93b cargo fmt 2022-03-14 15:07:38 +01:00
Ophir LOJKINE
a219f0b66f Add an "if" function
If the first argument is true, returns the second argument, otherwise, return the third
2022-03-14 14:59:48 +01:00
Diane Sparks
d6fafc171d
Add bitwise shift functions 2022-03-06 10:17:37 -08:00
Sebastian Schmidt
b3be7f600c Implement bitwise operators as builtin functions.
Relates to #88
2021-10-12 14:59:10 +03:00
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
Magnus Ulimoen
9883aeb52c Add additional math builtins 2021-06-30 22:11:58 +02:00
Edwin Svensson
10a388aaf3
'namespace' & document math functions 2021-05-31 01:04:33 +02:00
Edwin Svensson
8491bc61fc
add common math functions 2021-05-30 08:52:28 +02:00
Sebastian Schmidt
77e148fcd4 Ensure that Function implements Send and Sync.
Relates to #76
2021-05-28 14:27:41 +03: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
6e5ff8615a Fix lints and benches. 2021-05-28 09:07:26 +03:00
Sebastian Schmidt
b9c4b34a2f Make builtin len support tuples
Implements #41
2019-08-29 11:10:54 +03:00
Sebastian Schmidt
2399df16a1 Run rustfmt 2019-08-29 10:02:05 +03:00
Sebastian Schmidt
6b1706f68f Run rustfix
Relates to #55
2019-08-29 09:03:31 +03:00
Sebastian Schmidt
0c5d032b37 Merge remote-tracking branch 'origin/master' 2019-08-29 08:57:07 +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
Atul Bhosale
311c70a823
Update crate for Rust 2018 using 'cargo fix --edition' 2019-06-06 23:23:30 +05:30
Sebastian Schmidt
502ec0adce Format code 2019-05-04 13:54:19 +02:00
Sebastian Schmidt
f6c2ef2fb6 Remove automatic function argument decomposition
Relates to #52
2019-05-04 13:43:29 +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
Sebastian Schmidt
17bedddb11 Add serde support for HashMapContext
Relates to #33
2019-03-28 15:40:02 +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
0acbcd8958 Format code 2019-03-28 08:44:04 +01:00
Sebastian Schmidt
d77fa15864 Use EvalexprResult<T> everywhere
Relates to #31
2019-03-27 19:09:58 +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
fd879193b6 Rename Error to EvalexprError and add EvalexprResult
Relates to #27
2019-03-27 16:33:46 +01:00
Sebastian Schmidt
38c4c35a0b Document all remaining public members
Implements #6
2019-03-20 11:32:55 +02:00
Sebastian Schmidt
92da684c69 Implement min and max builtin functions
Implement #8, partially implement #1
2019-03-19 20:08:23 +02:00
Sebastian Schmidt
fd3243e555 Implement functions with arbitrary argument amount
Implements #7
2019-03-19 18:58:53 +02:00
Sebastian Schmidt
c631171ff0 Add comma operator and display implementations
+ Add comma token
 + Add tuple operator
 + Add tuple value type
 + Implement display for `tree::Node` and all related types
 + Add support for right-to-left chaining of operators with same precedence

The priority of chaining of operators with the same precedence remains left-to-right.
Only if two consecutive operators with the same precedence are right-to-left, they will be ordered right-to-left.

Implements #4.
2019-03-19 18:24:36 +02:00
Sebastian Schmidt
dc8c818789 Move function module to folder to match module style of this repo 2019-03-19 12:29:03 +02:00
Sebastian Schmidt
b38c102c1d Complete rewrite of crate. Simple tokenizer and treeifyer (Or however the compiler people call these.). 2019-03-15 17:14:27 +02:00