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 Feb 1, 2024
1 parent 71f0002 commit 4f9a822
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 @@ -601,11 +601,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 @@ -31,14 +31,14 @@ include "runtime/unsafe/tags"
include "runtime/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 @@ from Numbers use { 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) => {
}
from WasmI64 use { (*) }
// 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 4f9a822

Please sign in to comment.