From 4b55aac15f7d6c0a181b0dae5de74f7a055bee76 Mon Sep 17 00:00:00 2001 From: Devin Bidwell Date: Mon, 25 Nov 2024 20:08:09 -0700 Subject: [PATCH] Support underscores in decimal places --- src/tokenizer/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/tokenizer/mod.rs b/src/tokenizer/mod.rs index 4bb9783..67b3a99 100644 --- a/src/tokenizer/mod.rs +++ b/src/tokenizer/mod.rs @@ -667,6 +667,13 @@ This is a skippable line"#, fn test_parse_decimal_with_underscore() -> Result<()> { let mut tokenizer = Tokenizer::from(String::from("1_000.000_6")); + let token = tokenizer.next_token()?.unwrap(); + + assert_eq!( + token.token_type, + TokenType::Number(Number::Decimal(Decimal::new(10000006, 4))) // 1000.0006 + ); + Ok(()) }