feat: switch to using a builtin per num type to convert from a string

This commit is contained in:
rvcas 2021-12-06 22:24:00 -05:00
parent bc5b1abcba
commit e587e20de2
6 changed files with 122 additions and 25 deletions

View file

@ -195,7 +195,11 @@ impl LowLevel {
Symbol::STR_TRIM => Some(StrTrim),
Symbol::STR_TRIM_LEFT => Some(StrTrimLeft),
Symbol::STR_TRIM_RIGHT => Some(StrTrimRight),
Symbol::STR_TO_NUM => Some(StrToNum),
Symbol::STR_TO_DEC => Some(StrToNum),
Symbol::STR_TO_F64 => Some(StrToNum),
Symbol::STR_TO_F32 => Some(StrToNum),
Symbol::STR_TO_NAT => Some(StrToNum),
Symbol::STR_TO_U64 => Some(StrToNum),
Symbol::LIST_LEN => Some(ListLen),
Symbol::LIST_GET => None,
Symbol::LIST_SET => None,

View file

@ -1029,7 +1029,12 @@ define_builtins! {
18 STR_TRIM: "trim"
19 STR_TRIM_LEFT: "trimLeft"
20 STR_TRIM_RIGHT: "trimRight"
21 STR_TO_NUM: "toNum"
21 STR_TO_DEC: "toDec"
22 STR_TO_F64: "toF64"
23 STR_TO_F32: "toF32"
24 STR_TO_NAT: "toNat"
25 STR_TO_U64: "toU64"
}
4 LIST: "List" => {
0 LIST_LIST: "List" imported // the List.List type alias