Crate expressive

Source
Expand description

Expressive, the whale language.

Re-exports§

pub use crate::error::EvalexprError;
pub use crate::error::EvalexprResult;

Modules§

error
The error module contains the Error enum that contains all error types used by this crate.

Macros§

context_map
This macro provides a convenient syntax for creating a static context.
math_consts_context
Context with all Rust’s constants in f64::consts available by default. Alternatively, specifiy constants with math_consts_context!(E, PI, TAU, ...) Available constants can be found in the core::f64::consts module.

Structs§

Function
A user-defined function. Functions can be used in expressions by storing them in a Context.
Node
A node in the operator tree. The operator tree is created by the crate-level build_operator_tree method. It can be evaluated for a given context with the Node::eval method.
VariableMap
A context that stores its mappings in hash maps.

Enums§

Operator
An enum that represents operators in the operator tree.
PartialToken
A partial token is an input character whose meaning depends on the characters around it.
Value
The value type used by the parser. Values can be of different subtypes that are the variants of this enum.
ValueType
The type of a Value.

Constants§

EMPTY_VALUE
The value of the empty type to be used in rust.

Traits§

Context
An immutable context.
ContextWithMutableFunctions
A context that allows to assign to function identifiers.
ContextWithMutableVariables
A context that allows to assign to variables.

Functions§

build_operator_tree
Build the operator tree for the given expression string.
eval
Evaluate the given expression string.
eval_boolean
Evaluate the given expression string into a boolean.
eval_boolean_with_context
Evaluate the given expression string into a boolean with the given context.
eval_boolean_with_context_mut
Evaluate the given expression string into a boolean with the given mutable context.
eval_empty
Evaluate the given expression string into an empty value.
eval_empty_with_context
Evaluate the given expression string into an empty value with the given context.
eval_empty_with_context_mut
Evaluate the given expression string into an empty value with the given mutable context.
eval_float
Evaluate the given expression string into a float.
eval_float_with_context
Evaluate the given expression string into a float with the given context.
eval_float_with_context_mut
Evaluate the given expression string into a float with the given mutable context.
eval_int
Evaluate the given expression string into an integer.
eval_int_with_context
Evaluate the given expression string into an integer with the given context.
eval_int_with_context_mut
Evaluate the given expression string into an integer with the given mutable context.
eval_number
Evaluate the given expression string into a float. If the result of the expression is an integer, it is silently converted into a float.
eval_number_with_context
Evaluate the given expression string into a float with the given context. If the result of the expression is an integer, it is silently converted into a float.
eval_number_with_context_mut
Evaluate the given expression string into a float with the given mutable context. If the result of the expression is an integer, it is silently converted into a float.
eval_string
Evaluate the given expression string into a string.
eval_string_with_context
Evaluate the given expression string into a string with the given context.
eval_string_with_context_mut
Evaluate the given expression string into a string with the given mutable context.
eval_tuple
Evaluate the given expression string into a tuple.
eval_tuple_with_context
Evaluate the given expression string into a tuple with the given context.
eval_tuple_with_context_mut
Evaluate the given expression string into a tuple with the given mutable context.
eval_with_context
Evaluate the given expression string with the given context.
eval_with_context_mut
Evaluate the given expression string with the given mutable context.

Type Aliases§

EmptyType
The type used to represent empty values in Value::Empty.
FloatType
The type used to represent floats in Value::Float.
IntType
The type used to represent integers in Value::Int.
Result
TupleType
The type used to represent tuples in Value::Tuple.