prelim work on xml typing including FixedPoint

master
Able 2023-04-01 13:08:43 -05:00
parent d8da4f3434
commit b2274fe422
1 changed files with 28 additions and 2 deletions

View File

@ -160,7 +160,7 @@ impl From<u64> 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<T: Debug + Display>(string: T) -> Result<Types, XMLError> {
@ -222,7 +222,33 @@ pub fn string_to_num<T: Debug + Display>(string: T) -> Result<Types, XMLError> {
}
// 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<char> = 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)
}