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
ISibboI
2f7d1c2dfe
Merge pull request #38 from bittrance/string-operators
...
String operators and builtin functions
2019-04-13 18:02:24 +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
e328adb97b
Implement Node::iter_identifiers()
...
This commit implements an iterator over the identifiers in an expression.
The identifiers are iterated pre-order, meaning that higher nodes in the tree are emitted first.
The identifier iterator is based on a general iterator over all nodes in an operator tree, which can be used for further featues.
Relates to #37
2019-04-12 19:27:34 +02:00
Sebastian Schmidt
7545d1f31e
Fix ExpectedNumber
error message
...
Relates to #40
2019-04-12 18:48:27 +02:00
Sebastian Schmidt
15313f7341
Update target release
2019-04-12 18:45:46 +02:00
Quest
a9c45307dd
Support addition and comparison of strings.
2019-04-05 23:07:54 +02:00
Sebastian Schmidt
2caf000584
Export expect_function_argument_amount
2019-03-31 15:46:22 +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
c63206fa17
Add derive(Default)
to HashMapContext
2019-03-28 15:44:25 +01:00
Sebastian Schmidt
17bedddb11
Add serde support for HashMapContext
...
Relates to #33
2019-03-28 15:40:02 +01:00
Sebastian Schmidt
606c358cc9
Make operator table one-columned
2019-03-28 15:01:20 +01:00
Sebastian Schmidt
aeb584edca
Add quickstart documentation with chain and assign features
2019-03-28 12:09:46 +01:00
Sebastian Schmidt
44152533c3
Set release target to major
2019-03-28 11:49:06 +01:00
Sebastian Schmidt
ab49531306
Document chain operator
...
Relates to #26
2019-03-28 11:46:56 +01:00
Sebastian Schmidt
9d27969eac
Implement and test chain operator
...
Relates to #26
2019-03-28 11:34:54 +01:00
Sebastian Schmidt
4838a21a57
Add default implementation for Operator::is_left_to_right
2019-03-28 11:14:55 +01:00
Sebastian Schmidt
83269068a2
Add the assignment operator
...
Relates to #25
2019-03-28 11:12:47 +01:00
Sebastian Schmidt
13420ed745
Document the empty type
...
Relates to #28
2019-03-28 10:38:16 +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
a7b5f602d5
Do not require expressions to have content
...
* Make parser return implicit toplevel node
* Make `RootNode` return `Value::Empty` if it has no arguments instead of failing
Relates to #28
2019-03-28 10:10:16 +01:00
Sebastian Schmidt
88ab1e1987
Add Value::Empty
and ValueType::Empty
...
Relates to #28
2019-03-28 09:56:44 +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
6bd68e6491
Add eval_mut
function to Operator
trait
...
Relates to #30
2019-03-28 08:52:49 +01:00
Sebastian Schmidt
0acbcd8958
Format code
2019-03-28 08:44:04 +01:00
Sebastian Schmidt
ece22c6b35
Fix typo
2019-03-28 08:41:46 +01:00
Sebastian Schmidt
83451a9028
Use as_number in quickstart example
...
Otherwise the example would not allow mixed float and int arguments.
2019-03-28 08:41:16 +01:00
Sebastian Schmidt
6f31d69d7d
Prepare 2.0.0 release
2019-03-27 19:14:24 +01:00
Sebastian Schmidt
d77fa15864
Use EvalexprResult<T>
everywhere
...
Relates to #31
2019-03-27 19:09:58 +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
7d0abc8406
Rename as_float
to as_number
and add strict as_float
...
Relates to #20
2019-03-27 18:49:02 +01:00
Sebastian Schmidt
b18521b8aa
Format code
2019-03-27 18:35:16 +01:00
Sebastian Schmidt
24ca11e52a
Document how to enable serde feature flag
...
Relates to #21
2019-03-27 18:35:00 +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
7decb7c895
Make ValueType
public
2019-03-27 17:55:05 +01:00
Sebastian Schmidt
44041b03db
Make TupleType
alias public
2019-03-27 17:53:48 +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
Sebastian Schmidt
8a49bf9c11
Get rid of some unwraps
...
Relates to #14
2019-03-27 16:16:40 +01:00
Sebastian Schmidt
49da58976e
Improve serde readme
...
Relates to #18
2019-03-23 15:39:19 +02:00
Sebastian Schmidt
b302ad112d
Format code
2019-03-23 15:34:24 +02:00
Sebastian Schmidt
cba49f7bba
Rename Error::Custom to Error::CustomMessage
2019-03-23 15:30:34 +02:00
Sebastian Schmidt
16a79cd567
Remove serde: 🇩🇪 :Error implementation for error::Error
...
Serde forces us to be generic over which error our visitor returns, so we cannot return our error type.
So the implementation of serde's error trait is useless to us at this state.
Relates to #18
2019-03-23 15:27:18 +02:00
Sebastian Schmidt
a7ca4c717d
Implement, test and document serde Deserialize
for expressions
...
Relates to #18
2019-03-23 15:20:43 +02:00
Sebastian Schmidt
3d440524a5
Fix checking for serde feature flag in code
...
Relates to #18
2019-03-23 14:29:53 +02:00
Sebastian Schmidt
a4d1a34a0c
Implement Display and std::error::Error for Error
...
Relates to #19
2019-03-23 14:27:44 +02:00
Sebastian Schmidt
16bde54aa5
Implement display for Token and PartialToken
...
Relates to #19
2019-03-23 14:22:50 +02:00
Sebastian Schmidt
5e491f6771
Add serde feature
...
Relates to #18
2019-03-23 12:46:52 +02:00
Sebastian Schmidt
3a816fa7e7
Add highlighting to readme
2019-03-21 09:40:50 +02:00
Sebastian Schmidt
1375134e9f
Document operations on values
...
Relates to #16
2019-03-20 17:30:37 +02:00
Sebastian Schmidt
d3deef1f53
Provide more methods for value conversions
...
+ Provide is_[type] for each value type
+ Provide as_[type] for each value type
Related to #16
2019-03-20 17:30:14 +02:00
Sebastian Schmidt
d4359d71bf
Document the shortcut functions for direct evaluation into types
...
Related to #15
2019-03-20 17:06:47 +02:00
Sebastian Schmidt
c980e49014
Add shortcut functions to evaluate Node
into value types
...
+ Add functions `Node::eval_[type]` and `Node::eval_[type]_with_configuration` to evaluate a node directly into a value type
Partially implements #15
2019-03-20 16:57:21 +02:00
Sebastian Schmidt
e337520805
Introduce TupleType type alias for representing tuples
2019-03-20 16:40:57 +02:00
Sebastian Schmidt
98ca788910
Reword documentation of shortcut methods to be more direct
...
Changed `expecting a type` to `into a type` to be more clear that the function actually returns a result of the respecting type.
Related to #15
2019-03-20 16:34:23 +02:00
Sebastian Schmidt
2dac0576a7
Add shortcut functions for evaluating directly into a value type
...
+ Added shortcut functions `eval_[type]` and `eval_[type]_with_configuration` for each value type
+ Added integration tests for the above
Partially implements #15
2019-03-20 16:29:50 +02:00
Sebastian Schmidt
5549f1bba5
Make internal value type aliases for float and int public
2019-03-20 16:18:52 +02:00
Sebastian Schmidt
36a65c470b
Refactor lib.rs
...
* Move tests into integration test folder
* Move crate methods into interface module
2019-03-20 15:48:05 +02:00
Sebastian Schmidt
4177ae7e77
Prepare 1.0.0 release
2019-03-20 15:04:59 +02:00
Sebastian Schmidt
6f17e481aa
Ensure no-panic for operators
...
Partially implements #11
2019-03-20 12:52:11 +02:00
Sebastian Schmidt
58e8603194
Rename Node::eval
to Node::eval_with_configuration
for consistency.
...
* Rename `Node::eval` to `Node::eval_with_configuration`
+ Add `Node::eval` that calls `Node::eval_with_configuration` with an `EmptyConfiguration`
+ Improve documentation of `Node` and the changed methods
Implements #5
2019-03-20 11:58:08 +02:00
Sebastian Schmidt
e387d3370b
Fix a typo
2019-03-20 11:50:09 +02:00
Sebastian Schmidt
1ae674a693
Replace TypeError with more detailed errors
...
Implements #9
2019-03-20 11:42:17 +02:00
Sebastian Schmidt
38c4c35a0b
Document all remaining public members
...
Implements #6
2019-03-20 11:32:55 +02:00
Sebastian Schmidt
cdcd24e7b6
Document value type
...
Implements #6 partially
2019-03-19 20:31:03 +02:00
Sebastian Schmidt
6fe5a8cdef
Document toplevel functions
...
Implements #6
2019-03-19 20:24:11 +02:00
Sebastian Schmidt
4a32062089
Warn for missing docs
2019-03-19 20:13:04 +02:00
Sebastian Schmidt
827c7440be
Format code and sync readme
2019-03-19 20:12:30 +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
bcfce4aaec
Add trailing commas to match arm blocks
2019-03-19 19:06:37 +02:00
Sebastian Schmidt
f0ab317961
Test functions with arbitrary argument amount
...
Implements #7
2019-03-19 19:05:21 +02:00
Sebastian Schmidt
fd3243e555
Implement functions with arbitrary argument amount
...
Implements #7
2019-03-19 18:58:53 +02:00
Sebastian Schmidt
8e898044c0
Document the aggregation operator
...
Documents #4
2019-03-19 18:49:59 +02:00
Sebastian Schmidt
55e8b51228
Add exponentiation operator
...
+ Add hat token
+ Add exponentiation operator
+ Document exponentiation operator
+ Test exponentiation operator
Implements #3
2019-03-19 18:42:50 +02:00
Sebastian Schmidt
93e8d867b4
Add exponentation operator
...
+ Add hat token
+ Add exponentation operator
Implements #3
2019-03-19 18:32:10 +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
265b1214b0
Improve documentation about precedence and operators and README introduction
2019-03-19 16:47:17 +02:00
Sebastian Schmidt
c58d5dcda5
Test if functions can actually be called with multiple arguments
2019-03-19 12:47:01 +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
7896253fb9
Complete reimplementation
2019-03-19 12:27:43 +02:00
Sebastian Schmidt
ed73f779e9
Add explanation about functions and precedences
2019-03-19 12:22:06 +02:00
Sebastian Schmidt
2b9d50909e
Add quickstart guide and detailed explanation of features
2019-03-19 12:01:06 +02:00
Sebastian Schmidt
a51680da08
Add precedences to operators in docs
2019-03-19 11:03:34 +02:00
Sebastian Schmidt
33d26aceb0
Check how github renders readme
2019-03-19 10:43:52 +02:00
Sebastian Schmidt
79d8084baa
Add proper documentation
2019-03-18 19:51:20 +02:00
Sebastian Schmidt
d2336cb59d
Implement function to build operator tree
2019-03-18 19:25:43 +02:00
Sebastian Schmidt
879f1fcd22
Evaluate arbitrary functions
2019-03-18 19:22:44 +02:00
Sebastian Schmidt
22d0d2c3d0
Format code and specify exports
2019-03-18 18:02:45 +02:00
Sebastian Schmidt
b3a616c39a
Working on implementing functions
2019-03-15 20:26:25 +02:00
Sebastian Schmidt
3351d19db3
Tested configuration
2019-03-15 19:46:00 +02:00
Sebastian Schmidt
b1abbd6cfd
Implemented configuration
2019-03-15 19:29:36 +02:00
Sebastian Schmidt
406bfe0e05
rustfmt
2019-03-15 19:22:14 +02:00
Sebastian Schmidt
bb74bee382
Implemented boolean expressions
2019-03-15 19:19:59 +02:00
Sebastian Schmidt
a1ba054609
Implemented mod and replaced Braced with RootNode
2019-03-15 18:34:40 +02:00
Sebastian Schmidt
1bc2909c1b
Implemented and tested braces
2019-03-15 18:27:10 +02:00
Sebastian Schmidt
879fc4fe3d
Tested separate int and float types
2019-03-15 17:43:26 +02:00
Sebastian Schmidt
0ee4946eaf
Implemented separate int and float types
2019-03-15 17:40:38 +02:00
Sebastian Schmidt
22490f5036
Tested arithmetic precedence
2019-03-15 17:24:45 +02:00
Sebastian Schmidt
3975a17f0b
Fixed warnings and removed unused dependencies.
2019-03-15 17:21:34 +02:00
Sebastian Schmidt
045313f076
More test cases
2019-03-15 17:18:20 +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
Sebastian Schmidt
c313ec8ce5
Deciding to try a reboot
2019-03-15 13:42:18 +02:00
Sebastian Schmidt
f3d6c2b7ed
Updated readme
2019-03-15 13:12:18 +02:00
Sebastian Schmidt
1e5e9a3ae9
Added converge builtin function
2019-03-15 12:04:01 +02:00
fengcen
0c4413836d
fix #2
2018-08-24 09:09:55 +08:00
fengcen
daf3f5bd4a
allow null to compare
2017-12-07 07:24:12 +08:00
fengcen
ce671d0f0a
update serde to version 0.9, bump version 0.4.0
2017-02-13 08:26:47 +08:00
fengcen
ed7398ca30
fix bench.
2016-11-22 08:32:04 +08:00
fengcen
c2e3401c74
fix compile in stable.
2016-11-22 07:51:18 +08:00
fengcen
3cb3197f6f
add .
and []
support.
2016-11-21 09:14:40 +08:00
fengcen
032e57df43
add Expr builder. add ExecOptions. add len()
2016-11-20 16:04:06 +08:00
fengcen
fa9c6a4430
change readme.
2016-11-18 12:03:03 +08:00
fengcen
3c19414593
format code.
2016-11-17 23:53:17 +08:00
fengcen
3729348632
remove redundant code.
2016-11-17 08:35:02 +08:00
fengcen
638b0d8af2
update document link. rename error.
2016-11-17 00:28:54 +08:00