All notable changes to Parseff. See all releases on GitHub.
- Add
Source.of_seq. Creates a source from astring Seq.t. - Add
Source.of_chunks. Creates a source from a(unit -> string option)pull function. failnow produces.Failure of string</code> instead of <code>Expected- Add
catchcombinator.catch parser handlerintercepts`Failureerrors, allowing recovery within backtracking contexts. - Add
Parseff.Utf8module for Unicode-aware parsing.satisfy,char,any_char,take_while,skip_while,letter,digit,alphanum,whitespaceandtake_while_span. - Add
Parseff.BEandParseff.LEbinary parsing primitives. Big-endian and little-endian readers forany_uint8,any_int8,any_int16,any_uint16,any_int32,any_int64,any_float,any_double, and validatorsint16,int32,int64. - Add
locationandlocation_of_positionfor line/column tracking.location ()returns{ offset; line; col }during parsing (lazy, incremental, zero cost if unused).location_of_position input posconverts a byte offset after parsing — useful for error reporting. - BE/LE exact-match validators produce
.Expected</code> instead of <code>FailureBE.int16,BE.int32,BE.int64(and LE equivalents) are parser expectations, not user validation failures. or_now composes errors from both branches. When both branches fail at the same position,Expectedmessages are joined with" or "(e.g.,expected "foo" or expected "bar"). When branches fail at different positions, the error from the branch that consumed more input is kept. This also improvesone_of, which chainsor_and now naturally produces composed messages across all alternatives.- Register a printer for
Unhandled effects, warning the user about bad organitzation of the parser function
- Unified
*1variants into base combinators with~at_leastparameter.many1→many ~at_least:1,take_while1→take_while ~at_least:1,sep_by1→sep_by ~at_least:1,end_by1→end_by ~at_least:1,whitespace1→whitespace ~at_least:1. The~at_leastparameter generalizes beyond the binary zero-vs-one distinction (e.g.,many ~at_least:3requires at least three matches). The oldchainl1andchainr1were also removed in favor of making thedefaultargument optional (see next item). - Renamed
chainl/chainrtofold_left/fold_rightwith~otherwise.chainl1 p op→fold_left p op,chainl p op default→fold_left p op ~otherwise:default, and likewise forchainr/fold_right. The new names better describe what the combinators do (parse and fold with associativity) and align with OCaml’sList.fold_left/List.fold_rightnaming conventions. The~otherwiselabeled argument replaces the old positionaldefaultparameter, providing a fallback value when zero elements match.
Initial release of Parseff