diff --git a/query/Cargo.toml b/query/Cargo.toml index e2b7baa7..c074054a 100644 --- a/query/Cargo.toml +++ b/query/Cargo.toml @@ -6,3 +6,6 @@ version = "0.0.1" [dependencies.edn] path = "../edn" + +[dependencies.mentat_core] + path = "../core" diff --git a/query/src/lib.rs b/query/src/lib.rs index be81992c..000122a6 100644 --- a/query/src/lib.rs +++ b/query/src/lib.rs @@ -31,9 +31,11 @@ ///! a tradeoff against well-typed function signatures and other such boundaries. extern crate edn; +extern crate mentat_core; use edn::{BigInt, OrderedFloat}; pub use edn::{NamespacedKeyword, PlainSymbol}; +use mentat_core::TypedValue; pub type SrcVarName = String; // Do not include the required syntactic '$'. @@ -101,6 +103,17 @@ pub enum NonIntegerConstant { Text(String), } +impl NonIntegerConstant { + pub fn into_typed_value(self) -> TypedValue { + match self { + NonIntegerConstant::BigInteger(_) => unimplemented!(), // TODO: #280. + NonIntegerConstant::Boolean(v) => TypedValue::Boolean(v), + NonIntegerConstant::Float(v) => TypedValue::Double(v), + NonIntegerConstant::Text(v) => TypedValue::String(v), + } + } +} + pub enum FnArg { Variable(Variable), SrcVar(SrcVar),