From b0e2697c8c5ab0a312b5f490fb35dfbda5d3e84c Mon Sep 17 00:00:00 2001 From: TudbuT Date: Sat, 18 Feb 2023 01:57:05 +0100 Subject: [PATCH] add number support --- src/lexer.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lexer.rs b/src/lexer.rs index b285f37..f1a285e 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -125,6 +125,12 @@ fn read_block(str_words: &[String], isfn: bool, origin: &FrameInfo) -> (Option { 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 => { let mut ra = 0; while x.starts_with("&") {