From 88a3fcd5085a87c0addcc82550d23fef8f92269b Mon Sep 17 00:00:00 2001 From: Able Date: Sat, 1 Apr 2023 13:08:43 -0500 Subject: [PATCH] prelim work on xml typing including FixedPoint --- libraries/xml/src/lib.rs | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/libraries/xml/src/lib.rs b/libraries/xml/src/lib.rs index 24defea..4533e44 100644 --- a/libraries/xml/src/lib.rs +++ b/libraries/xml/src/lib.rs @@ -160,7 +160,7 @@ impl From for UInt { #[test] pub fn test_string_to_num() { - println!("{:?}", string_to_num(256)); + println!("{:?}", string_to_num("-256.0")); } pub fn string_to_num(string: T) -> Result { @@ -222,7 +222,33 @@ pub fn string_to_num(string: T) -> Result { } // TODO: Decimal handler - {} + if false { + let mut split_string = string.split("."); + let positive; + let mut lhs = split_string.next().unwrap(); + + println!("{:?}", lhs.chars().next()); + + if lhs.chars().next() == Some('-') { + // lhs + positive = false; + let mut lhs_median: Vec = lhs.chars().collect(); + lhs_median.remove(0); + println!("A {:?}", lhs_median); + } else { + positive = true; + } + + println!("{:?}", lhs); + let mut lhs_final: Types = Types::None; + let abc = string_to_num(lhs); + + println!("{:?}", lhs_final); + let rhs = split_string.next(); + println!("{:?}", rhs); + + // return Types::Fixed(); + } Err(XMLError::TypeNotANumber) }