This commit is contained in:
Stephen Chung 2021-12-18 17:47:35 +08:00
parent 9736171089
commit 7eda6454a8
2 changed files with 8 additions and 3 deletions

View File

@ -1516,9 +1516,7 @@ fn get_next_token_inner(
} else { } else {
let out: String = let out: String =
result.iter().filter(|&&c| c != NUMBER_SEPARATOR).collect(); result.iter().filter(|&&c| c != NUMBER_SEPARATOR).collect();
let num = INT_BASE::from_str(&out) let num = INT::from_str(&out).map(Token::IntegerConstant);
.map(|v| v as INT)
.map(Token::IntegerConstant);
// If integer parsing is unnecessary, try float instead // If integer parsing is unnecessary, try float instead
#[cfg(not(feature = "no_float"))] #[cfg(not(feature = "no_float"))]

View File

@ -136,6 +136,13 @@ fn test_blobs_parse() -> Result<(), Box<EvalAltResult>> {
0x1cf588 0x1cf588
); );
assert_eq!(
engine.eval::<Blob>(
"let x = blob(16, 0); x.write_be(0, 8, 0x1234567890abcdef); x.write_be(8, 8, 0xabcdef1234567890); x"
)?,
vec![0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef, 0xab, 0xcd, 0xef, 0x12, 0x34, 0x56, 0x78, 0x90]
);
Ok(()) Ok(())
} }