Skip to content

Commit

Permalink
chore: Correct spelling of parse
Browse files Browse the repository at this point in the history
  • Loading branch information
spotandjake committed Mar 3, 2024
1 parent 1b9c1ef commit ff26f8d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions compiler/test/stdlib/number.test.gr
Expand Up @@ -625,11 +625,11 @@ assert Result.isErr(Number.parseInt("zzzzz", 9223372036854775807))
assert Result.isErr(Number.parseInt("10", 1.23))
assert Result.isErr(Number.parseInt("10", 2/3))
assert match (Number.parseInt("zzzzz", 10)) {
Err(Number.PraseIntInvalidDigit) => true,
Err(Number.ParseIntInvalidDigit) => true,
_ => false,
}
assert match (Number.parseInt("", 10)) {
Err(Number.PraseIntEmptyString) => true,
Err(Number.ParseIntEmptyString) => true,
_ => false,
}
assert match (Number.parseInt("10", 2/3)) {
Expand Down
8 changes: 4 additions & 4 deletions stdlib/number.gr
Expand Up @@ -43,14 +43,14 @@ from "runtime/unsafe/tags" include Tags
from "runtime/exception" include Exception

from Atoi use {
exception PraseIntEmptyString,
exception PraseIntInvalidDigit,
exception ParseIntEmptyString,
exception ParseIntInvalidDigit,
exception ParseIntInvalidRadix,
}

provide {
exception PraseIntEmptyString,
exception PraseIntInvalidDigit,
exception ParseIntEmptyString,
exception ParseIntInvalidDigit,
exception ParseIntInvalidRadix,
}
/**
Expand Down
12 changes: 6 additions & 6 deletions stdlib/runtime/atoi/parse.gr
Expand Up @@ -25,13 +25,13 @@ use Numbers.{ reducedInteger }
*
* @since v0.6.0
*/
provide exception PraseIntEmptyString
provide exception ParseIntEmptyString
/**
* Represents an error caused by trying to parse a string with an invalid character.
*
* @since v0.6.0
*/
provide exception PraseIntInvalidDigit
provide exception ParseIntInvalidDigit
/**
* Represents an error caused by trying to parse with an invalid radix.
*
Expand Down Expand Up @@ -81,7 +81,7 @@ provide let parseInt = (string: String, radix: Number) => {
}

if (WasmI32.eqz(strLen)) {
return Err(PraseIntEmptyString)
return Err(ParseIntEmptyString)
}

let mut char = WasmI32.load8U(offset, 0n)
Expand Down Expand Up @@ -142,12 +142,12 @@ provide let parseInt = (string: String, radix: Number) => {
c when c - _CHAR_A < 26n => digit = char - _CHAR_A + 10n,
c when c - _CHAR_a < 26n => digit = char - _CHAR_a + 10n,
_ => {
return Err(PraseIntInvalidDigit)
return Err(ParseIntInvalidDigit)
},
}

if (digit >= WasmI32.wrapI64(radix)) {
return Err(PraseIntInvalidDigit)
return Err(ParseIntInvalidDigit)
}

let digit = WasmI64.extendI32U(digit)
Expand Down Expand Up @@ -193,7 +193,7 @@ provide let parseInt = (string: String, radix: Number) => {
}
use WasmI64.{ (*) }
// TODO: Verify this is suitable for handling "_"
if (WasmI32.eqz(sawDigit)) return Err(PraseIntInvalidDigit)
if (WasmI32.eqz(sawDigit)) return Err(ParseIntInvalidDigit)

if (WasmI32.eqz(isBigInt)) {
let value = if (negative) value else value * -1N
Expand Down

0 comments on commit ff26f8d

Please sign in to comment.