Format code
This commit is contained in:
parent
ece22c6b35
commit
0acbcd8958
@ -1,9 +1,9 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use EvalexprError;
|
|
||||||
use EvalexprResult;
|
|
||||||
use function::Function;
|
use function::Function;
|
||||||
use value::value_type::ValueType;
|
use value::value_type::ValueType;
|
||||||
|
use EvalexprError;
|
||||||
|
use EvalexprResult;
|
||||||
|
|
||||||
use crate::value::Value;
|
use crate::value::Value;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
//! They are meant as shortcuts to not write the same error checking code everywhere.
|
//! They are meant as shortcuts to not write the same error checking code everywhere.
|
||||||
|
|
||||||
use token::PartialToken;
|
use token::PartialToken;
|
||||||
use value::{TupleType, value_type::ValueType};
|
use value::{value_type::ValueType, TupleType};
|
||||||
|
|
||||||
use crate::value::Value;
|
use crate::value::Value;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
use value::{FloatType, IntType};
|
||||||
use EvalexprError;
|
use EvalexprError;
|
||||||
use Function;
|
use Function;
|
||||||
use value::{FloatType, IntType};
|
|
||||||
use Value;
|
use Value;
|
||||||
|
|
||||||
pub fn builtin_function(identifier: &str) -> Option<Function> {
|
pub fn builtin_function(identifier: &str) -> Option<Function> {
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
use token;
|
||||||
|
use tree;
|
||||||
|
use value::TupleType;
|
||||||
use Context;
|
use Context;
|
||||||
use EmptyContext;
|
use EmptyContext;
|
||||||
use EvalexprError;
|
use EvalexprError;
|
||||||
@ -5,10 +8,7 @@ use EvalexprResult;
|
|||||||
use FloatType;
|
use FloatType;
|
||||||
use IntType;
|
use IntType;
|
||||||
use Node;
|
use Node;
|
||||||
use token;
|
|
||||||
use tree;
|
|
||||||
use Value;
|
use Value;
|
||||||
use value::TupleType;
|
|
||||||
|
|
||||||
/// Evaluate the given expression string.
|
/// Evaluate the given expression string.
|
||||||
///
|
///
|
||||||
|
@ -282,7 +282,7 @@ pub use error::{EvalexprError, EvalexprResult};
|
|||||||
pub use function::Function;
|
pub use function::Function;
|
||||||
pub use interface::*;
|
pub use interface::*;
|
||||||
pub use tree::Node;
|
pub use tree::Node;
|
||||||
pub use value::{FloatType, IntType, TupleType, Value, value_type::ValueType};
|
pub use value::{value_type::ValueType, FloatType, IntType, TupleType, Value};
|
||||||
|
|
||||||
mod context;
|
mod context;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
use token::Token;
|
||||||
|
use value::TupleType;
|
||||||
use EmptyContext;
|
use EmptyContext;
|
||||||
use FloatType;
|
use FloatType;
|
||||||
use IntType;
|
use IntType;
|
||||||
use token::Token;
|
|
||||||
use value::TupleType;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
context::Context,
|
context::Context,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
extern crate evalexpr;
|
extern crate evalexpr;
|
||||||
|
|
||||||
use evalexpr::{*, error::*};
|
use evalexpr::{error::*, *};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_unary_examples() {
|
fn test_unary_examples() {
|
||||||
@ -212,7 +212,7 @@ fn test_n_ary_functions() {
|
|||||||
expect_number(&arguments[2])?;
|
expect_number(&arguments[2])?;
|
||||||
|
|
||||||
if let (Value::Int(a), Value::Int(b), Value::Int(c)) =
|
if let (Value::Int(a), Value::Int(b), Value::Int(c)) =
|
||||||
(&arguments[0], &arguments[1], &arguments[2])
|
(&arguments[0], &arguments[1], &arguments[2])
|
||||||
{
|
{
|
||||||
Ok(Value::Int(a * b + c))
|
Ok(Value::Int(a * b + c))
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user