j-mie6 / parsley

A fast and modern parser combinator library for Scala
https://j-mie6.github.io/parsley/
BSD 3-Clause "New" or "Revised" License
173 stars 15 forks source link

Added flexible carets for `unexpected`/`fail` #189

Closed j-mie6 closed 1 year ago

j-mie6 commented 1 year ago

Both fail and unexpected have rigid error carets, such that they can only be other like errors.

This PR introduces flexibility into these combinators: if the caret width is not manually specified, the caret is considered flexible, which means that it can be influenced by other errors on merge:

The rules are similar for unexpected, where a rigid caret replaces flexible ones. All relevant unexpected/fail based filtering combinators are defined rigidly, preserving their current semantics.

To recover the pre-4.2.11 behaviour on fail and unexpected, specify at caret width of 1 -- this change is added as these behaviours make much more sense, and the original behaviour is preservable.

codeclimate[bot] commented 1 year ago

Code Climate has analyzed commit a3b5875c and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 71.2% (50% is the threshold).

This pull request will bring the total coverage in the repository to 90.9% (0.0% change).

View more on Code Climate.