Skip to content

Releases: drhagen/parsita

Parsita 1.6.0

23 Sep 14:06
Compare
Choose a tag to compare

One new feature and a refactoring of the tests:

  • Added the TransformationParser which is exposed through the >= operator
  • All tests were refactored from unittest style to pytest style

Parsita 1.5.0

06 Aug 01:13
Compare
Choose a tag to compare

One new feature and a deprecation:

  • Added the LongestAlternativeParser parser and its alias longest (#21)
  • Added first as an alias for AlternativeParser, which is the parser behind the | operator
  • Deprecation warning: In Parsita 2.0, the | operator will use longest instead of first, and AlternativeParser will be renamed to FirstAlternativeParser. This is intended to make alternatives more intuitive. first and longest behave the same in most cases, but users should explicitly switch from | to first if the current behavior is desired.

A handful of other changes:

  • Dropped Python 3.6 support
  • Improved documentation and type hints of Result

Overhaul of infrastructure and some refactorings to latest Python features (no changes to package behavior):

  • Created a documentation website
  • Moved continuous integration from TravisCI to GitHub Actions
  • Migrated the build system from setuptools to poetry
  • Switched from tox to nox-poetry
  • Added black and isort as code quality tools
  • Refactored all string type annotations to use from __future__ import annotations now that Python 3.6 is gone
  • Refactored all .format calls to use f-strings now that Python 3.5 is gone

Parsita 1.4.1

17 Dec 02:47
Compare
Choose a tag to compare

Maintenance release with no change in behavior:

  • Add support for Python 3.9
  • Drop support for Python 3.5
  • Fix typos in README examples

Parsita 1.4.0

07 Jun 10:11
Compare
Choose a tag to compare

One new feature and a few minor bug fixes:

  • Add the PredicateParser, which allows for a boolean-returning function to be applied to the result of a parser to determine if the result is acceptable
  • Do not crash if StringReader.next_token_regex does not match
  • In RegexParser.__repr__, appropriately prepend name_or_nothing
  • Various fixes to type hints

Thanks to @arseniiv for contributing to this release.

Parsita 1.3.3

17 Nov 14:06
Compare
Choose a tag to compare

Update supported Python versions:

  • Add support for Python 3.8
  • Drop support for Python 3.4
  • Disallow instantiation of Parsers classes. This was never supposed to be allowed and now raises a good exception.

Parsita 1.3.2

25 Jul 16:04
Compare
Choose a tag to compare

Update in supported Python versions:

  • Add support for newly released Python 3.7
  • Drop support for end-of-life Python 3.3

Parsita 1.3.1

28 Apr 17:47
Compare
Choose a tag to compare

Improvements in ergonomics:

  • Whitespace is now consumed from both sides of tokens in TextParsers. Previously, it was only consumed from the trailing ends of tokens, leaving the leading whitespace to the previous parser. This resulted in weird interactions between parsers that ignored whitespace and those that did not (e.g. examples/json.py). It was thought that consuming whitespace from both sides would harm performance, but that turned out to not be the case. Typical parsers should be completely unaffected, while atypical parsers should be a little more predictable.

  • Parsita always reports the failure message of the parser that consumed the most input, which is usually the most helpful message when many alternative branches fail. Previously, if multiple alternatives failed at the same position in the input, the first parser to get that far was the one reported. Now, when multiple alternatives fail at the same place, all expected values are included in the final failure message. This should improve the readability of error messages as the user can see all possible values for the next token at that position.

  • Because failure messages need to be mergable, the previously undocumented failure parser was changed so that it will not display an arbitrary failure message, but only an arbitrary expected value. Due to the limited utility of failure, it was considered a reasonable tradeoff to get better failure messages for the rest of the standard parsers at the expense of failure.

  • Added success and failure dummy parsers to the tutorial so that there is some documentation for these.

  • If the internal member of a repeated parser matches an empty string, then the repeated parser will match an empty string forever. When this situation is detected, Parsita now raises a runtime exception, rather than hanging.

Parsita 1.3.0

28 Apr 17:23
Compare
Choose a tag to compare

Release documentation was broken on PyPI. Parsita 1.3.1 was released immediately with identical code.

Parsita 1.2.1

02 Apr 00:55
Compare
Choose a tag to compare

Magic classes (TextParsers and GeneralParsers) now restore the state of the global options (whitespace, handle_literal, parse_method) to what they were when the class started to run rather than to the defaults. This means that magic classes can be now be nested and magic classes will not clobber any manually set options.

Parsita 1.2.0

06 Oct 00:54
Compare
Choose a tag to compare

Improvements to error messages and new utility functions:

  • TextParsers error messages now provide line and character location rather than index into string
  • Added parsita.util module with contant, splat, and unsplat helper functions
  • Added a URL parser example to source