add number support

This commit is contained in:
Daniella / Tove 2023-02-18 01:57:05 +01:00
parent f76e03c5e6
commit b0e2697c8c
Signed by: TudbuT
GPG key ID: 7D63D5634B7C417F

View file

@ -125,6 +125,12 @@ fn read_block(str_words: &[String], isfn: bool, origin: &FrameInfo) -> (Option<u
x if x.starts_with("\"") => { x if x.starts_with("\"") => {
words.push(Word::Const(Constant::Str(x[1..].to_owned()))); words.push(Word::Const(Constant::Str(x[1..].to_owned())));
} }
x if x.chars().all(|c| c.is_numeric() || c == '_') && !x.starts_with("_") => {
words.push(Word::Const(Constant::Mega(x.parse().unwrap())));
}
x if x.chars().all(|c| c.is_numeric() || c == '.' || c == '_') && !x.starts_with("_") => {
words.push(Word::Const(Constant::Double(x.parse().unwrap())));
}
mut x => { mut x => {
let mut ra = 0; let mut ra = 0;
while x.starts_with("&") { while x.starts_with("&") {