forked from AbleOS/ableos_userland
prelim work on xml typing including FixedPoint
This commit is contained in:
parent
9101a1ad2f
commit
88a3fcd508
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue