Skip to content

Parsita 1.8.0

Compare
Choose a tag to compare
@drhagen drhagen released this 23 Jun 09:14
· 59 commits to master since this release

This is likely to be the last minor release in the 1.x series. It is mainly intended to ease the transition to version 2. Bug fixes will continue to be made to the 1.8.x series, but new features will be added only to the 2.x series unless backporting is not particularly painful.

  • Create ParserContext as a new context that behaves like TextParsers, but has a default whitespace of None.
    • TextParsers and GeneralParsers are now deprecated in favor of ParserContext, which will be the only context starting in 2.0.0.
  • Parsita Result now inherits from returns.Result.
    • The inheritance purely implements the Parsita-specific methods (Result.or_die, Success.value Failure.message) and deprecates them to ease transition to 2.0.0, when Parsita will reexport the classes from Returns unmodified.
  • Failure now wraps the ParseError exception rather than a string. Failure.message still gives a string.
    • This makes room for ParseError keeping useful information as attributes rather than the information being destroyed into a string.
  • Make reg work in a GeneralParsers context and on bytes (contributed by Chris Wheeler).
    • Add .drop to the Reader base class
    • Add efficient .drop method to the SequenceReader class
    • Change RegexParser to allow bytes

Code that runs in Parsita 1.x should run in 1.8.0, though with with deprecation warnings. Code that runs in 1.8.0 without deprecation warnings should run in Parsita 2.x. Note that this only applies to code that uses the Parsita parsers. If you wrote your own parser (i.e. you inherit from Parser), it's just going to have be fixed in 2.0; the internals of Parsita were changed to much to have custom parsers work in both versions.