NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io · #136 most downloaded on crates.io
A byte-oriented, zero-copy, parser combinators library
Last release 2 years ago
no release in 18 months
Release timing varies
gaps range from 1 weeks to 12 months
Nearly every release is documented
notes for 55 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
12 years old
98 releases · first in 2015
@Phlosioneer for documentation fixes
take_bits!rest_sIResult methodsmany1rest_s method on IResult returns the remaining &str inputunwrap_err and unwrap_inc methods on IResultnot! will peek at the input and return Done if the underlying parser returned Error or Incomplete, without consuming the inputle_f32 and le_f64 parse little endian floating point numbers (IEEE 754)take_bits! is now more precisemany1 inccorectly used the len function instead of input_lenrecognize! had an early return that is removed nowOne column per quarter.
@lu-zero for the contribution guidelines
length_bytes and some documentationcond_with_error! combinatormany0!separated_list! fixesre_bytes_ work on byte slicescond_with_error! works like cond! but will return None if the condition is false, and Some(value) if the underlying parser succeededfold_many0!, fold_many1! and fold_many_m_n! will take a parser, an initial value and a combining function, and fold over the successful applications of the parserlength_bytes! converts the result of its child parser to usizetake_till! now imports InputLength instead of assuming it's in scopeseparated_list! and separated_nonempty_list! will not consume the separator if there's no following successfully parsed valuemany0!@conradev for fixing take_until_s!
take_until_s!nom::Err now implements std::error::Errorhex_u32 does not parses more than 8 chars nowtake_while! and take_while1! will not perturb the behaviour of recognize! anymore@sourrust for adding methods to IResult
IResultIResult and NeededIResult and Neededapply_rf is renamed to apply_m. This will not warrant a major version, since it is part missing from the methods feture added in the 1.2.0 releaseregexp_macros feature that used regex! to precompile regular expressions has been replaced by the normal regex engine combined with lazy_static&input[input.len()..].regexp_macros and no_std feature build again and are now tested with Travis CI@zentner-kyle for type inference fixes
&str parsing and method parsersIResultalt_complete! combinatorhex_digittake_until_and_consume_s! for consumption of string data until a tagnamed!. The error type can now be specifiedalt_complete! works like the alt! combinator, but tries the next branch if the current one returned Incomplete, instead of returning directlytuple! combinator takes a list of parsers as argument, and applies them serially on the input. If all of them are successful, it willr eturn a tuple accumulating all the values. This combinator will (hopefully) replace most uses of chain!method!, call_m! and apply_rf! combinatorspeek! compilation with bare functions&str parsers were splitting data at the byte level, not at the char level, which can result in inconsistencies in parsing UTF-8 characters. They now use character indexesIResult<I,O,E> (with specified error type instead of implicit)The parsing functions like alpha, digit and others will now accept either a &[u8] or a &str, so there is no breaking change on that part.
This release adds a lot of features related to &str parsing. The previous versions
were focused on &[u8] and bit streams parsing, but there's a need for more text
parsing with nom. The parsing functions like alpha, digit and others will now
accept either a &[u8] or a &str, so there is no breaking change on that part.
There are also a few performance improvements and documentation fixes.
&str parsingOption and Vec importstag_s!, take_s!, is_a_s!, is_not_s!, take_while_s!, take_while1_s!, take_till_s!value! is a combinator that always returns the same value. If a child parser is passed as second argument, that value is returned when the child parser succeedstag! will now compare even on partial input. If it expects "abcd" but receives "ef", it will now return an Error instead of Incompletemany0! and others will preallocate a larger vector to avoid some copies and reallocationsalpha, digit, alphanumeric, space and multispace now accept as input a &[u8] or a &str. Additionally, they return an error if they receive an empty inputtake_while!, take_while1!, take_while_s!, take_while1_s! wilreturn an error on empty inputmany0! or many1! returns Incomplete, it will return Incomplete too, possibly updating the needed sizeOption, Some, None and Vec are now used with full path importsThis releases makes the 1.0 version compatible with Rust 1.2 and 1.3
This releases makes the 1.0 version compatible with Rust 1.2 and 1.3
Stable release for nom. A lot of new features, a few breaking changes
Stable release for nom. A lot of new features, a few breaking changes
length_bytes! combinatorIResult::Error can now use custom error types, and is generic over the input typenom::ErrorCode is now nom::ErrorKindfilter! has been renamed to take_while!chain! will count how much data is consumed and use that number to calculate how much data is needed if a parser returned Incompletealt! returns Incomplete if a child parser returned Incomplete, instead of skipping to the next parserIResult does not require a lifetime tag anymore, yay!complete! will return an error if the child parser returned Incompleteadd_error! will wrap an error, but allow backtrackinghex_u32 parserIncomplete is better for most parsers nowNothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
This release fixes a few issues and stabilizes the code.
This release fixes a few issues and stabilizes the code.
tap! and extending dbg! and dbg_dmp!str::from_utf8tap!, dbg! and dbg_dmp! now accept function parameterscount_fixed! must be Copychain! calculates how much data is needed if one of the parsers returns `Incompletechain! can return IncompleteConsidering the number of changes since the last release, this version can contain breaking changes, so the version number becomes 0.4.0. A lot of new…
Considering the number of changes since the last release, this version can contain breaking changes, so the version number becomes 0.4.0. A lot of new features and performance improvements!
chain! and for the rest parsermany0! and many1!switch! combinator ideais_a!count_fixed! must take an explicit type as argument to generate the fixed-size arraychain!count! can take 0 elementsis_a! and is_not! can now consume the whole inputMemProduceropt! returns Done(input, None) if the child parser returned Incomplete`rest will return the remaining inputswitch! applies a first parser then matches on its result to choose the next parsertake_till!, take_while! and take_while1!alt! can return Incompletefilter!count!: a Vec of the right size is directly allocated@bluss for remarking that the crate included random junk lying non committed in my local repository
bits! for bit level parsing. It indicates that all child parsers will take a (&[u8], usize)as input, with the second parameter indicating the bit offs
bits! for bit level parsing. It indicates that all child parsers will take a (&[u8], usize)as input, with the second parameter indicating the bit offset in the first byte. This allows viewing a byte slice as a bit stream. Most combinators can be used directly under bits!take_bits! takes an integer type and a number of bits, consumes that number of bits and updates the offset, possibly by crossing byte boundariessrc/bits.rs. This applies to tag!, is_not!, is_a!, filter!, take!, take_str!, take_until_and_consume!, take_until!, take_until_either_and_consume!, take_until_either!`@idmit for some documentation fixes
filter!opt_res! applies a parser and transform its result in a Result. This parser never failscond_reduce! takes an expression as parameter, applies the parser if the expression is true, and returns an error if the expression is falsetap! pass the result of a parser to a block to manipulate it, but do not affect the parser's resultAccReader is a Read+BufRead that supports data accumulation and partial consumption. The consume method must be called afterwardsto indicate how much was consumedu16!, u32!, u64!, i16!, i32!, i64! take an expression as parameter, if the expression is true, apply the big endian integer parser, if false, the little endian versionmap_opt! and map_res! had issues with argument order due to bad macrosdelimited! did not compile for certain combinations of argumentsfilter! did not return a byte slice but a fixed arraycode coverage is now calculated automatically on Travis CI
Stepper: wrap a Producer, and call the method step with a parser. This method will buffer data if there is not enough, apply the parser if there is, and keep the rest of the input in memory for the next callReadProducer: takes something implementing Read, and makes a Producer out of itseparated_pair! and delimited! did not work because an implementation macro was not exportedMemProducer reached its end, it should always return Eofmap! had issues with argument matchingexpr_res! and expr_opt! evaluate an expression returning a Result or Opt and convert it to IResult
expr_res! and expr_opt! evaluate an expression returning a Result or Opt and convert it to IResultAsBytes is implemented for fixed size arrays. This allows tag!([41u8, 42u8])count_fixed! argument parsing works againdocumentation for a few functions
failed(&self, error_code) method in case of parsing errornamed! now handles the alternative named!(pub fun_name<OutputType>, ...)filter! now returns the whole input if the filter function never returned falsetake! casts its argument as usize, so it can accepts any integer type now@cmr for some documentation fixes
count_fixed! returns a fixed arraycount! is back to the previous behaviour, returning a Vec for sizes known at runtimenom::util are now directly in nom::@keruspe for features in chain!
cond!chain!chain! can now have mutable fieldscond! had an infinite macro recursionchain! generates less code now. No apprent compilation time improvement@andrew-d for the little endian signed integer parsers
count!le_i8, le_i16, le_i32, le_i64: little endian signed integer parsersalt! parser compiles much faster, even with more than 8 branchescount! can now return a fixed size array instead of a growable vector@keruspe for the take_str parser and the function application combinator
take_str parser and the function application combinatortake_str!: takes the specified number of bytes and return a UTF-8 stringapply!: do partial application on the parameters of a functionNeeded::Size now contains a usize instead of a u32@divarvel for the big endian signed integer parsers
be_i8, be_i16, be_i32, be_i64: big endian signed integer parserscore feature can be passed to cargo to build with no_std@filipegoncalves for some documentation and the new eof parser
error! will cut backtracking and return directly from the parser, with a specified error codeeof parser, successful if there is no more inputFlatMap, FlatpMapOpt and Functor traits (replaced by map!, map_opt! and map_res!)@filipegoncalves and @thehydroimpulse for debugging an infinite loop in many0 and many1
named! can now declare public functions like this: named!(pub tst, tag!("abcd"));pair!(X,Y) returns a tuple (x, y)separated_pair!(X, sep, Y) returns a tuple (x, y)preceded!(opening, X) returns xterminated!(X, closing) returns xdelimited(opening, X, closing) returns xseparated_list(sep, X) returns a Vec<X>separated_nonempty_list(sep, X) returns a Vec<X> of at list one elementmany0! and many1! forbid parsers that do not consume inputis_a!, is_not!, alpha, digit, space, multispace will now return an error if they do not consume at least one byte@mtsr for catching the remaining debug println!
count! to apply a parser a specified number of timescond! applies a parser if the condition is metutil::*opt! would not compilecollectionsUnnamed parser syntax: warning, this is a breaking change. With this new syntax, the macro combinators do not generate functions anymore, they create…
works with rustc 1.0.0-dev (81e2396c7 2015-03-19) (built 2015-03-19)
Incomplete(_), but if more granularity is mandatory, Needed can be matched tooalt! can pass the result of the parser to a closuretake_* 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!peek! macro: matches the future input but does not consume itlength_value! macro: the first argument is a parser returning a n that can cast to usize, then applies the second parser n times. The macro has a variant with a third argument indicating the expected input size for the second parsernamed! 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! and call! macros used to support the unnamed syntaxmap!, map_opt! and map_res! to combine a parser with a normal function, transforming the input directly, or returning an Option or Resultis_a! is now working properlyo! macro does less than chain!, so it has been removedfold0! and fold1! macros were too complex and awkward to use, the many* combinators will be useful for most uses for nowconsumers must have an end method that will be called after parsing
traits were renamed: FlatMapper -> FlatMap, Mapper -> FlatMapOpt, Mapper2 -> Functor
the chaining macro can take optional arguments with '?'
the chaining macro now takes the closure at the end of the argument list
flat_map implementation for <&[u8], &[u8]>
### Fixed - closure syntax change
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →