- Upgraded dependencies.
- Moved
parse_errorinto packagelenient_parsenamespace. This is a breaking change. You'll need to update anyparse_errorimports:
import parse_error -> import lenient_parse/parse_error
- Handled values that breach either the
Number.MIN_SAFE_INTEGERorNumber.MAX_SAFE_INTEGERlimit on the JavaScript target. - Handled values that cannot fit within the float type, on both Erlang and JavaScript targets.
This is a breaking change, as we introduced new errors to ParseError, which will affect users who are matching on the ParseError type:
OutOfIntRangeOutOfFloatRange
- Fixed a bug where base prefix substrings would be recognized as such later in the string.
- The
0bin0XDEAD_BEEF0bshould be catorgized as digits and not a base prefix.
- The
- Fixed a bug where, in base 0 mode,
lenient_parsewould parse a string with an incomplete base prefix.01should reject, as it is missing a specifier (b,B,o,O,x,X).
- Fixed a bug where
lenient_parsewas rejecting strings containing leading / trailing uncommon whitespace characters.
- Fixed precision errors. We now rely on
bigiandpilkkuto construct the final float representation.
- Fixed precision errors in some float representations by removing the need to add together the integer and fractional parts of a float.
- Fixed a bug where an underscore was not allowed in between a base prefix string and the number:
0x_DEAD_BEEFshould parse.
- Added base 0 support to
lenient_parse.to_int_with_base. When providing a base of 0, the function will look for a base prefix string (0b,0o,0x) to try to determine the base value. If no prefix is found, the function will default to base 10.
- Added arbitrary base support for integer parsing - use pub
lenient_parse.to_int_with_base. - Introduced
OutOfBaseRangeandInvalidBaseValueerrors.
- Added support for scientific notation for float parsing.
- Ex:
lenient_parse.to_float("4e-3")// Ok(0.004)
- Ex:
- Implemented a new recursive descent parser.
- Breaking changes:
GleamIntParseErrorandGleamIntParseErrorReasonhave been removed.InvalidCharacterhas been renamed toUnknownCharacter.- A new
InvalidDigitPositionerror has been introduced.
- Fixed bugs.
- Return custom error types for various parsing errors instead of simply
Nil. - Reworked internal algorithm for more robust parsing.
- Added more examples to
README.md.
- Initial release.