mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
fix: pass along parsed number string
This commit is contained in:
parent
a1f03355c0
commit
43674efb32
6 changed files with 34 additions and 16 deletions
|
@ -107,10 +107,14 @@ pub enum ParsedNumResult {
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn finish_parsing_num(raw: &str) -> Result<ParsedNumResult, (&str, IntErrorKind)> {
|
||||
pub fn finish_parsing_num(raw: &str) -> Result<(&str, ParsedNumResult), (&str, IntErrorKind)> {
|
||||
// Ignore underscores.
|
||||
let radix = 10;
|
||||
from_str_radix(raw.replace('_', "").as_str(), radix).map_err(|e| (raw, e))
|
||||
let (_, raw_without_suffix) = parse_literal_suffix(raw);
|
||||
match from_str_radix(raw.replace('_', "").as_str(), radix) {
|
||||
Ok(result) => Ok((raw_without_suffix, result)),
|
||||
Err(e) => Err((raw, e))
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue