- @jsgf for the new
AtEoftrait - @tmccombs for fixes on
escaped*combinators - @s3bk for fixes around non Copy input types and documentation help
- @kamarkiewicz for fixes to no_std and CI
- @bheisler for documentation and examples
- @target-san for simplifying the
InputItertrait for&[u8] - @willmurphyscode for documentation and examples
- @Chaitanya1416 for typo fixes
- @fflorent for
input_len()usage fixes - @dbrgn for typo fixes
- @iBelieve for no_std fixes
- @kpp for warning fixes and clippy fixes
- @keruspe for fixes on FindToken
- @dtrebbien for fixes on take_until_and_consume1
- @Henning-K for typo fixes
- @vthriller for documentation fixes
- @federicomenaquintero and @veprbl for their help fixing the float parsers
- @vmchale for new named_args versions
- @hywan for documentation fixes
- @fbenkstein for typo fixes
- @CAD97 for catching missing trait implementations
- @goldenlentils for &str optimizations
- @passy for typo fixes
- @ayrat555 for typo fixes
- @GuillaumeGomez for documentation fixes
- @jrakow for documentation fixes and fiwes for
switch! - @phlosioneer for dicumentation fixes
- @creativcoder for typo fixes
- @derekdreery for typo fixes
- @lucasem for implementing
DerefonCompleteStrandCompleteByteSlice - @lowenheim for
parse_to!fixes - @myrrlyn for trait fixes around
CompleteStrandCompleteByteSlice - @NotBad4U for fixing code coverage analysis
- @murarth for code formatting
- @glandium for fixing build in no_std
- @csharad for regex compatibility with
CompleteStr - @FauxFaux for implementing
AsRef<str>onCompleteStr - @jaje for implementing
std::Erroronnom:Err - @fengalin for warning fixes
- @@khernyo for doc formatting
Special thanks to @corkami for the logo :)
- the
IResulttype now becomes aResultfrom the standard library Incompletenow returns the additional data size needed, not the total data size needed- verbose-errors is now a superset of basic errors
- all the errors now include the related input slice
- the arguments from
error_positionand other such macros were swapped to be more consistent with the rest of nom - automatic error conversion: to fix error type inference issues, a custom error type must now implement
std::convert::From<u32> - the
not!combinator returns unit() - FindToken's calling convention was swapped
- the
take_*combinators are now more coherent and stricter, see commit 484f6724ea3ccb for more information many0and other related parsers will now returnIncompleteif the reach the end of input without an error of the child parser. They will also returnIncompleteon an empty input- the
sep!combinator for whitespace only consumes whitespace in the prefix, while thews!combinator takes care of consuming the remaining whitespace
- the
AtEoftrait for input type: indicate if we can get more input data later (related to streaming parsers andIncompletehandling) - the
escaped*parsers now support the&strinput type - the
Failureerror variant represents an unrecoverable error, for whichaltand other combinators will not try other branches. This error means we got in the right part of the code (like, a prefix was checked correctly), but there was an error in the following parts - the
CompleteByteSliceandCompleteStrinput types consider there will be no more refill of the input. They fixed theIncompleterelated issues when we have all of the data - the
exact!()combinator will fail if we did not consume the whole input - the
take_while_m_n!combinator will match a specified number of characters ErrorKind::TakeUntilAndConsume1- the
recognize_floatparser will match a float number's characters, but will not transform to af32orf64 alphaand other basic parsers are now much stricter about partial inputs. We also introduce the*0and*1versions of those parsersnamed_argscan now specify the input type as wellHexDisplayis now implemented for&strallocfeature- the
InputTakeAtpositiontrait allows specialized implementations of parsers liketake_while!
- the producers and consumers were removed
- the
error_codeanderror_nodemacros are not used anymore
anychar!now works correctly with multibyte characterstake_until_and_consume1!no longer results in "no method named `find_substring`" and "no method named `slice`" compilation errorstake_until_and_consume1!returns the correct Incomplete(Needed) amountno_stdcompiles properly, and nom can work withalloctooparse_to!now consumes its input
altand other combinators will now clone the input if necessary. If the input is alreadyCopythere is no performance impact- the
restparser now works on various input types InputIter::Itemfor&[u8]is now au8directly, not a reference- we now use the
compile_errormacro to return a compile time error if there was a syntax issue - the permutation combinator now supports optional child parsers
- the float numbers parsers have been refactored to use one common implementation that is nearly 2 times faster than the previous one
- the float number parsers now accept more variants
- @ordian for
alt_completefixes - @friedm for documentation fixes
- @kali for improving error management
- there were cases where
alt_completecould returnIncomplete
- an
into_error_kindmethod can be used to transform any error to a common value. This helps when the library is included multiple times as dependency with different feature sets
- @jedireza for documentation fixes
- @gmorenz for the
bytescombinator - @meh for character combinator fixes for UTF-8
- @jethrogb for avoiding move issues in
separated_list
- new layout for the main page of documentation
anycharcan now work on any input typelength_bytesis now an alias forlength_data
one_of,none_ofandcharwill now index correctly UTF-8 characters- the
compiler_errormacro is now correctly exported
- the
bytescombinator transforms a bit stream back to a byte slice for child parsers
- @sdroege: implementing be_i24 and le_i24
- @Hywan: integrating faster substring search using memchr
- @nizox: fixing type issues in bit stream parsing
- @grissiom: documentation fixes
- @doomrobo: implementing separated_list_complete and separated_nonempty_list_complete
- @CWood1: fixing memchr integration in no_std
- @lu_zero: integrating the compiler_error crate
- @dtolnay: helping debug a type inference issue in map
- memchr is used for substring search if possible
- if building on nightly, some common syntax errors will display a specific error message. If building no stable, display the documentation to activate those messages
countno longer preallocates its vector
- better type inference in alt_complete
altshould now work with whitespace parsingmapshould not make type inference errors anymore
- be_i24 and le_i24, parsing big endian and little endian signed 24 bit integers
separated_list_completeandseparated_nonempty_list_completewill treat incomplete from sub parsers as error
- Chris Pick for some
Incompleterelated refactors - @dbrgn for documentation fixes
- @valarauca for adding
be_u24 - @ithinuel for usability fixes
- @evuez for README readability fixes and improvements to
IResult - @s3bk for allowing non-
Copytypes as input - @keruspe for documentation fixes
- @0xd34d10cc for trait fixes on
InputIter - @sdleffler for lifetime shenanigans on
named_args - @chengsun for type inference fixes in
alt - @iBelieve for adding str to no_std
- @Hywan for simplifying code in input traits
- @azerupi for extensive documentation of
altandalt_complete
escaped,separated_listandseparated_nonempty_listcan now returnIncompletewhen necessaryInputIterdoes not requireAsCharon itsItemtype anymore- the
corefeature that was putting nom inno_stdmode has been removed. There is now astdfeature, activated by default. If it is not activated, nom is inno_std - in
verbose-errorsmode, the error list is now stored in aVecinstead of a box based linked list chain!has finally been removed
Endiannessnow implementsDebug,PartialEq,Eq,CloneandCopy- custom input types can now be cloned if they're not
Copy - the infamous 'Cannot infer type for E' error should happen less often now
stris now available inno_stdmode
FileProducerwill be marked asEofon full buffernamed_args!now has lifetimes that cannot conflict with the lifetimes from other arguments
be_u24: big endian 24 bit unsigned integer parsingIResultnow has aunwrap_ormethod
- @Victor-Savu for formatting fixes in the README
- @chifflier for detecting and fixing integer overflows
- @utkarshkukreti for some performance improvements in benchmarks
- when calculating how much data is needed in
IResult::Incomplete, the addition could overflow (it is stored as a usize). This would apparently not result in any security vulnerability on release code
- @seppo0010 for fixing
named_args - @keruspe for implementing or() on
IResult, adding the option of default cases inswitch!, adding support forcargo-travis - @timlyo for documentation fixes
- @JayKickliter for extending
hex_u32 - @1011X for fixing regex integration
- @Kerollmops for actually marking
chain!as deprecated - @joliss for documentation fixes
- @utkarshkukreti for tests refactoring and performance improvement
- @tmccombs for documentation fixes
IResultgets anor()methodtake_until1,take_until_and_consume1,take_till1!andtake_till1_s!require at least 1 character
hex_u32accepts uppercase digits as well- the character based combinators leverage the input traits
- the whitespace parsers now work on &str and other types
take_while1returnsIncompleteon empty inputswitch!can now take a default case
named_args!now importsIResultdirectly- the upgrade to regex 0.2 broke the regex combinators, they work now
- @nickbabcock for documentation fixes
- @derekdreery for documentation fixes
- @DirkyJerky for documentation fixes
- @saschagrunert for documentation fixes
- @lucab for documentation fixes
- @hyone for documentation fixes
- @tstorch for factoring
Slice - @shepmaster for adding crate categories
- @antoyo for adding
named_args!
verify!uses a first parser, then applies a function to check that its result satisfies some conditionsnamed_args!creates a parser function that can accept other arguments along with the inputparse_to!will use theparsemethod fromFromStrto parse a value. It will automatically translate the input to a string if necessaryfloat,float_s,double,double_scan recognize floating point numbers in text
escaped!will now returnIncompleteif neededpermutation!supports up to 20 child parsers
Bugfix release
Warning: there is a small breaking change, add_error! is renamed to add_return_error!. This was planned for the 2.0 release but was forgotten. This is a small change in a feature that not many people use, for a release that is not yet widely in use, so there will be no 3.0 release for that change.
- @nickbabcock for catching and fixing the
add_error!mixup - @lucab for documentation fixes
- @jtdowney for noticing that
tag_no_case!was not working at all for byte slices
add_error!has been renamed toadd_return_error!- the
not!combinator now accepts functions tag_no_case!is now working as accepted (before, it accepted everything)
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.
- @lu-zero for license help
- @adamgreig for type inference fixes
- @keruspe for documentation and example fixes, for the
IResult => Resultconversion work, makingAsChar's method more consistent, and addingmany_till! - @jdeeny for implementing
Offseton&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.iobadge - @badboy for documentation fixes
- @jugglerchris for fixing
take_s! - @AndyShiue for implementing
ErrorandDisplayonErrorKindand detecting incorrect UTF-8 string indexing
- 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
IResultin astd::result::Result length_data!parses a length, and returns a subslice of that lengthtag_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 stringsnamed_attr!creates functions likenamed!but can add attributes like documentationmany_till!applies repeatedly its first child parser until the second succeeds
- 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
eoffunction 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 theOffsettrait 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_9is nowAsChar::is_dec_digit- the combinators with configurable endianness now take an enum instead of a boolean as parameter
- the
count!,count_fixed!andlength_*!combinator calculate incomplete data needs correctly eol,line_endingandnot_line_endingnow 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
- @Phlosioneer for documentation fixes
- @sourrust for fixing offsets in
take_bits! - @ChrisMacNaughton for the XFS crate
- @pwoolcoc for
rest_s - @fitzgen for more
IResultmethods - @gtors for the negative lookahead feature
- @frk1 and @jeandudey for little endian float parsing
- @jethrogb for fixing input usage in
many1 - @acatton for beating me at nom golf :D
- the
rest_smethod onIResultreturns the remaining&strinput unwrap_errandunwrap_incmethods onIResultnot!will peek at the input and returnDoneif the underlying parser returnedErrororIncomplete, without consuming the inputle_f32andle_f64parse little endian floating point numbers (IEEE 754)
- documentation fixes
take_bits!is now more precisemany1inccorectly used thelenfunction instead ofinput_len- the INI parser is simpler
recognize!had an earlyreturnthat is removed now
- @lu-zero for the contribution guidelines
- @GuillaumeGomez for fixes on
length_bytesand some documentation - @Hywan for documentation and test fixes
- @Xirdus for correct trait import issues
- @mspiegel for the new AST example
- @cholcombe973 for adding the
cond_with_error!combinator - @tstorch for refactoring
many0! - @panicbit for the folding combinators
- @evestera for
separated_list!fixes - @DanielKeep for correcting some enum imports
- Regular expression combinators starting with
re_bytes_work on byte slices - example parsing arithmetic expressions to an AST
cond_with_error!works likecond!but will returnNoneif the condition is false, andSome(value)if the underlying parser succeededfold_many0!,fold_many1!andfold_many_m_n!will take a parser, an initial value and a combining function, and fold over the successful applications of the parser
length_bytes!converts the result of its child parser to usizetake_till!now importsInputLengthinstead of assuming it's in scopeseparated_list!andseparated_nonempty_list!will not consume the separator if there's no following successfully parsed value- no more warnings on build
- simpler implementation of
many0!
- @conradev for fixing
take_until_s! - @GuillaumeGomez for some documentation fixes
- @frewsxcv for some documentation fixes
- @tstorch for some test refactorings
nom::Errnow implementsstd::error::Error
hex_u32does not parses more than 8 chars nowtake_while!andtake_while1!will not perturb the behaviour ofrecognize!anymore
- @sourrust for adding methods to
IResult - @tstorch for the test refactoring, and for adding methods to
IResultandNeeded - @joelself for fixing the method system
- mapping methods over
IResultandNeeded
apply_rfis renamed toapply_m. This will not warrant a major version, since it is part missing from the methods feture added in the 1.2.0 release- the
regexp_macrosfeature that usedregex!to precompile regular expressions has been replaced by the normal regex engine combined withlazy_static
- when a parser or combinator was returning an empty buffer as remaining part, it was generating one from a static empty string. This was messing with buffer offset calculation. Now, that empty slice is taken like this:
&input[input.len()..]. - The
regexp_macrosandno_stdfeature build again and are now tested with Travis CI
- @zentner-kyle for type inference fixes
- @joelself for his work on
&strparsing and method parsers - @GuillaumeGomez for implementing methods on
IResult - @dirk for the
alt_complete!combinator - @tstorch for a lot of refactoring work and unit tests additions
- @jansegre for the hex digit parsers
- @belgum for some documentation fixes
- @lwandrebeck for some documentation fixes and code fixes in
hex_digit
take_until_and_consume_s!for consumption of string data until a tag- more function patterns in
named!. The error type can now be specified alt_complete!works like thealt!combinator, but tries the next branch if the current one returnedIncomplete, instead of returning directly- more unit tests for a lot of combinators
- hexadecimal digit parsers
- the
tuple!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 ofchain! - parsers can now be implemented as a method for a struct thanks to the
method!,call_m!andapply_rf!combinators
- there were type inference issues in a few combinators. They will now be easier to compile
peek!compilation with bare functions&strparsers 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 indexes- some method implementations were missing on
IResult<I,O,E>(with specified error type instead of implicit)
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.
- @Binero for pushing the work on
&strparsing - @meh for fixing
OptionandVecimports - @hoodie for a documentation fix
- @joelself for some documentation fixes
- @vberger for his traits magic making nom functions more generic
- string related parsers:
tag_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 succeeds
tag!will now compare even on partial input. If it expects "abcd" but receives "ef", it will now return anErrorinstead ofIncompletemany0!and others will preallocate a larger vector to avoid some copies and reallocationsalpha,digit,alphanumeric,spaceandmultispacenow 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 input
- if the child parser of
many0!ormany1!returnsIncomplete, it will returnIncompletetoo, possibly updating the needed size Option,Some,NoneandVecare now used with full path imports
This releases makes the 1.0 version compatible with Rust 1.2 and 1.3
- @steveklabnik for fixing lifetime issues in Producers and Consumers
Stable release for nom. A lot of new features, a few breaking changes
- @ahenry for macro fixes
- @bluss for fixing documentation
- @sourrust for cleaning code and debugging the new streaming utilities
- @meh for inline optimizations
- @ccmtaylor for fixing function imports
- @soro for improvements to the streaming utilities
- @breard-r for catching my typos
- @nelsonjchen for catching my typos too
- @divarvel for hex string parsers
- @mrordinaire for the
length_bytes!combinator
IResult::Errorcan now use custom error types, and is generic over the input type- Producers and consumers have been replaced. The new implementation uses less memory and integrates more with parsers
nom::ErrorCodeis nownom::ErrorKindfilter!has been renamed totake_while!chain!will count how much data is consumed and use that number to calculate how much data is needed if a parser returnedIncompletealt!returnsIncompleteif a child parser returnedIncomplete, instead of skipping to the next parserIResultdoes not require a lifetime tag anymore, yay!
complete!will return an error if the child parser returnedIncompleteadd_error!will wrap an error, but allow backtrackinghex_u32parser
- the behaviour around
Incompleteis better for most parsers now
This release fixes a few issues and stabilizes the code.
- @nox for documentation fixes
- @daboross for linting fixes
- @ahenry for fixing
tap!and extendingdbg!anddbg_dmp! - @bluss for tracking down and fixing issues with unsafe code
- @meh for inlining parser functions
- @ccmtaylor for fixing import of
str::from_utf8
tap!,dbg!anddbg_dmp!now accept function parameters
- the type used in
count_fixed!must beCopy chain!calculates how much data is needed if one of the parsers returns `Incomplete- optional parsers in
chain!can returnIncomplete
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!
- @frewsxcv for documentation fixes
- @ngrewe for his work on producers and consumers
- @meh for fixes on
chain!and for therestparser - @daboross for refactoring
many0!andmany1! - @aleksander for the
switch!combinator idea - @TechnoMancer for his help with bit level parsing
- @sxeraverx for pointing out a bug in
is_a!
count_fixed!must take an explicit type as argument to generate the fixed-size array- optional parsing behaviour in
chain! count!can take 0 elementsis_a!andis_not!can now consume the whole input
- it is now possible to seek to the end of a
MemProducer opt!returnsDone(input, None)ifthe child parser returnedIncomplete`restwill return the remaining input- consumers can now seek to and from the end of input
switch!applies a first parser then matches on its result to choose the next parser- bit-level parsers
- character-level parsers
- regular expression parsers
- implementation of
take_till!,take_while!andtake_while1!
alt!can returnIncomplete- the error analysis functions will now take references to functions instead of moving them
- performance improvements on producers
- performance improvement for
filter! - performance improvement for
count!: aVecof the right size is directly allocated
- @bluss for remarking that the crate included random junk lying non commited in my local repository
- cleanup of my local repository will ship less files in the crates, resulting in a smaller download
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 underbits!take_bits!takes an integer type and a number of bits, consumes that number of bits and updates the offset, possibly by crossing byte boundaries- bit level parsers are all written in
src/bits.rs
- Parsers that specifically handle bytes have been moved to src/bytes.rs
. This applies totag!,is_not!,is_a!,filter!,take!,take_str!,take_until_and_consume!,take_until!,take_until_either_and_consume!,take_until_either!`
- @badboy for fixing
filter! - @idmit for some documentation fixes
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 resultAccReaderis a Read+BufRead that supports data accumulation and partial consumption. Theconsumemethod must be called afterwardsto indicate how much was consumed- Arithmetic expression evaluation and parsing example
u16!,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 version- type information for combinators. This will make the documentation a bit easier to navigate
map_opt!andmap_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 array
- code coverage is now calculated automatically on Travis CI
Stepper: wrap aProducer, and call the methodstepwith 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 implementingRead, and makes aProducerout of it
- the combinators
separated_pair!anddelimited!did not work because an implementation macro was not exported - if a
MemProducerreached its end, it should always returnEof map!had issues with argument matching
expr_res!andexpr_opt!evaluate an expression returning a Result or Opt and convert it to IResultAsBytesis implemented for fixed size arrays. This allowstag!([41u8, 42u8])
count_fixed!argument parsing works again
- documentation for a few functions
- the consumer trait now requires the
failed(&self, error_code)method in case of parsing error named!now handles thge alternativenamed!(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 array
count!is back to the previous behaviour, returning aVecfor sizes known at runtime
- functions and traits exported from
nom::utilare now directly innom::
- @andrew-d for fixes on
cond! - @keruspe for features in
chain!
chain!can now have mutable fields
cond!had an infinite macro recursion
chain!generates less code now. No apprent compilation time improvement
- @andrew-d for the little endian signed integer parsers
- @keruspe for fixes on
count!
le_i8,le_i16,le_i32,le_i64: little endian signed integer parsers
- the
alt!parser compiles much faster, even with more than 8 branches count!can now return a fixed size array instead of a growable vector
- @keruspe for the
take_strparser and the function application combinator
take_str!: takes the specified number of bytes and return a UTF-8 stringapply!: do partial application on the parameters of a function
Needed::Sizenow contains ausizeinstead of au32
- @divarvel for the big endian signed integer parsers
be_i8,be_i16,be_i32,be_i64: big endian signed integer parsers- the
corefeature can be passed to cargo to build withno_std - colored hexdump can be generated from error chains
- @filipegoncalves for some documentation and the new eof parser
- @CrimsonVoid for putting fully qualified types in the macros
- @lu_zero for some documentation fixes
- new error types that can contain an error code, an input slice, and a list of following errors
error!will cut backtracking and return directly from the parser, with a specified error codeeofparser, successful if there is no more input- specific error codes for the parsers provided by nom
- fully qualified types in macros. A lot of imports are not needed anymore
FlatMap,FlatpMapOptandFunctortraits (replaced bymap!,map_opt!andmap_res!)
- @filipegoncalves and @thehydroimpulse for debugging an infinite loop in many0 and many1
- @thehydroimpulse for suggesting public named parsers
- @skade for removing the dependency on the collections gate
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)returnsxterminated!(X, closing)returnsxdelimited(opening, X, closing)returnsxseparated_list(sep, X)returns aVec<X>separated_nonempty_list(sep, X)returns aVec<X>of at list one element
many0!andmany1!forbid parsers that do not consume inputis_a!,is_not!,alpha,digit,space,multispacewill now return an error if they do not consume at least one byte
- @mtsr for catching the remaining debug println!
- @jag426 who killed a lot of warnings
- @skade for removing the dependency on the core feature gate
- little endian unsigned int parsers le_u8, le_u16, le_u32, le_u64
count!to apply a parser a specified number of timescond!applies a parser if the condition is met- more parser development tools in
util::*
- in one case,
opt!would not compile
- most of the feature gates are now removed. The only one still needed is
collections
works with rustc 1.0.0-dev (81e2396c7 2015-03-19) (built 2015-03-19)
- Ryman for the AsBytes implementation
- jag426 and jaredly for documentation fixes
- eternaleye on #rust IRC for his help on the new macro syntax
- 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,Neededcan be matched too alt!can pass the result of the parser to a closure- 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!
peek!macro: matches the future input but does not consume itlength_value!macro: the first argument is a parser returning anthat can cast to usize, then applies the second parserntimes. 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 syntaxmap!,map_opt!andmap_res!to combine a parser with a normal function, transforming the input directly, or returning anOptionorResult
is_a!is now working properly
- 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
- consumers must have an end method that will be called after parsing
- big endian unsigned int and float parsers: be_u8, be_u16, be_u32, be_u64, be_f32, be_f64
- producers can seek
- function and macros documentation
- README documentation
- lifetime declarations
- tag! can return Incomplete
- traits were renamed: FlatMapper -> FlatMap, Mapper -> FlatMapOpt, Mapper2 -> Functor
- woeks with rustc f1bb6c2f4
- 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]>
- chaining macro
- partial MP4 parser example
- closure syntax change