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
d96ab3abf4
fix typo
2022-03-14 16:09:41 +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
79cb25bc9d
Increase test coverage.
2022-01-13 15:18:06 +02:00
Sebastian Schmidt
7af8da5cdb
Prepare 7.0.0 release.
2022-01-13 14:54:34 +02:00
Sebastian Schmidt
4e5e218d3e
Fix #94 .
...
Introduce a new error type for illegal parenthese expressions such as `4(5)`.
2022-01-13 14:50:38 +02:00
Sebastian Schmidt
ea278893ac
Prepare for 6.6.0 release.
2021-10-13 14:31:02 +03:00
Sebastian Schmidt
55092ce793
Merge branch '88_bitwise_operators' into main
...
# Conflicts:
# CHANGELOG.md
2021-10-12 15:11:56 +03:00
Sebastian Schmidt
d2f3d415df
Make functions to access operator and children of a Node public.
2021-10-12 15:10:54 +03: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
Sebastian Schmidt
053f3cf877
Add further documentation about float VS int behavior.
...
Relates to #89
2021-08-01 15:22:10 +03:00
Sebastian Schmidt
42771468a1
Update docs and changelog.
2021-07-21 13:42:50 +03:00
Sebastian Schmidt
094c2d59dc
Format code.
2021-07-21 13:39:19 +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
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
56a5f7b0e8
Update changelog and readme for 7.0 release.
2021-07-13 14:43:59 +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
9103aa7a26
Make more functions const.
2021-07-13 13:55:22 +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
08bc44183e
Fix missing argument type for atan2.
...
Relates to #85
2021-07-06 15:50:05 +03:00
Magnus Ulimoen
2c2c31efd7
Document math builtins
2021-07-04 14:25:16 +02:00
Magnus Ulimoen
9883aeb52c
Add additional math builtins
2021-06-30 22:11:58 +02:00
Magnus Ulimoen
d466bb0f24
Implement Clone for HashMapContext
2021-06-23 22:29:16 +02: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
Sebastian Schmidt
936960ee3a
Change lints to nightly and include benches.
2021-06-22 10:38:12 +02:00
Sebastian Schmidt
dc9cd98cec
Improve syntax of documentation.
2021-06-15 08:38:37 +03:00
Sebastian Schmidt
aeb822db9c
Move MRSV statement higher up in readme.
2021-06-02 17:51:51 +03:00
Sebastian Schmidt
63b8a43bd6
Update MSRV.
2021-06-02 17:43:37 +03:00
Sebastian Schmidt
0e3fbc17d4
Ad MSRV and github CI script.
2021-06-02 17:04:49 +03:00
Sebastian Schmidt
f880482f06
Move predefined module into context module.
2021-06-02 16:50:37 +03:00
ISibboI
1532c65a3d
Merge pull request #80 from olback/math-consts-context
...
Add math consts context
2021-06-02 16:46:29 +03:00
Edwin Svensson
9f691206dd
move to new 'predefined' module and add link to f64 docs
2021-05-31 01:13:24 +02:00
Edwin Svensson
10a388aaf3
'namespace' & document math functions
2021-05-31 01:04:33 +02:00
Edwin Svensson
ec880155c7
add math consts context
2021-05-30 11:08:59 +02:00
Edwin Svensson
8491bc61fc
add common math functions
2021-05-30 08:52:28 +02:00
Sebastian Schmidt
b4974a8a2b
Prepare for 6.0.0.
2021-05-28 15:14:52 +03: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
9fc86a934f
Change context trait.
...
Instead of one catchall trait for contexts, there are now several:
* `Context` is now a "use-only" context, allowing only to retrieve variable names and call functions.
* `ContextWithMutableVariables` also allows to mutate variables.
* `ContextWithMutableFunctions` also allows to mutate functions. However this is not used anywhere at the moment. It will come in handy when the evalexpr language gets a function definition feature.
* `GetFunctionContext` also allows to retrieve functions as `Function` type. This is uncommented at the moment, as it does not have any use in the crate as of now, and likely also not with planned future features.
Additionally, this commit makes functions generic over the context type, as opposed to having a dynamic reference to a context type.
Relates to #73
2021-05-28 10:27:32 +03:00
Sebastian Schmidt
fd3063fc64
Reduce unwrap()s.
...
Relates to #14
2021-05-28 09:40:58 +03:00
Sebastian Schmidt
862bfae920
Add #![forbid(unsafe_code)]
...
Closes #70
2021-05-28 09:30:26 +03:00
Sebastian Schmidt
7bc05e0770
Make node cloneable.
2021-05-28 09:09:04 +03:00
Sebastian Schmidt
6e5ff8615a
Fix lints and benches.
2021-05-28 09:07:26 +03:00
Sebastian Schmidt
1316ae63d0
Update code formatting.
2021-05-28 08:56:21 +03:00
Sebastian Schmidt
43e0256550
Fix != was wrongfully parsed as Token::Eq
...
Fixes #68
2019-08-30 12:48:00 +03:00
Sebastian Schmidt
6163972382
Reformat code examples to reduce horizontal scrolling
2019-08-30 10:07:48 +03:00
Sebastian Schmidt
b8d7344cc5
Improve documentation
2019-08-30 10:03:31 +03:00
Sebastian Schmidt
4571f3a578
Update aggregation operator documentation
...
Relates to #44
2019-08-30 09:16:43 +03:00
Sebastian Schmidt
a36d4d3815
Use mutable contexts in eval methods of Node
...
This was forgotten when closing #45 .
Relates to #45
2019-08-29 18:06:39 +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
2ec3dc74c1
Make operator enum public
...
This is required for better error messages.
Relates to #60
2019-08-29 16:28:43 +03:00
Sebastian Schmidt
88719317a5
Fix documentation of error constructors
...
Fixes #61
2019-08-29 16:11:20 +03:00
Sebastian Schmidt
0e2ca4a489
Add but not use WrongTypeCombinationError
...
Relates to #60
2019-08-29 13:49:56 +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
d8eed924cc
Add documentation about operator assignments
2019-08-29 13:21:54 +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
95ba26a2cd
Fix doctest for context creation macro
...
Relates to #48
2019-08-29 10:50:32 +03:00
Sebastian Schmidt
60b6cdf180
Add documentation about context creation macro
...
Implements #48
2019-08-29 10:47:58 +03:00
Sebastian Schmidt
3670bcaf63
Add comments to code in docs
2019-08-29 10:33:12 +03:00
Sebastian Schmidt
88559d5493
Add some information about contexts to docs
2019-08-29 10:30:55 +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
6b1706f68f
Run rustfix
...
Relates to #55
2019-08-29 09:03:31 +03:00
Sebastian Schmidt
fa0a021d71
Update use statements to Rust 2018
...
Relates to #55
2019-08-29 09:02:15 +03:00
Sebastian Schmidt
0c5d032b37
Merge remote-tracking branch 'origin/master'
2019-08-29 08:57:07 +03:00
Sebastian Schmidt
2ee1f8f62c
Deny missing docs
2019-08-29 08:56:58 +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
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
2ca7209d22
Remove debug output
2019-05-04 13:43:05 +02:00
Sebastian Schmidt
21b308f3ae
Format code
2019-04-26 17:37:59 +02:00
ISibboI
b85e8e1b75
Merge pull request #49 from lovasoa/master
...
Use the new context macro in the README examples
2019-04-26 17:36:15 +02:00
Sebastian Schmidt
bc826e5bf2
Use context_map macro in lib.rs documentation as well
...
Should have used `cargo sync-readme` to begin with, but that was not
documented at the time of this pull request.
2019-04-26 17:33:59 +02:00
Sebastian Schmidt
8432058052
Execute serde doctest only if serde_support
is enabled
...
Relates to #50
2019-04-24 18:36:30 +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
2e929ae0fe
Replace manual type_id
with builtin function of trait Any
...
Relates to #44
2019-04-22 16:24:26 +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
531b7b72a0
Make Operator::max_argument_amount
optional
...
Relates to #44
2019-04-22 16:17:02 +02:00
Sebastian Schmidt
0eaeb3f6ab
Improve context_map macro docs
...
Relates to #48
2019-04-16 20:52:18 +02:00
Ophir LOJKINE
bb827c55ce
Add a macro for easy context definition
2019-04-15 00:07:07 +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
Sebastian Schmidt
697fbb5d45
Implement iterators over variable and function identifiers
...
Relates to #37
2019-04-13 20:16:05 +02:00
Sebastian Schmidt
83386c03d3
Improve documentation of builtin functions
...
Relates to #38
2019-04-13 18:12:33 +02:00