Commit Graph

46 Commits

Author SHA1 Message Date
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
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
6c078c49e5 Refactor operators into an enum
(This commit is not formatted properly)

Relates to #46
2019-04-14 16:54:35 +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
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
7545d1f31e Fix ExpectedNumber error message
Relates to #40
2019-04-12 18:48:27 +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
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
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
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
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
Sebastian Schmidt
cba49f7bba Rename Error::Custom to Error::CustomMessage 2019-03-23 15:30:34 +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
a4d1a34a0c Implement Display and std::error::Error for Error
Relates to #19
2019-03-23 14:27:44 +02:00
Sebastian Schmidt
e337520805 Introduce TupleType type alias for representing tuples 2019-03-20 16:40:57 +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
6f17e481aa Ensure no-panic for operators
Partially implements #11
2019-03-20 12:52:11 +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
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
ed73f779e9 Add explanation about functions and precedences 2019-03-19 12:22:06 +02:00
Sebastian Schmidt
879f1fcd22 Evaluate arbitrary functions 2019-03-18 19:22:44 +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
1bc2909c1b Implemented and tested braces 2019-03-15 18:27:10 +02:00
Sebastian Schmidt
0ee4946eaf Implemented separate int and float types 2019-03-15 17:40:38 +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
fengcen
ce671d0f0a update serde to version 0.9, bump version 0.4.0 2017-02-13 08:26:47 +08:00
fengcen
3cb3197f6f add . and [] support. 2016-11-21 09:14:40 +08:00
fengcen
638b0d8af2 update document link. rename error. 2016-11-17 00:28:54 +08:00
fengcen
1d84eea270 init repository. 2016-11-17 00:12:26 +08:00