Commit Graph

2625 Commits

Author SHA1 Message Date
Geoffroy Couprie
2099a75d9f length_count requires the alloc feature 2020-08-30 15:22:14 +02:00
Geoffroy Couprie
015cc77560 fix doc tests for length_count 2020-08-30 15:20:11 +02:00
Geoffroy Couprie
ab9c7ff197 add link to a MySQL binary log format parser 2020-08-30 15:12:43 +02:00
Owen Anderson
21d1dffc75 Add a function version of length_count. 2020-08-30 15:08:47 +02:00
Nia Calia-Bogan
48c5a7cc3f
consumed (previously with_input) parser combinator (#1146)
* consumed parser

* Update

Add test and modify choosing a combinator
2020-08-30 15:05:38 +02:00
Geoffroy Couprie
4a30ddc88d Err::to_owned should be usable with the alloc feature 2020-08-30 14:56:27 +02:00
Geoffroy Couprie
b037e9c0b9 fix no_std and alloc compilation 2020-08-30 14:50:58 +02:00
Shea Newton
ea701873b6
eof function (#1112)
The changes in this PR set out to address issue #1061, and add a function
alternative to the `eof!` macro as well as its tests.
2020-08-30 14:31:31 +02:00
Geoffroy Couprie
11571df573 update the docs on char 2020-08-30 14:20:30 +02:00
Geoffroy Couprie
3dcddc9cc1 Fix Incomplete behaviour in character::streaming::char
we know the length of the expected char and of the input data, so we
know how many more bytes we need
2020-08-30 14:20:16 +02:00
Geoffroy Couprie
5108ed18d5 add the satisfy combinator, that checks a predicate on the next char 2020-08-30 14:16:12 +02:00
Geoffroy Couprie
b2ed755e27 convert_error should accept a type that derefs to &str
this will allow other input types like nom_locate
2020-08-30 11:26:36 +02:00
Tianyi Shi
42248ee1b5 Add PDB parser to README.md
I have just started making a parser for PDB (protein data bank format) files.
2020-08-30 11:05:15 +02:00
Geoffroy Couprie
af7d8feda4 Introduce the FromExternalError trait for map_res and verify
*breaking change*

this trait allows a custom error type to integrate errors from functions
like `FromStr::from_str`.
This is a breaking change because it modifies the API of `map_res` to
require this trait
2020-08-30 11:02:17 +02:00
Geoffroy Couprie
bf83d5d978 basic std::error::Error implementations for Error and VerboseError 2020-08-24 14:51:03 +02:00
Geoffroy Couprie
981d036ca8 replace the basic error tuple with a struct
this will allow implementing traits on the error type
2020-08-24 11:35:14 +02:00
Geoffroy Couprie
c5e0dc225d clean up the Incomplete behaviour
*breaking change*

At the beginnng, Needed was supposed to indicate the total number of
bytes needed in the input buffer, and this resulted in complicated
calculations as the parser result bubbled up through previous parsers.

This was changed to indicate only how many additional bytes were needed,
but most of th parsers did not really implement it properly, so this
commit fixes it.
Note: in some cases, like take(&str), where a char can span a varying number
of bytes, we cannot know in advance how many bytes are needed.
For take_until, we could detect that the last few bytes are a prefix of
the tag we are looking for, and indicate how many we need like for
`tag`, but I am not convinced yet that it is worth the effort (and
there's no guarantee that the prefix will be followed by the bytes we
want)
2020-08-23 18:54:32 +02:00
Tianyi Shi
e458dea6b3 New parser using nom to be shown in README.md
I've implemented a [FASTA parser](https://github.com/TianyiShi2001/nom-fasta) using nom.
2020-08-23 17:17:31 +02:00
Caleb Sander
3a61f2453f Simplify branching parsers 2020-08-23 17:11:14 +02:00
Caleb Sander
4d5e2484c2 Simplify and optimize trait implementations 2020-08-23 16:48:09 +02:00
Geoffroy Couprie
12c0e922ed
remove Mozilla IRC mentions 2020-08-23 11:52:17 +02:00
Geoffroy Couprie
9a555fe646 add the finish() method to clean up a parser's result 2020-08-22 15:34:02 +02:00
Geoffroy Couprie
7f928d0931 adapt the into combinator to current architecture 2020-08-22 15:22:46 +02:00
Geoffroy Couprie
b17c6e4f46 fix number tests 2020-08-22 15:22:38 +02:00
George Claghorn
23ee8ded4f
Add into combinator (#1087)
Co-authored-by: Geoffroy Couprie <contact@geoffroycouprie.com>
2020-08-22 15:11:22 +02:00
Benjamin Kay
3f81e240e2
non-macro versions of u32!, etc (#1104)
* Added non-macro alternatives to u32\!, etc

* Deprecate redundant endian swapping functions for 1 byte numbers

* Fixed typo in comment

Co-authored-by: Geoffroy Couprie <contact@geoffroycouprie.com>
2020-08-22 15:07:20 +02:00
Robert Jacobson
c79acf95ad Add a "recipes" section to the docs (issue #1169). 2020-08-22 14:52:45 +02:00
Ahmed Charles
9060f4b053
Remove Extend requirement on ExtendInto::Extender. (#1139)
Co-authored-by: Geoffroy Couprie <contact@geoffroycouprie.com>
2020-08-22 14:34:33 +02:00
Caleb Sander
13e047e085 Make benchmarks compile again
Also implemented the full JSON specification
2020-08-22 12:32:13 +02:00
Joe Thornber
a99bcfa8f5 Use Vec::with_capacity() in multi::count.
We know how many entries are expected so we can avoid many
reallocations.

I'm parsing btree nodes from disk and typically have to parse arrays
of ~150-250 u64s.  This changes reduces the run time from 41 seconds to
36 seconds.
2020-08-22 12:25:52 +02:00
Caleb Sander
c295a20508 Remove unnecessary requirements on success() 2020-08-22 12:20:26 +02:00
James Harrison
9fce925840
Add OTDR file parser to README (#1168)
Co-authored-by: Geoffroy Couprie <contact@geoffroycouprie.com>
2020-08-22 12:17:16 +02:00
Colin Woodbury
f7a28aecc0 Mention versions in README 2020-08-22 12:12:21 +02:00
Sarfaraz Nawaz
1c34db7438 Fix typo in CHANGELOG.md
5.0.1 was released on 22 Aug 2019: c326e077b8
2020-07-04 19:01:32 +02:00
Pierre Chifflier
47fdc2dd94 Add README.md to included files 2020-06-12 11:20:45 +02:00
Ivan Veselov
dbaa2e5ec5 Add success combinator returning the given value without consuming 2020-05-30 12:14:20 +02:00
Matthew Stadelman
60fce4c850 Add ANT FIT parser to README 2020-05-30 12:05:37 +02:00
Bastien Orivel
74bdbed6f9 Fix a few typos in the documentation 2020-05-30 12:06:40 +02:00
Guillaume Gomez
28fb84634d Replace "cfg(test)" with "cfg(doctest)" for readme testing 2020-05-30 11:56:06 +02:00
Antoine Cezar
e766634631
Add custom errors example (#1151)
* Add example of custom error

* Add custom_errors.rs link to documentation
2020-05-30 11:55:38 +02:00
nnt
4a95dfa532
Fixing a lot of minor issues & inconsistencies in the documentation (#1143) 2020-05-30 11:53:44 +02:00
Jay Oster
974233f2e8
Fix docs for IResult (#1148)
* Fix docs for IResult

First time looking at `nom`, and I noticed the default type for `E` is incorrectly documented. I also tried to increase readability by removing redundant commas.

* Add crate path to disambiguate

* Fix default error type in top-level docs
2020-05-30 11:39:39 +02:00
Geoffroy Couprie
b889d7c7e1 v6.0.0-alpha1 2020-04-10 18:51:18 +02:00
Geoffroy Couprie
20a3bb9e1c remove warnings 2020-04-10 16:35:03 +02:00
Geoffroy Couprie
dfc69e59b2 remove the deprecated whitespace module 2020-04-10 16:31:05 +02:00
Geoffroy Couprie
a1c5409a43 remove the deprecated methods module 2020-04-10 16:28:58 +02:00
Geoffroy Couprie
278b61abfc remove warning 2020-04-10 16:27:45 +02:00
Geoffroy Couprie
42cd421cc9 the fnmut test requires the alloc feature 2020-04-10 16:24:29 +02:00
Geoffroy Couprie
432559c917 add a test for FnMut 2020-04-10 16:17:54 +02:00
Geoffroy Couprie
5475677823 test FnMut usage 2020-04-10 16:01:53 +02:00