Releases: HallMatthew314/bad_parsers
Releases · HallMatthew314/bad_parsers
v0.2.0-unstable
[0.2.0-unstable]
Added
- Changelog
- Example: JSON lexer + parser
ParseError::map_error_details: a more convenient function for changing error detailstrailing+ method version: a combinator similar toleft, but allows the second parser to failwas_parsed+ method version: a combinator similar tooptionalthat returns a booleanParseError::append_errorandParseError::prepend_errorfor more convenient error details modification
Fixed
- The functions
left,recover,recover_default,right, andtrailingno longer have theT: 'aconstraint.
Breaking Changes
- A new convention for error constructor functions has been established:
- First argument:
details: &str, required on all constructors - Second argument (if applicable):
loc: Toks, not required of constructors for situations where no meaningful value can be provided (e.g.,empty_input). - All other arguments following these are specific to the type of error being constructed
- First argument:
- Due to the above: the following constructor function arguments have changed:
empty_input()is nowempty_input(details: &str)unexpected_input(loc: Toks)is nowunexpected_input(deatils: &str, loc: Toks)not_enough(loc: Toks, needed: usize, got: usize)is nownot_enough(details: &str, loc: Toks, needed: usize, got: usize)other(cause: E, loc: Toks)is nowother(details: &str, loc: Toks, cause: E)
- Some other methods of
ParseErrorwere renamed to better suit Rust's conventions:ParseError::get_detailsrenamed toParseError::detailsParseError::set_detailsrenamed toParseError::overwrite_detailsParseError::get_locrenamed toParseError::locParseError::get_loc_non_emptyrenamed toParseError::loc_non_empty
- Newly-named
ParseError::detailsfunction returns&strinstead ofOption<&str> - Combinator
error_detailsrenamed tomap_error_details
Non-Breaking Changes
- Added documentation link to Cargo.toml
- Made the default error details for
tokenmore useful - Changed some doctests to use the new
map_error_detailsfunction - Various superfluous changes to documentation
- Modified the template string in
ParseError's implementation ofDisplay