nom v0.2.0 Release Notes
Release Date: 2015-03-24 // about 9 years ago-
works with
rustc 1.0.0-dev (81e2396c7 2015-03-19) (built 2015-03-19)
Thanks
- Ryman for the AsBytes implementation
- ๐ jag426 and jaredly for documentation fixes
- eternaleye on #rust IRC for his help on the new macro syntax
๐ Changed
- the AsBytes trait improves readability, no more b"...", but "..." instead
- Incomplete will now hold either Needed;;Unknown, or Needed::Size(u32). Matching on Incomplete without caring for the value is done with
Incomplete(_)
, but if more granularity is mandatory,Needed
can be matched too - ๐
alt!
can pass the result of the parser to a closure - 0๏ธโฃ the
take_*
macros changed behaviour, the default case is now not to consume the separator. The macros have been renamed as follows:take_until!
->take_until_and_consume!
,take_until_and_leave!
->take_until!
,take_until_either_and_leave!
->take_until_either!
,take_until_either!
->take_until_either_and_consume!
โ Added
peek!
macro: matches the future input but does not consume it- ๐
length_value!
macro: the first argument is a parser returning an
that can cast to usize, then applies the second parsern
times. The macro has a variant with a third argument indicating the expected input size for the second parser - benchmarks are available at https://github.com/Geal/nom_benchmarks
- ๐ more documentation
- ๐ Unnamed parser syntax: warning, this is a breaking change. With this new syntax, the macro combinators do not generate functions anymore, they create blocks. That way, they can be nested, for better readability. The
named!
macro is provided to create functions from parsers. Please be aware that nesting parsers comes with a small cost of compilation time, negligible in most cases, but can quickly get to the minutes scale if not careful. If this happens, separate your parsers in multiple subfunctions. - ๐
named!
,closure!
andcall!
macros used to support the unnamed syntax map!
,map_opt!
andmap_res!
to combine a parser with a normal function, transforming the input directly, or returning anOption
orResult
๐ Fixed
is_a!
is now working properly
โ Removed
- ๐ the
o!
macro does less thanchain!
, so it has been removed - the
fold0!
andfold1!
macros were too complex and awkward to use, themany*
combinators will be useful for most uses for now