Debian Codegraph @

.cargo/vendor/nom/CHANGELOG.md

raw
1 # Change Log
2
3 ## 8.0.0 2025-01-25
4
5 This versions represents a significant refactoring of nom to reduce the amount of code generated by prsers, and reduce the API surface. As such, it comes with some breaking changes, mostly around the move from closure based combinators to trait based ones. In practice, it means that instead of writing `combinator(arg)(input)`, we now write `combinator(arg).parse(input)`.
6
7 This release also marks th introduction of the [nom-language](https://crates.io/crates/nom-language) crate, which will hold tools more focused on language parsing than the rest of nom, like the `VerboseError` type and the newly added precedence parsing combinators.
8
9 ### Thanks
10
11 - @cky
12 - @5c077m4n
13 - @epage
14 - @Fumon
15 - @jtracey
16 - @OliveIsAWord
17 - @Xiretza
18 - @flier
19 - @cenodis
20 - @Shadow53
21 - @@jmmaa
22 - @terror
23 - @zanedp
24 - @atouchet
25 - @CMDJojo
26 - @ackxolotl
27 - @xmakro
28 - @tfpk
29 - @WhyNotHugo
30 - @brollb
31 - @smheidrich
32 - @glittershark
33 - @GuillaumeGomez
34 - @LeoDog896
35 - @fmiras
36 - @ttsugriy
37 - @McDostone
38 - @superboum
39 - @rruppy
40 - @thssuck
41 - @Chasing1020
42 - @thatmarkenglishguy
43 - @ambiso
44 - @boxdot
45 - @krtab
46 - @code10129
47 - @manunio
48 - @stuarth
49 - @mindeng
50 - @JonathanPlasse
51 - @nabilwadih
52 - @phoenixr-codes
53 - @gdennie
54 - @art049
55 - @kstrohbeck
56
57 ### Added
58
59 - `Parser::map_res`
60 - `Parser::map_opt`
61 - `many` and `fold` combinators using ranges
62 - `many` can collect into other types than `Vec`
63 - `Error` and `VerboseError` can be converted to owned versions
64
65 ### Removed
66
67 - `nom::bits::*` is no longer re-exported at the crate root. This export caused frequent confusion, since e.g. `nom::complete::tag` referred to `nom::bits::complete::tag` instead of the much more commonly used `nom::bytes::complete::tag`. To migrate, change any imports of `nom::{complete::*, streaming::*, bits, bytes}` to `nom::bits::[...]`.
68 - `parse` combinator
69 - `InputIter`, `InputTakeAtPosition`, `InputLength`, `InputTake` and `Slice` are now merged in the `Input` trait
70
71 ### Changed
72 - `Parser::map` and `Parser::flat_map` now take a `FnMut` as argument
73
74 ## 7.1.2 - 2023-01-01
75
76 ### Thanks
77
78 - @joubs
79 - @Fyko
80 - @LoganDark
81 - @darnuria
82 - @jkugelman
83 - @barower
84 - @puzzlewolf
85 - @epage
86 - @cky
87 - @wolthom
88 - @w1ll-i-code
89
90 ### Changed
91
92 - documentation fixes
93 - tests fixes
94 - limit the initial capacity of the result vector of `many_m_n` to 64kiB
95 - bits parser now accept `Parser` implementors instead of only functions
96
97 ### Added
98
99 - implement `Tuple` parsing for the unit type as a special case
100 - implement `ErrorConvert` on the unit type to make it usable as error type for bits parsers
101 - bool parser for bits input
102
103 ## 7.1.1 - 2022-03-14
104
105 ### Thanks
106
107 - @ThomasdenH
108 - @@SphinxKnight
109 - @irevoire
110 - @doehyunbaek
111 - @pxeger
112 - @punkeel
113 - @max-sixty
114 - @Xiretza
115 - @5c077m4n
116 - @erihsu
117 - @TheNeikos
118 - @LoganDark
119 - @nickelc
120 - @chotchki
121 - @ctrlcctrlv
122
123
124 ### Changed
125
126 - documentation fixes
127 - more examples
128
129 ## 7.1.0 - 2021-11-04
130
131 ### Thanks
132
133 - @nickelc
134 - @Stargateur
135 - @NilsIrl
136 - @clonejo
137 - @Strytyp
138 - @schubart
139 - @jihchi
140 - @nipunn1313
141 - @Gungy2
142 - @Drumato
143 - @Alexhuszagh
144 - @Aehmlo
145 - @homersimpsons
146 - @dne
147 - @epage
148 - @saiintbrisson
149 - @pymongo
150
151 ### Changed
152
153 - documentation fixes
154 - Ci fixes
155 - the move to minimal-lexical for float parsing introduced bugs that cannot be resolved right now, so this version moves back to using the standard lib' parser. *This is a performance regression**. If you have specific requirements around float parsing, you are strongly encouraged to use [recognize_float](https://docs.rs/nom/latest/nom/number/complete/fn.recognize_float.html) and another library to convert to a f32 or f64
156
157 ### Added
158
159 - alt now works with 1 elment tuples
160
161 ## 7.0.0 - 2021-08-21
162
163 This release fixes dependency compilation issues and strengthen the minimum supported Rust version (MSRV) policy. This is also the first release without the macros that were used since nom's beginning.
164
165 ### Thanks
166
167 - @djc
168 - @homersimpsons
169 - @lo48576
170 - @myrrlyn
171 - @RalXYZ
172 - @nickelc
173 - @cenodis
174
175 ### Added
176
177 - `take_until1` combinator
178 - more `to_owned` implementations
179 - `fail`: a parser that always fail, useful as default condition in other combinators
180 - text to number parsers: in the `character::streaming` and `character::complete` modules, there are parsers named `i8, u16, u32, u64, u128` and `u8 ,u16, u32, u64, u128` that recognize decimal digits and directly convert to a number in the target size (checking for max int size)
181
182 ### Removed
183
184 - now that function combinators are the main way to write parsers, the old macro combinators are confusing newcomers. THey have been removed
185 - the `BitSlice` input type from bitvec has been moved into the [nom-bitvec](https://crates.io/crates/nom-bitvec) crate. nom does not depend on bitvec now
186 - regex parsers have been moved into the [nom-regex](https://crates.io/crates/nom-regex) crate. nom does not depend on regex now
187 - `ErrorKind::PArseTo` was not needed anymore
188
189 ### Changed
190
191 - relax trait bounds
192 - some performance fixes
193 - `split_at_position*` functions should now be guaranteed panic free
194 - the `lexical-core` crate used for float parsing has now been replaced with `minimal-lexical`: the new crate is faster to compile, faster to parse, and has no dependencies
195
196 ### Fixed
197
198 - infinite loop in `escaped` combinator
199 - `many_m_n` now fails if min > max
200
201
202 ## 6.2.1 - 2021-06-23
203
204 ### Thanks
205
206 This release was done thanks to the hard work of (by order of appearance in the commit list):
207
208 - @homersimpsons
209
210 ### Fixed
211
212 - fix documentation building
213
214 ## 6.2.0 - 2021-02-15
215
216 ### Thanks
217
218 This release was done thanks to the hard work of (by order of appearance in the commit list):
219
220 - @DavidKorczynski
221 - @homersimpsons
222 - @kornelski
223 - @lf-
224 - @lewisbelcher
225 - @ronan-d
226 - @weirane
227 - @heymind
228 - @marcianx
229 - @Nukesor
230
231 ### Added
232
233 - nom is now regularly fuzzed through the OSSFuzz project
234
235 ### Changed
236
237 - lots of documentation fixes
238 - relax trait bounds
239 - workarounds for dependency issues with bitvec and memchr
240
241 ## 6.1.2 - 2021-02-15
242
243 ### Changed
244
245 - Fix cargo feature usage in previous release
246
247 ## 6.1.1 - 2021-02-15
248
249 ### Thanks
250
251 This release was done thanks to the hard work of (by order of appearance in the commit list):
252
253 - @nickelc
254
255 ### Changed
256
257 - Fix dependenciy incompatibilities: Restrict the bitvec->funty dependency to <=1.1
258
259 ## 6.1.0 - 2021-01-23
260
261 ### Thanks
262
263 This release was done thanks to the hard work of (by order of appearance in the commit list):
264
265 - @sachaarbonel
266 - @vallentin
267 - @Lucretiel
268 - @meiomorphism
269 - @jufajardini
270 - @neithernut
271 - @drwilco
272
273 ### Changed
274
275 - readme and documentation fixes
276 - rewrite of fold_many_m_n
277 - relax trait bounds on some parsers
278 - implement `std::error::Error` on `VerboseError`
279
280
281 ## 6.0.1 - 2020-11-24
282
283 ### Thanks
284
285 This release was done thanks to the hard work of (by order of appearance in the commit list):
286
287 - @Leonqn
288 - @nickelc
289 - @toshokan
290 - @juchiast
291 - @shssoichiro
292 - @jlkiri
293 - @chifflier
294 - @fkloiber
295 - @Kaoet
296 - @Matthew Plant
297
298 ### Added
299
300 - `ErrorConvert` implementation for `VerboseError`
301
302 ### Changed
303
304 - CI fixes
305 - `fold_many*` now accept `FnMut` for the accumulation function
306 - relaxed input bounds on `length_count`
307
308 # Fixed
309
310 - documentation fixes
311 - the `#[deprecated]` attribute was removed from traits because it does not compile anymore on nightly
312 - bits and bytes combinators from the bits modules are now converted to use `FnMut`
313
314 ## 6.0.0 - 2020-10-31
315
316 ### Thanks
317
318 This release was done thanks to the hard work of (by order of appearance in the commit list):
319 - @chifflier
320 - @shepmaster
321 - @amerelo
322 - @razican
323 - @Palladinium
324 - @0ndorio
325 - Sebastian Zivota
326 - @keruspe
327 - @devonhollowood
328 - @parasyte
329 - @nnt0
330 - @AntoineCezar
331 - @GuillaumeGomez
332 - @eijebong
333 - @stadelmanma
334 - @sphynx
335 - @snawaz
336 - @fosskers
337 - @JamesHarrison
338 - @calebsander
339 - @jthornber
340 - @ahmedcharles
341 - @rljacobson
342 - @benkay86
343 - @georgeclaghorn
344 - @TianyiShi2001
345 - @shnewto
346 - @alfriadox
347 - @resistor
348 - @myrrlyn
349 - @chipsenkbeil
350 - @ruza-net
351 - @fanf2
352 - @jameysharp
353 - @FallenWarrior2k
354 - @jmg-duarte
355 - @ericseppanen
356 - @hbina
357 - Andreas Molzer
358 - @nickelc
359 - @bgourlie
360
361 ## Notable changes
362
363 This release is a more polished version of nom 5, that came with a focus on
364 function parsers, by relaxing the requirements: combinators will return a
365 `impl FnMut` instead of `impl Fn`, allowing closures that change their context,
366 and parsers can be any type now, as long as they implement the new `Parser` trait.
367 That parser trait also comes with a few helper methods.
368
369 Error management was often a pain point, so a lot of work went into making it easier.
370 Now it integrates with `std:error::Error`, the `IResult::finish()` method allows you
371 to convert to a more usable type, the `into` combinator can convert the error type
372 if there's a `From` implementation, and there are more specific error traits like
373 `ContextError` for the `context` combinator, and `FromExternalError` for `map_res`.
374 While the `VerboseError` type and its `convert_error` function saw some changes,
375 not many features ill be added to it, instead you are encouraged to build the error
376 type that corresponds to your needs if you are building a language parser.
377
378 This version also integrates with the excellent [bitvec](https://crates.io/crates/bitvec)
379 crate for better bit level parsing. This part of nom was not great and a bit of a hack,
380 so this will give better options for those parsers.
381
382 At last, documentation! There are now more code examples, functions and macros that require
383 specific cargo features are now clearly indicated, and there's a new `recipes` module
384 containing example patterns.
385
386 ### Breaking changes
387
388 - the minimal Rust version is now 1.44 (1.37 if building without the `alloc` or `std` features)
389 - streaming parsers return the number of additional bytes they need, not the total. This was supposed to be the case everywhere, but some parsers were forgotten
390 - removed the `regexp_macros` cargo feature
391 - the `context` combinator is not linked to `ParseError` anymore, instead it come with its own `ContextError` trait
392 - `Needed::Size` now contains a `NonZeroUsize`, so we can reduce the structure's size by 8 bytes. When upgrading, `Needed::Size(number)` can be replaced with `Needed::new(number)`
393 - there is now a more general `Parser` trait, so parsers can be something else than a function. This trait also comes with combinator methods like `map`, `flat_map`, `or`. Since it is implemented on `Fn*` traits, it should not affect existing code too much
394 - combinators that returned a `impl Fn` now return a `impl FnMut` to allow parser closures that capture some mutable value from the context
395 - `separated_list` is now `separated_list0`
396 - removed the deprecated `methods` module
397 - removed the deprecated `whitespace` module
398 - the default error type is now a struct (`nom::error::Error`) instead of a tuple
399 - the `FromExternalError` allows wrapping the error returned by the function in the `map_res` combinator
400 - renamed the `dbg!` macro to avoid conflicts with `std::dbg!`
401 - `separated_list` now allows empty elements
402
403
404 ### Added
405
406 - function version of regex parsers
407 - `fill`: attempts to fill the output slice passed as argument
408 - `success`: returns a value without consuming the input
409 - `satisfy`: checks a predicate over the next character
410 - `eof` function combinator
411 - `consumed`: returns the produced value and the consumed input
412 - `length_count` function combinator
413 - `into`: converts a parser's output and error values if `From` implementations are available
414 - `IResult::finish()`: converts a parser's result to `Result<(I, O), E>` by removing the distinction between `Error` and `Failure` and panicking on `Incomplete`
415 - non macro versions of `u16`, `i32`, etc, with configurable endianness
416 - `is_newline` function
417 - `std::error::Error` implementation for nom's error types
418 - recipes section of the documentation, outlining common patterns in nom
419 - custom errors example
420 - bitstream parsing with the `BitSlice` type from the bitvec crate
421 - native endianness parsers
422 - github actions for CI
423
424 ### Changed
425
426 - allows lexical-core 0.7
427 - number parsers are now generic over the input type
428 - stabilized the `alloc` feature
429 - `convert_error` accepts a type that derefs to `&str`
430 - the JSON example now follows the spec better
431
432 ### Fixed
433 - use `fold_many0c` in the `fold_many0` macro
434
435 ## 5.1.1 - 2020-02-24
436
437 ### Thanks
438
439 - @Alexhuszagh for float fixes
440 - @AlexanderEkdahl, @JoshOrndorff, @akitsu-sanae for docs fixes
441 - @ignatenkobrain: dependency update
442 - @derekdreery: `map` implementation for errors
443 - @Lucretiel for docs fixes and compilation fixes
444 - adytzu2007: warning fixes
445 - @lo48576: error management fixes
446
447 ### Fixed
448
449 - C symbols compilation errors due to old lexical-core version
450
451 ### Added
452
453 - `Err` now has a `map` function
454
455 ### Changed
456
457 - Make `error::context()` available without `alloc` feature
458
459 ## 5.1.0 - 2020-01-07
460
461 ### Thanks
462
463 - @Hywan, @nickmooney, @jplatte, @ngortheone, @ejmg, @SirWindfield, @demurgos, @spazm, @nyarly, @guedou, @adamnemecek, for docs fixes
464 - @Alxandr for error management bugfixes
465 - @Lucretiel for example fixes and optimizations
466 - @adytzu2007 for optimizations
467 - @audunhalland for utf8 fixes
468
469 ### Fixed
470
471 - panic in `convert_error`
472 - `compile_error` macro usage
473
474 ### Added
475
476 - `std::error::Error`, `std::fmt::Display`, `Eq`, `ToOwned` implementations for errors
477 - inline attribute for `ToUsize`
478
479 ### Changed
480
481 - `convert_error` optimization
482 - `alt` optimization
483
484 ## 5.0.1 - 2019-08-22
485
486 ### Thanks
487
488 - @waywardmonkeys, @phaazon, @dalance for docs fixes
489 - @kali for `many0_m_n` fixes
490 - @ia0 for macros fixes
491
492 ### Fixed
493
494 - `many0_m_n` now supports the n=1 case
495 - relaxed trait requirements in `cut`
496 - `peek!` macro reimplementation
497 - type inference in `value!`
498
499 ## 5.0.0 - 2019-06-24
500
501 This version comes with a complete rewrite of nom internals to use functions as a base
502 for parsers, instead of macros. Macros have been updated to use functions under
503 the hood, so that most existing parsers will work directly or require minimal changes.
504
505 The `CompleteByteSlice` and `CompleteStr` input types were removed. To get different
506 behaviour related to streaming or complete input, there are different versions of some
507 parsers in different submodules, like `nom::character::streaming::alpha0` and
508 `nom::character::complete::alpha0`.
509
510 The `verbose-errors` feature is gone, now the error type is decided through a generic
511 bound. To get equivalent behaviour to `verbose-errors`, check out `nom::error::VerboseError`
512
513 ### Thanks
514
515 - @lowenheim helped in refactoring and error management
516 - @Keruspe helped in refactoring and fixing tests
517 - @pingiun, @Songbird0, @jeremystucki, @BeatButton, @NamsooCho, @Waelwindows, @rbtcollins, @MarkMcCaskey for a lot of help in rewriting the documentation and adding code examples
518 - @GuillaumeGomez for documentation rewriting and checking
519 - @iosmanthus for bug fixes
520 - @lo48576 for error management fixes
521 - @vaffeine for macros visibility fixes
522 - @webholik and @Havvy for `escaped` and `escaped_transform` fixes
523 - @proman21 for help on porting bits parsers
524
525 ### Added
526
527 - the `VerboseError` type accumulates position info and error codes, and can generate a trace with span information
528 - the `lexical-core` crate is now used by default (through the `lexical` compilation feature) to parse floats from text
529 - documentation and code examples for all functions and macros
530
531 ### Changed
532
533 - nom now uses functions instead of macros to generate parsers
534 - macros now use the functions under the hood
535 - the minimal Rust version is now 1.31
536 - the verify combinator's condition function now takes its argument by reference
537 - `cond` will now return the error of the parser instead of None
538 - `alpha*`, `digit*`, `hex_digit*`, `alphanumeric*` now recognize only ASCII characters
539
540 ### Removed
541
542 - deprecated string parsers (with the `_s` suffix), the normal version can be used instead
543 - `verbose-errors` is not needed anymore, now the error type can be decided when writing the parsers, and parsers provided by nom are generic over the error type
544 - `AtEof`, `CompleteByteSlice` and `CompleteStr` are gone, instead some parsers are specialized to work on streaming or complete input, and provided in different modules
545 - character parsers that were aliases to their `*1` version: eol, alpha, digit, hex_digit, oct_digit, alphanumeric, space, multispace
546 - `count_fixed` macro
547 - `whitespace::sp` can be replaced by `character::complete::multispace0`
548 - method combinators are now in the nom-methods crate
549 - `take_until_either`, `take_until_either1`, `take_until_either_and_consume` and `take_until_either_and_consume1`: they can be replaced with `is_not` (possibly combined with something else)
550 - `take_until_and_consume`, `take_until_and_consume1`: they can be replaced with `take_until` combined with `take`
551 - `sized_buffer` and `length_bytes!`: they can be replaced with the `length_data` function
552 - `non_empty`, `begin` and `rest_s` function
553 - `cond_reduce!`, `cond_with_error!`, `closure!`, `apply`, `map_res_err!`, `expr_opt!`, `expr_res!`
554 - `alt_complete`, `separated_list_complete`, `separated_nonempty_list_complete`
555
556 ## 4.2.3 - 2019-03-23
557
558 ### Fixed
559
560 - add missing `build.rs` file to the package
561 - fix code comparison links in changelog
562
563 ## 4.2.2 - 2019-03-04
564
565 ### Fixed
566
567 - regression in do_parse macro import for edition 2018
568
569 ## 4.2.1 - 2019-02-27
570
571 ### Fixed
572
573 - macro expansion error in `do_parse` due to `compile_error` macro usage
574
575 ## 4.2.0 - 2019-01-29
576
577 ### Thanks
578
579 - @JoshMcguigan for unit test fixes
580 - @oza for documentation fixes
581 - @wackywendell for better error conversion
582 - @Zebradil for documentation fixes
583 - @tsraom for new combinators
584 - @hcpl for minimum Rust version tests
585 - @KellerFuchs for removing some unsafe uses in float parsing
586
587 ### Changed
588
589 - macro import in edition 2018 code should work without importing internal macros now
590 - the regex parsers do not require the calling code to have imported the regex crate anymore
591 - error conversions are more ergonomic
592 - method combinators are now deprecated. They might be moved to a separate crate
593 - nom now specifies Rust 1.24.1 as minimum version. This was already the case before, now it is made explicit
594
595 ### Added
596
597 - `many0_count` and `many1_count` to count applications of a parser instead of
598 accumulating its results in a `Vec`
599
600 ### Fixed
601
602 - overflow in the byte wrapper for bit level parsers
603 - `f64` parsing does not use `transmute` anymore
604
605 ## 4.1.1 - 2018-10-14
606
607 ### Fixed
608
609 - compilation issue in verbose-errors mode for `add_return_error`
610
611 ## 4.1.0 - 2018-10-06
612
613 ### Thanks
614
615 - @xfix for fixing warnings, simplifying examples and performance fixes
616 - @dvberkel for documentation fixes
617 - @chifflier for fixing warnings
618 - @myrrlyn for dead code elimination
619 - @petrochenkov for removing redundant test macros
620 - @tbelaire for documentation fixes
621 - @khernyo for fixing warnings
622 - @linkmauve for documentation fixes
623 - @ProgVal for documentation fixes, warning fixes and error management
624 - @Nemo157 for compilation fixes
625 - @RReverser for documentation fixes
626 - @xpayn for fixing warnings
627 - Blas Rodriguez Irizar for documentation fixes
628 - @badboy for documentation fixes
629 - @kyrias for compilation fixes
630 - @kurnevsky for the `rest_len` parser
631 - @hjr3 for new documentation examples
632 - @fengalin for error management
633 - @ithinuel for the pcap example project
634 - @phaazon for documentation fixes
635 - @juchiast for documentation fixes
636 - @jrakow for the `u128` and `i128` parsers
637 - @smarnach for documentation fixes
638 - @derekdreery for `pub(crate)` support
639 - @YaLTeR for `map_res_err!`
640
641 ### Added
642
643 - `rest_len` parser, returns the length of the remaining input
644 - `parse_to` has its own error code now
645 - `u128` and `i128` parsers in big and little endian modes
646 - support for `pub(crate)` syntax
647 - `map_res_err!` combinator that appends the error of its argument function in verbose errors mode
648
649 ### Fixed
650
651 - lots of unused imports warnings were removed
652 - the `bytes` combinator was not compiling in some cases
653 - the big and little endian combinators now work without external imports
654 - CI is now faster and uses less cache
655 - in `add_return_error`, the provided error code is now evaluated only once
656
657 ### Changed
658
659 - `fold_many1` will now transmit a `Failure` instead of transforming it to an `Error`
660 - `float` and `double` now work on all of nom's input types (`&[u8]`, `&str`, `CompleteByteSlice`, `CompleteStr` and any type that implements the required traits). `float_s` and `double_s` got the same modification, but are now deprecated
661 - `CompleteByteSlice` and `CompleteStr` get a small optimization by inlining some functions
662
663
664 ## 4.0.0 - 2018-05-14
665
666 ### Thanks
667
668 - @jsgf for the new `AtEof` trait
669 - @tmccombs for fixes on `escaped*` combinators
670 - @s3bk for fixes around non Copy input types and documentation help
671 - @kamarkiewicz for fixes to no_std and CI
672 - @bheisler for documentation and examples
673 - @target-san for simplifying the `InputIter` trait for `&[u8]`
674 - @willmurphyscode for documentation and examples
675 - @Chaitanya1416 for typo fixes
676 - @fflorent for `input_len()` usage fixes
677 - @dbrgn for typo fixes
678 - @iBelieve for no_std fixes
679 - @kpp for warning fixes and clippy fixes
680 - @keruspe for fixes on FindToken
681 - @dtrebbien for fixes on take_until_and_consume1
682 - @Henning-K for typo fixes
683 - @vthriller for documentation fixes
684 - @federicomenaquintero and @veprbl for their help fixing the float parsers
685 - @vmchale for new named_args versions
686 - @hywan for documentation fixes
687 - @fbenkstein for typo fixes
688 - @CAD97 for catching missing trait implementations
689 - @goldenlentils for &str optimizations
690 - @passy for typo fixes
691 - @ayrat555 for typo fixes
692 - @GuillaumeGomez for documentation fixes
693 - @jrakow for documentation fixes and fixes for `switch!`
694 - @phlosioneer for documentation fixes
695 - @creativcoder for typo fixes
696 - @derekdreery for typo fixes
697 - @lucasem for implementing `Deref` on `CompleteStr` and `CompleteByteSlice`
698 - @lowenheim for `parse_to!` fixes
699 - @myrrlyn for trait fixes around `CompleteStr` and `CompleteByteSlice`
700 - @NotBad4U for fixing code coverage analysis
701 - @murarth for code formatting
702 - @glandium for fixing build in no_std
703 - @csharad for regex compatibility with `CompleteStr`
704 - @FauxFaux for implementing `AsRef<str>` on `CompleteStr`
705 - @jaje for implementing `std::Error` on `nom:Err`
706 - @fengalin for warning fixes
707 - @@khernyo for doc formatting
708
709 Special thanks to @corkami for the logo :)
710
711 ### Breaking changes
712
713 - the `IResult` type now becomes a `Result` from the standard library
714 - `Incomplete` now returns the additional data size needed, not the total data size needed
715 - verbose-errors is now a superset of basic errors
716 - all the errors now include the related input slice
717 - the arguments from `error_position` and other such macros were swapped to be more consistent with the rest of nom
718 - automatic error conversion: to fix error type inference issues, a custom error type must now implement `std::convert::From<u32>`
719 - the `not!` combinator returns unit `()`
720 - FindToken's calling convention was swapped
721 - the `take_*` combinators are now more coherent and stricter, see commit 484f6724ea3ccb for more information
722 - `many0` and other related parsers will now return `Incomplete` if the reach the end of input without an error of the child parser. They will also return `Incomplete` on an empty input
723 - the `sep!` combinator for whitespace only consumes whitespace in the prefix, while the `ws!` combinator takes care of consuming the remaining whitespace
724
725 ### Added
726
727 - the `AtEof` trait for input type: indicate if we can get more input data later (related to streaming parsers and `Incomplete` handling)
728 - the `escaped*` parsers now support the `&str`input type
729 - the `Failure` error variant represents an unrecoverable error, for which `alt` and 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
730 - the `CompleteByteSlice` and `CompleteStr` input types consider there will be no more refill of the input. They fixed the `Incomplete` related issues when we have all of the data
731 - the `exact!()` combinator will fail if we did not consume the whole input
732 - the `take_while_m_n!` combinator will match a specified number of characters
733 - `ErrorKind::TakeUntilAndConsume1`
734 - the `recognize_float` parser will match a float number's characters, but will not transform to a `f32` or `f64`
735 - `alpha` and other basic parsers are now much stricter about partial inputs. We also introduce the `*0` and `*1` versions of those parsers
736 - `named_args` can now specify the input type as well
737 - `HexDisplay` is now implemented for `&str`
738 - `alloc` feature
739 - the `InputTakeAtposition` trait allows specialized implementations of parsers like `take_while!`
740
741 ### Removed
742
743 - the producers and consumers were removed
744 - the `error_code` and `error_node` macros are not used anymore
745
746 ### Fixed
747
748 - `anychar!` now works correctly with multibyte characters
749 - `take_until_and_consume1!` no longer results in "no method named \`find_substring\`" and "no method named \`slice\`" compilation errors
750 - `take_until_and_consume1!` returns the correct Incomplete(Needed) amount
751 - `no_std` compiles properly, and nom can work with `alloc` too
752 - `parse_to!` now consumes its input
753
754 ### Changed
755
756 - `alt` and other combinators will now clone the input if necessary. If the input is already `Copy` there is no performance impact
757 - the `rest` parser now works on various input types
758 - `InputIter::Item` for `&[u8]` is now a `u8` directly, not a reference
759 - we now use the `compile_error` macro to return a compile time error if there was a syntax issue
760 - the permutation combinator now supports optional child parsers
761 - the float numbers parsers have been refactored to use one common implementation that is nearly 2 times faster than the previous one
762 - the float number parsers now accept more variants
763
764
765 ## 3.2.1 - 2017-10-27
766
767 ### Thanks
768
769 - @ordian for `alt_complete` fixes
770 - @friedm for documentation fixes
771 - @kali for improving error management
772
773 ### Fixed
774
775 - there were cases where `alt_complete` could return `Incomplete`
776
777 ### Added
778
779 - an `into_error_kind` method 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
780
781
782 ## 3.2.0 - 2017-07-24
783
784 ### Thanks
785
786 - @jedireza for documentation fixes
787 - @gmorenz for the `bytes` combinator
788 - @meh for character combinator fixes for UTF-8
789 - @jethrogb for avoiding move issues in `separated_list`
790
791 ### Changed
792
793 - new layout for the main page of documentation
794 - `anychar` can now work on any input type
795 - `length_bytes` is now an alias for `length_data`
796
797 ### Fixed
798
799 - `one_of`, `none_of` and `char` will now index correctly UTF-8 characters
800 - the `compiler_error` macro is now correctly exported
801
802
803 ### Added
804
805 - the `bytes` combinator transforms a bit stream back to a byte slice for child parsers
806
807 ## 3.1.0 - 2017-06-16
808
809 ### Thanks
810
811 - @sdroege: implementing be_i24 and le_i24
812 - @Hywan: integrating faster substring search using memchr
813 - @nizox: fixing type issues in bit stream parsing
814 - @grissiom: documentation fixes
815 - @doomrobo: implementing separated_list_complete and separated_nonempty_list_complete
816 - @CWood1: fixing memchr integration in no_std
817 - @lu_zero: integrating the compiler_error crate
818 - @dtolnay: helping debug a type inference issue in map
819
820 ### Changed
821
822 - memchr is used for substring search if possible
823 - 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
824 - `count` no longer preallocates its vector
825
826 ### Fixed
827
828 - better type inference in alt_complete
829 - `alt` should now work with whitespace parsing
830 - `map` should not make type inference errors anymore
831
832 ### Added
833
834 - be_i24 and le_i24, parsing big endian and little endian signed 24 bit integers
835 - `separated_list_complete` and `separated_nonempty_list_complete` will treat incomplete from sub parsers as error
836
837 ## 3.0.0 - 2017-05-12
838
839 ### Thanks
840
841 - Chris Pick for some `Incomplete` related refactors
842 - @dbrgn for documentation fixes
843 - @valarauca for adding `be_u24`
844 - @ithinuel for usability fixes
845 - @evuez for README readability fixes and improvements to `IResult`
846 - @s3bk for allowing non-`Copy` types as input
847 - @keruspe for documentation fixes
848 - @0xd34d10cc for trait fixes on `InputIter`
849 - @sdleffler for lifetime shenanigans on `named_args`
850 - @chengsun for type inference fixes in `alt`
851 - @iBelieve for adding str to no_std
852 - @Hywan for simplifying code in input traits
853 - @azerupi for extensive documentation of `alt` and `alt_complete`
854
855 ### Breaking Changes
856
857 - `escaped`, `separated_list` and `separated_nonempty_list` can now return `Incomplete` when necessary
858 - `InputIter` does not require `AsChar` on its `Item` type anymore
859 - the `core` feature that was putting nom in `no_std` mode has been removed. There is now a `std` feature, activated by default. If it is not activated, nom is in `no_std`
860 - in `verbose-errors` mode, the error list is now stored in a `Vec` instead of a box based linked list
861 - `chain!` has finally been removed
862
863 ### Changed
864
865 - `Endianness` now implements `Debug`, `PartialEq`, `Eq`, `Clone` and `Copy`
866 - custom input types can now be cloned if they're not `Copy`
867 - the infamous 'Cannot infer type for E' error should happen less often now
868 - `str` is now available in `no_std` mode
869
870 ### Fixed
871
872 - `FileProducer` will be marked as `Eof` on full buffer
873 - `named_args!` now has lifetimes that cannot conflict with the lifetimes from other arguments
874
875 ### Added
876
877 - `be_u24`: big endian 24 bit unsigned integer parsing
878 - `IResult` now has a `unwrap_or` method
879
880
881 ## 2.2.1 - 2017-04-03
882
883 ### Thanks
884
885 - @Victor-Savu for formatting fixes in the README
886 - @chifflier for detecting and fixing integer overflows
887 - @utkarshkukreti for some performance improvements in benchmarks
888
889 ### Changed
890
891 - 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
892
893 ## 2.2.0 - 2017-03-20
894
895 ### Thanks
896
897 - @seppo0010 for fixing `named_args`
898 - @keruspe for implementing or() on `IResult`, adding the option of default cases in `switch!`, adding support for `cargo-travis`
899 - @timlyo for documentation fixes
900 - @JayKickliter for extending `hex_u32`
901 - @1011X for fixing regex integration
902 - @Kerollmops for actually marking `chain!` as deprecated
903 - @joliss for documentation fixes
904 - @utkarshkukreti for tests refactoring and performance improvement
905 - @tmccombs for documentation fixes
906
907 ### Added
908
909 - `IResult` gets an `or()` method
910 - `take_until1`, `take_until_and_consume1`, `take_till1!` and `take_till1_s!` require at least 1 character
911
912 ### Changed
913
914 - `hex_u32` accepts uppercase digits as well
915 - the character based combinators leverage the input traits
916 - the whitespace parsers now work on &str and other types
917 - `take_while1` returns `Incomplete` on empty input
918 - `switch!` can now take a default case
919
920 ### Fixed
921
922 - `named_args!` now imports `IResult` directly
923 - the upgrade to regex 0.2 broke the regex combinators, they work now
924
925 ## 2.1.0 - 2017-01-27
926
927 ### Thanks
928
929 - @nickbabcock for documentation fixes
930 - @derekdreery for documentation fixes
931 - @DirkyJerky for documentation fixes
932 - @saschagrunert for documentation fixes
933 - @lucab for documentation fixes
934 - @hyone for documentation fixes
935 - @tstorch for factoring `Slice`
936 - @shepmaster for adding crate categories
937 - @antoyo for adding `named_args!`
938
939 ### Added
940
941 - `verify!` uses a first parser, then applies a function to check that its result satisfies some conditions
942 - `named_args!` creates a parser function that can accept other arguments along with the input
943 - `parse_to!` will use the `parse` method from `FromStr` to parse a value. It will automatically translate the input to a string if necessary
944 - `float`, `float_s`, `double`, `double_s` can recognize floating point numbers in text
945
946 ### Changed
947
948 - `escaped!` will now return `Incomplete` if needed
949 - `permutation!` supports up to 20 child parsers
950
951 ## 2.0.1 - 2016-12-10
952
953 Bugfix release
954
955 *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.
956
957 ### Thanks
958
959 - @nickbabcock for catching and fixing the `add_error!` mixup
960 - @lucab for documentation fixes
961 - @jtdowney for noticing that `tag_no_case!` was not working at all for byte slices
962
963 ### Fixed
964
965 - `add_error!` has been renamed to `add_return_error!`
966 - the `not!` combinator now accepts functions
967 - `tag_no_case!` is now working as accepted (before, it accepted everything)
968
969
970 ## 2.0 - 2016-11-25
971
972 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.
973
974 Since this version introduces a few breaking changes, an [upgrade documentation](https://github.com/rust-bakery/nom/blob/main/doc/archive/upgrading_to_nom_2.md) 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.
975
976 This version also adds a lot of interesting features, like the permutation combinator or whitespace separated formats support.
977
978 ### Thanks
979
980 - @lu-zero for license help
981 - @adamgreig for type inference fixes
982 - @keruspe for documentation and example fixes, for the `IResult => Result` conversion work, making `AsChar`'s method more consistent, and adding `many_till!`
983 - @jdeeny for implementing `Offset` on `&str`
984 - @vickenty for documentation fixes and his refactoring of `length_value!` and `length_bytes!`
985 - @overdrivenpotato for refactoring some combinators
986 - @taralx for documentation fixes
987 - @keeperofdakeys for fixing eol behaviour, writing documentation and adding `named_attr!`
988 - @jturner314 for writing documentation
989 - @bozaro for fixing compilation errors
990 - @uniphil for adding a `crates.io` badge
991 - @badboy for documentation fixes
992 - @jugglerchris for fixing `take_s!`
993 - @AndyShiue for implementing `Error` and `Display` on `ErrorKind` and detecting incorrect UTF-8 string indexing
994
995 ### Added
996
997 - 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
998 - nom can now work on any type that implement the traits defined in `src/traits.rs`: `InputLength`, `InputIter`, `InputTake`, `Compare`, `FindToken`, `FindSubstring`, `Slice`
999 - 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](https://crates.io/crates/cargo-external-doc)
1000 - whitespace separated format support: with the `ws!` combinator, you can automatically introduce whitespace parsers between all parsers and combinators
1001 - the `permutation!` combinator applies its child parsers in any order, as long as they all succeed once, and return a tuple of the results
1002 - `do_parse!` is a simpler alternative to `chain!`, which is now deprecated
1003 - you can now transform an `IResult` in a `std::result::Result`
1004 - `length_data!` parses a length, and returns a subslice of that length
1005 - `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
1006 - `named_attr!` creates functions like `named!` but can add attributes like documentation
1007 - `many_till!` applies repeatedly its first child parser until the second succeeds
1008
1009 ### Changed
1010
1011 - the "verbose" error management that was available in previous versions is now activated by the "verbose-errors" compilation feature
1012 - code reorganization: most of the parsers were moved in separate files to make the source easier to navigate
1013 - most of the combinators are now independent from the input type
1014 - the `eof` function was replaced with the `eof!` macro
1015 - `error!` and `add_error!` were replaced with `return_error!` and `add_return_error!` to fix the name conflict with the log crate
1016 - the `offset()` method is now in the `Offset` trait
1017 - `length_value!` has been renamed to `length_count!`. The new `length_value!` selects a slice and applies the second parser once on that slice
1018 - `AsChar::is_0_to_9` is now `AsChar::is_dec_digit`
1019 - the combinators with configurable endianness now take an enum instead of a boolean as parameter
1020
1021 ### Fixed
1022 - the `count!`, `count_fixed!` and `length_*!` combinator calculate incomplete data needs correctly
1023 - `eol`, `line_ending` and `not_line_ending` now have a consistent behaviour that works correctly with incomplete data
1024 - `take_s!` didn't correctly handle the case when the slice is exactly the right length
1025
1026 ## 1.2.4 - 2016-07-20
1027
1028 ### Thanks
1029 - @Phlosioneer for documentation fixes
1030 - @sourrust for fixing offsets in `take_bits!`
1031 - @ChrisMacNaughton for the XFS crate
1032 - @pwoolcoc for `rest_s`
1033 - @fitzgen for more `IResult` methods
1034 - @gtors for the negative lookahead feature
1035 - @frk1 and @jeandudey for little endian float parsing
1036 - @jethrogb for fixing input usage in `many1`
1037 - @acatton for beating me at nom golf :D
1038
1039 ### Added
1040 - the `rest_s` method on `IResult` returns the remaining `&str` input
1041 - `unwrap_err` and `unwrap_inc` methods on `IResult`
1042 - `not!` will peek at the input and return `Done` if the underlying parser returned `Error` or `Incomplete`, without consuming the input
1043 - `le_f32` and `le_f64` parse little endian floating point numbers (IEEE 754)
1044 -
1045
1046 ### Fixed
1047 - documentation fixes
1048 - `take_bits!` is now more precise
1049 - `many1` inccorectly used the `len` function instead of `input_len`
1050 - the INI parser is simpler
1051 - `recognize!` had an early `return` that is removed now
1052
1053 ## 1.2.3 - 2016-05-10
1054
1055 ### Thanks
1056 - @lu-zero for the contribution guidelines
1057 - @GuillaumeGomez for fixes on `length_bytes` and some documentation
1058 - @Hywan for documentation and test fixes
1059 - @Xirdus for correct trait import issues
1060 - @mspiegel for the new AST example
1061 - @cholcombe973 for adding the `cond_with_error!` combinator
1062 - @tstorch for refactoring `many0!`
1063 - @panicbit for the folding combinators
1064 - @evestera for `separated_list!` fixes
1065 - @DanielKeep for correcting some enum imports
1066
1067 ### Added
1068 - Regular expression combinators starting with `re_bytes_` work on byte slices
1069 - example parsing arithmetic expressions to an AST
1070 - `cond_with_error!` works like `cond!` but will return `None` if the condition is false, and `Some(value)` if the underlying parser succeeded
1071 - `fold_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 parser
1072
1073 ### Fixed
1074 - `length_bytes!` converts the result of its child parser to usize
1075 - `take_till!` now imports `InputLength` instead of assuming it's in scope
1076 - `separated_list!` and `separated_nonempty_list!` will not consume the separator if there's no following successfully parsed value
1077 - no more warnings on build
1078
1079 ### Changed
1080 - simpler implementation of `many0!`
1081
1082 ## 1.2.2 - 2016-03-09
1083
1084 ### Thanks
1085 - @conradev for fixing `take_until_s!`
1086 - @GuillaumeGomez for some documentation fixes
1087 - @frewsxcv for some documentation fixes
1088 - @tstorch for some test refactorings
1089
1090 ### Added
1091 - `nom::Err` now implements `std::error::Error`
1092
1093 ### Fixed
1094 - `hex_u32` does not parses more than 8 chars now
1095 - `take_while!` and `take_while1!` will not perturb the behaviour of `recognize!` anymore
1096
1097 ## 1.2.1 - 2016-02-23
1098
1099 ### Thanks
1100 - @sourrust for adding methods to `IResult`
1101 - @tstorch for the test refactoring, and for adding methods to `IResult` and `Needed`
1102 - @joelself for fixing the method system
1103
1104 ### Added
1105
1106 - mapping methods over `IResult` and `Needed`
1107
1108 ### Changed
1109
1110 - `apply_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 release
1111 - the `regexp_macros` feature that used `regex!` to precompile regular expressions has been replaced by the normal regex engine combined with `lazy_static`
1112
1113 ### Fixed
1114
1115 - 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()..]`.
1116 - The `regexp_macros` and `no_std` feature build again and are now tested with Travis CI
1117
1118 ## 1.2.0 - 2016-02-08
1119
1120 ### Thanks
1121 - @zentner-kyle for type inference fixes
1122 - @joelself for his work on `&str` parsing and method parsers
1123 - @GuillaumeGomez for implementing methods on `IResult`
1124 - @dirk for the `alt_complete!` combinator
1125 - @tstorch for a lot of refactoring work and unit tests additions
1126 - @jansegre for the hex digit parsers
1127 - @belgum for some documentation fixes
1128 - @lwandrebeck for some documentation fixes and code fixes in `hex_digit`
1129
1130 ### Added
1131 - `take_until_and_consume_s!` for consumption of string data until a tag
1132 - more function patterns in `named!`. The error type can now be specified
1133 - `alt_complete!` works like the `alt!` combinator, but tries the next branch if the current one returned `Incomplete`, instead of returning directly
1134 - more unit tests for a lot of combinators
1135 - hexadecimal digit parsers
1136 - 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 of `chain!`
1137 - parsers can now be implemented as a method for a struct thanks to the `method!`, `call_m!` and `apply_rf!` combinators
1138
1139 ### Fixed
1140 - there were type inference issues in a few combinators. They will now be easier to compile
1141 - `peek!` compilation with bare functions
1142 - `&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 indexes
1143 - some method implementations were missing on `IResult<I,O,E>` (with specified error type instead of implicit)
1144
1145 ## 1.1.0 - 2016-01-01
1146
1147 This release adds a lot of features related to `&str` parsing. The previous versions
1148 were focused on `&[u8]` and bit streams parsing, but there's a need for more text
1149 parsing with nom. The parsing functions like `alpha`, `digit` and others will now
1150 accept either a `&[u8]` or a `&str`, so there is no breaking change on that part.
1151
1152 There are also a few performance improvements and documentation fixes.
1153
1154 ### Thanks
1155 - @Binero for pushing the work on `&str` parsing
1156 - @meh for fixing `Option` and `Vec` imports
1157 - @hoodie for a documentation fix
1158 - @joelself for some documentation fixes
1159 - @vberger for his traits magic making nom functions more generic
1160
1161 ### Added
1162
1163 - string related parsers: `tag_s!`, `take_s!`, `is_a_s!`, `is_not_s!`, `take_while_s!`, `take_while1_s!`, `take_till_s!`
1164 - `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
1165
1166 ### Changed
1167
1168 - `tag!` will now compare even on partial input. If it expects "abcd" but receives "ef", it will now return an `Error` instead of `Incomplete`
1169 - `many0!` and others will preallocate a larger vector to avoid some copies and reallocations
1170 - `alpha`, `digit`, `alphanumeric`, `space` and `multispace` now accept as input a `&[u8]` or a `&str`. Additionally, they return an error if they receive an empty input
1171 - `take_while!`, `take_while1!`, `take_while_s!`, `take_while1_s!` wilreturn an error on empty input
1172
1173 ### Fixed
1174
1175 - if the child parser of `many0!` or `many1!` returns `Incomplete`, it will return `Incomplete` too, possibly updating the needed size
1176 - `Option,` `Some`, `None` and `Vec` are now used with full path imports
1177
1178 ## 1.0.1 - 2015-11-22
1179
1180 This releases makes the 1.0 version compatible with Rust 1.2 and 1.3
1181
1182 ### Thanks
1183 - @steveklabnik for fixing lifetime issues in Producers and Consumers
1184
1185 ## 1.0.0 - 2015-11-16
1186
1187 Stable release for nom. A lot of new features, a few breaking changes
1188
1189 ### Thanks
1190 - @ahenry for macro fixes
1191 - @bluss for fixing documentation
1192 - @sourrust for cleaning code and debugging the new streaming utilities
1193 - @meh for inline optimizations
1194 - @ccmtaylor for fixing function imports
1195 - @soro for improvements to the streaming utilities
1196 - @breard-r for catching my typos
1197 - @nelsonjchen for catching my typos too
1198 - @divarvel for hex string parsers
1199 - @mrordinaire for the `length_bytes!` combinator
1200
1201 ### Breaking changes
1202 - `IResult::Error` can now use custom error types, and is generic over the input type
1203 - Producers and consumers have been replaced. The new implementation uses less memory and integrates more with parsers
1204 - `nom::ErrorCode` is now `nom::ErrorKind`
1205 - `filter!` has been renamed to `take_while!`
1206 - `chain!` will count how much data is consumed and use that number to calculate how much data is needed if a parser returned `Incomplete`
1207 - `alt!` returns `Incomplete` if a child parser returned `Incomplete`, instead of skipping to the next parser
1208 - `IResult` does not require a lifetime tag anymore, yay!
1209
1210 ### Added
1211
1212 - `complete!` will return an error if the child parser returned `Incomplete`
1213 - `add_error!` will wrap an error, but allow backtracking
1214 - `hex_u32` parser
1215
1216 ### Fixed
1217 - the behaviour around `Incomplete` is better for most parsers now
1218
1219 ## 0.5.0 - 2015-10-16
1220
1221 This release fixes a few issues and stabilizes the code.
1222
1223 ### Thanks
1224 - @nox for documentation fixes
1225 - @daboross for linting fixes
1226 - @ahenry for fixing `tap!` and extending `dbg!` and `dbg_dmp!`
1227 - @bluss for tracking down and fixing issues with unsafe code
1228 - @meh for inlining parser functions
1229 - @ccmtaylor for fixing import of `str::from_utf8`
1230
1231 ### Fixed
1232 - `tap!`, `dbg!` and `dbg_dmp!` now accept function parameters
1233
1234 ### Changed
1235 - the type used in `count_fixed!` must be `Copy`
1236 - `chain!` calculates how much data is needed if one of the parsers returns `Incomplete
1237 - optional parsers in `chain!` can return `Incomplete`
1238
1239 ## 0.4.0 - 2015-09-08
1240
1241 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!
1242
1243 ### Thanks
1244 - @frewsxcv for documentation fixes
1245 - @ngrewe for his work on producers and consumers
1246 - @meh for fixes on `chain!` and for the `rest` parser
1247 - @daboross for refactoring `many0!` and `many1!`
1248 - @aleksander for the `switch!` combinator idea
1249 - @TechnoMancer for his help with bit level parsing
1250 - @sxeraverx for pointing out a bug in `is_a!`
1251
1252 ### Fixed
1253 - `count_fixed!` must take an explicit type as argument to generate the fixed-size array
1254 - optional parsing behaviour in `chain!`
1255 - `count!` can take 0 elements
1256 - `is_a!` and `is_not!` can now consume the whole input
1257
1258 ### Added
1259 - it is now possible to seek to the end of a `MemProducer`
1260 - `opt!` returns `Done(input, None)` if `the child parser returned `Incomplete`
1261 - `rest` will return the remaining input
1262 - consumers can now seek to and from the end of input
1263 - `switch!` applies a first parser then matches on its result to choose the next parser
1264 - bit-level parsers
1265 - character-level parsers
1266 - regular expression parsers
1267 - implementation of `take_till!`, `take_while!` and `take_while1!`
1268
1269 ### Changed
1270 - `alt!` can return `Incomplete`
1271 - the error analysis functions will now take references to functions instead of moving them
1272 - performance improvements on producers
1273 - performance improvement for `filter!`
1274 - performance improvement for `count!`: a `Vec` of the right size is directly allocated
1275
1276 ## 0.3.11 - 2015-08-04
1277
1278 ### Thanks
1279 - @bluss for remarking that the crate included random junk lying non committed in my local repository
1280
1281 ### Fixed
1282 - cleanup of my local repository will ship less files in the crates, resulting in a smaller download
1283
1284 ## 0.3.10 - 2015-08-03
1285
1286 ### Added
1287
1288 - `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!`
1289 - `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
1290 - bit level parsers are all written in `src/bits.rs`
1291
1292 ### Changed
1293
1294 - Parsers that specifically handle bytes have been moved to src/bytes.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!`
1295
1296 ## 0.3.9 - 2015-07-20
1297
1298 ### Thanks
1299 - @badboy for fixing `filter!`
1300 - @idmit for some documentation fixes
1301
1302 ### Added
1303 - `opt_res!` applies a parser and transform its result in a Result. This parser never fails
1304 - `cond_reduce!` takes an expression as parameter, applies the parser if the expression is true, and returns an error if the expression is false
1305 - `tap!` pass the result of a parser to a block to manipulate it, but do not affect the parser's result
1306 - `AccReader` is a Read+BufRead that supports data accumulation and partial consumption. The `consume` method must be called afterwardsto indicate how much was consumed
1307 - Arithmetic expression evaluation and parsing example
1308 - `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
1309 - type information for combinators. This will make the documentation a bit easier to navigate
1310
1311 ### Fixed
1312 - `map_opt!` and `map_res!` had issues with argument order due to bad macros
1313 - `delimited!` did not compile for certain combinations of arguments
1314 - `filter!` did not return a byte slice but a fixed array
1315
1316 ## 0.3.8 - 2015-07-03
1317
1318 ### Added
1319 - code coverage is now calculated automatically on Travis CI
1320 - `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 call
1321 - `ReadProducer`: takes something implementing `Read`, and makes a `Producer` out of it
1322
1323 ### Fixed
1324 - the combinators `separated_pair!` and `delimited!` did not work because an implementation macro was not exported
1325 - if a `MemProducer` reached its end, it should always return `Eof`
1326 - `map!` had issues with argument matching
1327
1328 ## 0.3.7 - 2015-06-24
1329
1330 ### Added
1331 - `expr_res!` and `expr_opt!` evaluate an expression returning a Result or Opt and convert it to IResult
1332 - `AsBytes` is implemented for fixed size arrays. This allows `tag!([41u8, 42u8])`
1333
1334 ### Fixed
1335 - `count_fixed!` argument parsing works again
1336
1337 ## 0.3.6 - 2015-06-15
1338
1339 ### Added
1340 - documentation for a few functions
1341 - the consumer trait now requires the `failed(&self, error_code)` method in case of parsing error
1342 - `named!` now handles the alternative `named!(pub fun_name<OutputType>, ...)`
1343
1344 ### Fixed
1345 - `filter!` now returns the whole input if the filter function never returned false
1346 - `take!` casts its argument as usize, so it can accepts any integer type now
1347
1348 ## 0.3.5 - 2015-06-10
1349
1350 ### Thanks
1351 - @cmr for some documentation fixes
1352
1353 ### Added
1354 - `count_fixed!` returns a fixed array
1355
1356 ### Fixed
1357 - `count!` is back to the previous behaviour, returning a `Vec` for sizes known at runtime
1358
1359 ### Changed
1360 - functions and traits exported from `nom::util` are now directly in `nom::`
1361
1362 ## 0.3.4 - 2015-06-09
1363
1364 ### Thanks
1365 - @andrew-d for fixes on `cond!`
1366 - @keruspe for features in `chain!`
1367
1368 ### Added
1369 - `chain!` can now have mutable fields
1370
1371 ### Fixed
1372 - `cond!` had an infinite macro recursion
1373
1374 ### Changed
1375 - `chain!` generates less code now. No apprent compilation time improvement
1376
1377 ## 0.3.3 - 2015-06-09
1378
1379 ### Thanks
1380 - @andrew-d for the little endian signed integer parsers
1381 - @keruspe for fixes on `count!`
1382
1383 ### Added
1384 - `le_i8`, `le_i16`, `le_i32`, `le_i64`: little endian signed integer parsers
1385
1386 ### Changed
1387 - the `alt!` parser compiles much faster, even with more than 8 branches
1388 - `count!` can now return a fixed size array instead of a growable vector
1389
1390 ## 0.3.2 - 2015-05-31
1391
1392 ### Thanks
1393 - @keruspe for the `take_str` parser and the function application combinator
1394
1395 ### Added
1396 - `take_str!`: takes the specified number of bytes and return a UTF-8 string
1397 - `apply!`: do partial application on the parameters of a function
1398
1399 ### Changed
1400 - `Needed::Size` now contains a `usize` instead of a `u32`
1401
1402 ## 0.3.1 - 2015-05-21
1403
1404 ### Thanks
1405 - @divarvel for the big endian signed integer parsers
1406
1407 ### Added
1408 - `be_i8`, `be_i16`, `be_i32`, `be_i64`: big endian signed integer parsers
1409 - the `core` feature can be passed to cargo to build with `no_std`
1410 - colored hexdump can be generated from error chains
1411
1412 ## 0.3.0 - 2015-05-07
1413
1414 ### Thanks
1415 - @filipegoncalves for some documentation and the new eof parser
1416 - @CrimsonVoid for putting fully qualified types in the macros
1417 - @lu_zero for some documentation fixes
1418
1419 ### Added
1420 - new error types that can contain an error code, an input slice, and a list of following errors
1421 - `error!` will cut backtracking and return directly from the parser, with a specified error code
1422 - `eof` parser, successful if there is no more input
1423 - specific error codes for the parsers provided by nom
1424
1425 ### Changed
1426 - fully qualified types in macros. A lot of imports are not needed anymore
1427
1428 ### Removed
1429 - `FlatMap`, `FlatpMapOpt` and `Functor` traits (replaced by `map!`, `map_opt!` and `map_res!`)
1430
1431 ## 0.2.2 - 2015-04-12
1432
1433 ### Thanks
1434 - @filipegoncalves and @thehydroimpulse for debugging an infinite loop in many0 and many1
1435 - @thehydroimpulse for suggesting public named parsers
1436 - @skade for removing the dependency on the collections gate
1437
1438 ### Added
1439 - `named!` can now declare public functions like this: `named!(pub tst, tag!("abcd"));`
1440 - `pair!(X,Y)` returns a tuple `(x, y)`
1441 - `separated_pair!(X, sep, Y)` returns a tuple `(x, y)`
1442 - `preceded!(opening, X)` returns `x`
1443 - `terminated!(X, closing)` returns `x`
1444 - `delimited(opening, X, closing)` returns `x`
1445 - `separated_list(sep, X)` returns a `Vec<X>`
1446 - `separated_nonempty_list(sep, X)` returns a `Vec<X>` of at list one element
1447
1448 ### Changed
1449 - `many0!` and `many1!` forbid parsers that do not consume input
1450 - `is_a!`, `is_not!`, `alpha`, `digit`, `space`, `multispace` will now return an error if they do not consume at least one byte
1451
1452 ## 0.2.1 - 2015-04-04
1453
1454 ### Thanks
1455 - @mtsr for catching the remaining debug println!
1456 - @jag426 who killed a lot of warnings
1457 - @skade for removing the dependency on the core feature gate
1458
1459
1460 ### Added
1461 - little endian unsigned int parsers le_u8, le_u16, le_u32, le_u64
1462 - `count!` to apply a parser a specified number of times
1463 - `cond!` applies a parser if the condition is met
1464 - more parser development tools in `util::*`
1465
1466 ### Fixed
1467 - in one case, `opt!` would not compile
1468
1469 ### Removed
1470 - most of the feature gates are now removed. The only one still needed is `collections`
1471
1472 ## 0.2.0 - 2015-03-24
1473 *works with `rustc 1.0.0-dev (81e2396c7 2015-03-19) (built 2015-03-19)`*
1474
1475 ### Thanks
1476 - Ryman for the AsBytes implementation
1477 - jag426 and jaredly for documentation fixes
1478 - eternaleye on #rust IRC for his help on the new macro syntax
1479
1480 ### Changed
1481 - the AsBytes trait improves readability, no more b"...", but "..." instead
1482 - 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
1483 - `alt!` can pass the result of the parser to a closure
1484 - 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!`
1485
1486 ### Added
1487 - `peek!` macro: matches the future input but does not consume it
1488 - `length_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 parser
1489 - benchmarks are available at https://github.com/rust-bakery/parser_benchmarks
1490 - more documentation
1491 - **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.
1492 - `named!`, `closure!` and `call!` macros used to support the unnamed syntax
1493 - `map!`, `map_opt!` and `map_res!` to combine a parser with a normal function, transforming the input directly, or returning an `Option` or `Result`
1494
1495 ### Fixed
1496 - `is_a!` is now working properly
1497
1498 ### Removed
1499 - the `o!` macro does less than `chain!`, so it has been removed
1500 - the `fold0!` and `fold1!` macros were too complex and awkward to use, the `many*` combinators will be useful for most uses for now
1501
1502 ## 0.1.6 - 2015-02-24
1503 ### Changed
1504 - consumers must have an end method that will be called after parsing
1505
1506 ### Added
1507 - big endian unsigned int and float parsers: be_u8, be_u16, be_u32, be_u64, be_f32, be_f64
1508 - producers can seek
1509 - function and macros documentation
1510 - README documentation
1511 ### Fixed
1512 - lifetime declarations
1513 - tag! can return Incomplete
1514
1515 ## 0.1.5 - 2015-02-17
1516 ### Changed
1517 - traits were renamed: FlatMapper -> FlatMap, Mapper -> FlatMapOpt, Mapper2 -> Functor
1518
1519 ### Fixed
1520 - woeks with rustc f1bb6c2f4
1521
1522 ## 0.1.4 - 2015-02-17
1523 ### Changed
1524 - the chaining macro can take optional arguments with '?'
1525
1526 ## 0.1.3 - 2015-02-16
1527 ### Changed
1528 - the chaining macro now takes the closure at the end of the argument list
1529
1530 ## 0.1.2 - 2015-02-16
1531 ### Added
1532 - flat_map implementation for <&[u8], &[u8]>
1533 - chaining macro
1534 - partial MP4 parser example
1535
1536
1537 ## 0.1.1 - 2015-02-06
1538 ### Fixed
1539 - closure syntax change
1540
1541 ## Compare code
1542
1543 * [unreleased](https://github.com/rust-bakery/nom/compare/8.0.0...HEAD)
1544 * [8.0.0](https://github.com/rust-bakery/nom/compare/7.1.3...8.0.0)
1545 * [7.1.3](https://github.com/rust-bakery/nom/compare/7.1.2...7.1.3)
1546 * [7.1.2](https://github.com/rust-bakery/nom/compare/7.1.1...7.1.2)
1547 * [7.1.1](https://github.com/rust-bakery/nom/compare/7.1.0...7.1.1)
1548 * [7.1.0](https://github.com/rust-bakery/nom/compare/7.0.0...7.1.0)
1549 * [7.0.0](https://github.com/rust-bakery/nom/compare/6.2.1...7.0.0)
1550 * [6.2.1](https://github.com/rust-bakery/nom/compare/6.2.0...6.2.1)
1551 * [6.2.0](https://github.com/rust-bakery/nom/compare/6.1.2...6.2.0)
1552 * [6.1.2](https://github.com/rust-bakery/nom/compare/6.1.1...6.1.2)
1553 * [6.1.1](https://github.com/rust-bakery/nom/compare/6.1.0...6.1.1)
1554 * [6.1.0](https://github.com/rust-bakery/nom/compare/6.0.1...6.1.0)
1555 * [6.0.1](https://github.com/rust-bakery/nom/compare/6.0.0...6.0.1)
1556 * [6.0.0](https://github.com/rust-bakery/nom/compare/5.1.1...6.0.0)
1557 * [5.1.1](https://github.com/rust-bakery/nom/compare/5.1.0...5.1.1)
1558 * [5.1.0](https://github.com/rust-bakery/nom/compare/5.0.1...5.1.0)
1559 * [5.0.1](https://github.com/rust-bakery/nom/compare/5.0.0...5.0.1)
1560 * [5.0.0](https://github.com/rust-bakery/nom/compare/4.2.3...5.0.0)
1561 * [4.2.3](https://github.com/rust-bakery/nom/compare/4.2.2...4.2.3)
1562 * [4.2.2](https://github.com/rust-bakery/nom/compare/4.2.1...4.2.2)
1563 * [4.2.1](https://github.com/rust-bakery/nom/compare/4.2.0...4.2.1)
1564 * [4.2.0](https://github.com/rust-bakery/nom/compare/4.1.1...4.2.0)
1565 * [4.1.1](https://github.com/rust-bakery/nom/compare/4.1.0...4.1.1)
1566 * [4.1.0](https://github.com/rust-bakery/nom/compare/4.0.0...4.1.0)
1567 * [4.0.0](https://github.com/rust-bakery/nom/compare/3.2.1...4.0.0)
1568 * [3.2.1](https://github.com/rust-bakery/nom/compare/3.2.0...3.2.1)
1569 * [3.2.0](https://github.com/rust-bakery/nom/compare/3.1.0...3.2.0)
1570 * [3.1.0](https://github.com/rust-bakery/nom/compare/3.0.0...3.1.0)
1571 * [3.0.0](https://github.com/rust-bakery/nom/compare/2.2.1...3.0.0)
1572 * [2.2.1](https://github.com/rust-bakery/nom/compare/2.2.0...2.2.1)
1573 * [2.2.0](https://github.com/rust-bakery/nom/compare/2.1.0...2.2.0)
1574 * [2.1.0](https://github.com/rust-bakery/nom/compare/2.0.1...2.1.0)
1575 * [2.0.1](https://github.com/rust-bakery/nom/compare/2.0.0...2.0.1)
1576 * [2.0.0](https://github.com/rust-bakery/nom/compare/1.2.4...2.0.0)
1577 * [1.2.4](https://github.com/rust-bakery/nom/compare/1.2.3...1.2.4)
1578 * [1.2.3](https://github.com/rust-bakery/nom/compare/1.2.2...1.2.3)
1579 * [1.2.2](https://github.com/rust-bakery/nom/compare/1.2.1...1.2.2)
1580 * [1.2.1](https://github.com/rust-bakery/nom/compare/1.2.0...1.2.1)
1581 * [1.2.0](https://github.com/rust-bakery/nom/compare/1.1.0...1.2.0)
1582 * [1.1.0](https://github.com/rust-bakery/nom/compare/1.0.1...1.1.0)
1583 * [1.0.1](https://github.com/rust-bakery/nom/compare/1.0.0...1.0.1)
1584 * [1.0.0](https://github.com/rust-bakery/nom/compare/0.5.0...1.0.0)
1585 * [0.5.0](https://github.com/rust-bakery/nom/compare/0.4.0...0.5.0)
1586 * [0.4.0](https://github.com/rust-bakery/nom/compare/0.3.11...0.4.0)
1587 * [0.3.11](https://github.com/rust-bakery/nom/compare/0.3.10...0.3.11)
1588 * [0.3.10](https://github.com/rust-bakery/nom/compare/0.3.9...0.3.10)
1589 * [0.3.9](https://github.com/rust-bakery/nom/compare/0.3.8...0.3.9)
1590 * [0.3.8](https://github.com/rust-bakery/nom/compare/0.3.7...0.3.8)
1591 * [0.3.7](https://github.com/rust-bakery/nom/compare/0.3.6...0.3.7)
1592 * [0.3.6](https://github.com/rust-bakery/nom/compare/0.3.5...0.3.6)
1593 * [0.3.5](https://github.com/rust-bakery/nom/compare/0.3.4...0.3.5)
1594 * [0.3.4](https://github.com/rust-bakery/nom/compare/0.3.3...0.3.4)
1595 * [0.3.3](https://github.com/rust-bakery/nom/compare/0.3.2...0.3.3)
1596 * [0.3.2](https://github.com/rust-bakery/nom/compare/0.3.1...0.3.2)
1597 * [0.3.1](https://github.com/rust-bakery/nom/compare/0.3.0...0.3.1)
1598 * [0.3.0](https://github.com/rust-bakery/nom/compare/0.2.2...0.3.0)
1599 * [0.2.2](https://github.com/rust-bakery/nom/compare/0.2.1...0.2.2)
1600 * [0.2.1](https://github.com/rust-bakery/nom/compare/0.2.0...0.2.1)
1601 * [0.2.0](https://github.com/rust-bakery/nom/compare/0.1.6...0.2.0)
1602 * [0.1.6](https://github.com/rust-bakery/nom/compare/0.1.5...0.1.6)
1603 * [0.1.5](https://github.com/rust-bakery/nom/compare/0.1.4...0.1.5)
1604 * [0.1.4](https://github.com/rust-bakery/nom/compare/0.1.3...0.1.4)
1605 * [0.1.3](https://github.com/rust-bakery/nom/compare/0.1.2...0.1.3)
1606 * [0.1.2](https://github.com/rust-bakery/nom/compare/0.1.1...0.1.2)
1607 * [0.1.1](https://github.com/rust-bakery/nom/compare/0.1.0...0.1.1)