nom v2.0 Release Notes
Release Date: 2016-11-25 // over 7 years ago-
๐ The 2.0 release is one of the biggest yet. It was a good opportunity to clean up some badly named combinators and fix invalid behaviours.
Since this version introduces a few breaking changes, an upgrade documentation is available, detailing the steps to fix the most common migration issues. After testing on a set of 30 crates, most of them will build directly, a large part will just need to activate the "verbose-errors" compilation feature. The remaining fixes are documented.
๐ This version also adds a lot of interesting features, like the permutation combinator or whitespace separated formats support.
Thanks
- @lu-zero for license help
- ๐ @adamgreig for type inference fixes
- ๐ @keruspe for documentation and example fixes, for the
IResult => Result
conversion work, makingAsChar
's method more consistent, and addingmany_till!
- @jdeeny for implementing
Offset
on&str
- @vickenty for documentation fixes and his refactoring of
length_value!
andlength_bytes!
- ๐จ @overdrivenpotato for refactoring some combinators
- ๐ @taralx for documentation fixes
- ๐ @keeperofdakeys for fixing eol behaviour, writing documentation and adding
named_attr!
- ๐ @jturner314 for writing documentation
- @bozaro for fixing compilation errors
- @uniphil for adding a
crates.io
badge - ๐ @badboy for documentation fixes
- @jugglerchris for fixing
take_s!
- @AndyShiue for implementing
Error
andDisplay
onErrorKind
and detecting incorrect UTF-8 string indexing
โ Added
- 0๏ธโฃ the "simple" error management system does not accumulates errors when backtracking. This is a big perf gain, and is activated by default in nom 2.0
- nom can now work on any type that implement the traits defined in
src/traits.rs
:InputLength
,InputIter
,InputTake
,Compare
,FindToken
,FindSubstring
,Slice
- ๐ the documentation from Github's wiki has been moved to the
doc/
directory. They are markdown files that you can build with cargo-external-doc - ๐ whitespace separated format support: with the
ws!
combinator, you can automatically introduce whitespace parsers between all parsers and combinators - ๐ the
permutation!
combinator applies its child parsers in any order, as long as they all succeed once, and return a tuple of the results - ๐
do_parse!
is a simpler alternative tochain!
, which is now deprecated - you can now transform an
IResult
in astd::result::Result
- ๐
length_data!
parses a length, and returns a subslice of that length tag_no_case!
provides case independent comparison. It works nicely, without any allocation, for ASCII strings, but for UTF-8 strings, it defaults to an unsatisfying (and incorrect) comparison by lowercasing both strings- ๐
named_attr!
creates functions likenamed!
but can add attributes like documentation - ๐
many_till!
applies repeatedly its first child parser until the second succeeds
๐ Changed
- the "verbose" error management that was available in previous versions is now activated by the "verbose-errors" compilation feature
- ๐ code reorganization: most of the parsers were moved in separate files to make the source easier to navigate
- most of the combinators are now independent from the input type
- the
eof
function was replaced with theeof!
macro error!
andadd_error!
were replaced withreturn_error!
andadd_return_error!
to fix the name conflict with the log crate- the
offset()
method is now in theOffset
trait length_value!
has been renamed tolength_count!
. The newlength_value!
selects a slice and applies the second parser once on that sliceAsChar::is_0_to_9
is nowAsChar::is_dec_digit
- ๐ง the combinators with configurable endianness now take an enum instead of a boolean as parameter
๐ Fixed
- ๐ the
count!
,count_fixed!
andlength_*!
combinator calculate incomplete data needs correctly eol
,line_ending
andnot_line_ending
now have a consistent behaviour that works correctly with incomplete datatake_s!
didn't correctly handle the case when the slice is exactly the right length