diff --git a/src/lenient_parse.gleam b/src/lenient_parse.gleam index dea7e47..f5efe6e 100644 --- a/src/lenient_parse.gleam +++ b/src/lenient_parse.gleam @@ -65,11 +65,32 @@ pub fn to_int(text: String) -> Result(Int, ParseError) { } pub type ParseError { + /// Represents an error when an invalid character is encountered during + /// parsing. The `String` parameter contains the invalid character. InvalidCharacter(String) + + /// Represents an error when the input string is empty or contains only + /// whitespace. WhitespaceOnlyOrEmptyString + + /// Represents an error when an underscore is in an invalid position within + /// the number string. InvalidUnderscorePosition + + /// Represents an error when a decimal point is in an invalid position within + /// the number string. InvalidDecimalPosition + + /// Represents an error that occurs when Gleam's built-in `float.parse` fails + /// after our custom lenient parsing steps. This indicates that even with our + /// more permissive parsing rules, the string still couldn't be converted to a + /// float. GleamFloatParseError + + /// Represents an error that occurs when Gleam's built-in `int.parse` fails + /// after our custom lenient parsing steps. This indicates that even with our + /// more permissive parsing rules, the string still couldn't be converted to + /// an integer. GleamIntParseError }