parse_error
Types
pub type ParseError {
EmptyString
WhitespaceOnlyString
InvalidUnderscorePosition(index: Int)
InvalidDecimalPosition(index: Int)
InvalidSignPosition(character: String, index: Int)
InvalidDigitPosition(character: String, index: Int)
OutOfBaseRange(
character: String,
value: Int,
base: Int,
index: Int,
)
InvalidExponentSymbolPosition(character: String, index: Int)
UnknownCharacter(character: String, index: Int)
InvalidBaseValue(base: Int)
}
Constructors
-
EmptyString
Represents an error when the input string is empty.
-
WhitespaceOnlyString
Represents an error when the input string contains only whitespace characters.
-
InvalidUnderscorePosition(index: Int)
Represents an error when an underscore is in an invalid position within the number string.
index
: The position of the invalid underscore in the input string.
-
InvalidDecimalPosition(index: Int)
Represents an error when a decimal point is in an invalid position within the number string.
index
: The position of the invalid decimal point in the input string.
-
InvalidSignPosition(character: String, index: Int)
Represents an error when a sign (+ or -) is in an invalid position within the number string.
character
: The sign character that caused the error as aString
.index
: The position of the invalid sign in the input string.
-
InvalidDigitPosition(character: String, index: Int)
Represents an error when a digit is in an invalid position within the number string.
character
: The digit character that caused the error as aString
.index
: The position of the invalid digit in the input string.
-
OutOfBaseRange( character: String, value: Int, base: Int, index: Int, )
Represents an error when a digit character is out of the valid range for the specified base.
character
: The string representation of the out-of-range digit.value
: The integer value of the out-of-range digit.base
: The base in which the digit is out of range.index
: The position of the out-of-range digit in the input string.
-
InvalidExponentSymbolPosition(character: String, index: Int)
Represents an error when an exponent symbol (e or E) is in an invalid position within the number string.
character
: The exponent symbol that caused the error as aString
.index
: The position of the invalid exponent symbol in the input string.
-
UnknownCharacter(character: String, index: Int)
Represents an error when an invalid character is encountered during parsing.
character
: The invalid character as aString
.index
: The position of the invalid character in the input string.
-
InvalidBaseValue(base: Int)
Represents an error when the base provided for parsing is invalid.
base
: The invalid base as anInt
. The base must be between 2 and 36 inclusive.