Commit Graph

2625 Commits

Author SHA1 Message Date
Geoffroy Couprie
660ce62a78 the into! combinator should also convert the error type
Since we cannot implement `From` on `nom::Err` because of conflicting
implementations, we will have an `into` combinator to make it easier to
convert between error types
2020-10-31 16:38:11 +01:00
W. Brian Gourlie
1ddc3959f8 Fix BitVec take_split impl 2020-10-31 15:31:59 +01:00
Constantin Nickel
90100d9317 Add GitHub Actions workflow for CI 2020-10-31 15:28:27 +01:00
Andreas Molzer
0a6f4d59af Enable Display impl of Err on no-std configuration 2020-10-30 09:45:29 +01:00
Hanif Ariffin
da6d9a1368 Update PR template to be a comment.
Removes the need to delete them.
2020-10-26 10:47:57 +01:00
Hanif Ariffin
daa506bb7f Add another example to character::complete::char
I had to check the implementation to know this was the case.
2020-10-26 10:47:32 +01:00
Geoffroy Couprie
03291ef6a6 fix markdown docs inclusion 2020-10-26 09:41:29 +01:00
Geoffroy Couprie
fbccf2762f v6.0.0-beta3 2020-10-25 17:02:50 +01:00
Eric Seppanen
826a65ba43 Allow empty elements in separated_list
There's no particular reason why empty elements shouldn't be allowed in
the separated_list[0|1] macros and functions. It's useful to be able to
parse things like CSV ",,,foo".

An empty separator is still not allowed.

This change includes test coverage of both cases.
2020-10-25 16:57:29 +01:00
Geoffroy Couprie
6168f7b7e1 use fold_many0c in the fold_many0 macro 2020-10-25 16:52:40 +01:00
José Duarte
b7e201fe84 Add a is_newline function
The function is present in nom::character and tests if a byte is equal
to "\n".
2020-10-25 16:33:07 +01:00
Geoffroy Couprie
e799e76c7e rename the dbg! macro to avoid conficts with std::dbg! 2020-10-25 16:26:55 +01:00
Geoffroy Couprie
f97587997d URI parser 2020-10-24 18:23:10 +02:00
Geoffroy Couprie
1baaa7c6de support native endianness in number parsers 2020-10-24 16:22:34 +02:00
Geoffroy Couprie
b52d460276 fmt 2020-10-24 15:19:14 +02:00
Geoffroy Couprie
4d7869b0e8 fix clippy warnings 2020-10-24 14:16:23 +02:00
Geoffroy Couprie
e0fe4775d3 fix broken link 2020-10-24 12:21:12 +02:00
Geoffroy Couprie
6c93eeaca1 mention the limit in number of parsers for alt 2020-10-24 12:04:28 +02:00
Geoffroy Couprie
2ff49f38e0 v6.0.0-beta2 2020-10-24 11:51:56 +02:00
Geoffroy Couprie
6dec9fec9c add matroska parser 2020-10-24 11:50:08 +02:00
Geoffroy Couprie
57e78e7ff9 display example parsers as one line 2020-10-24 11:42:59 +02:00
Geoffroy Couprie
2e58a2cc2c add SIP to the list of examples 2020-10-24 11:36:44 +02:00
Olivier
8688637631 Remove weird Pi char. 2020-10-24 11:29:01 +02:00
Olivier
a6f9f23b0f Remove duplicated words. 2020-10-24 11:29:01 +02:00
Geoffroy Couprie
56ed527658 fix compilation when not building docs 2020-10-17 17:10:36 +02:00
Geoffroy Couprie
b37013912a include the nom recipes document as a module 2020-10-17 16:52:03 +02:00
Geoffroy Couprie
032a097ecf document which cargo features are required for some combinators 2020-10-17 16:42:46 +02:00
Geoffroy Couprie
1dcf816ed5 v6.0.0-beta1 2020-10-17 16:03:58 +02:00
Geoffroy Couprie
8a4efe51e3 the regexp_macros is not used anymore
fix the issues related unit tests that were not compiled anymore
2020-10-11 16:12:42 +02:00
Geoffroy Couprie
8098465542 FromStr example 2020-10-11 16:12:42 +02:00
FallenWarrior2k
fcc169195c Make JSON test/bench handle surrogates
This correctly decodes Unicode escapes which resolve to surrogates into
the corresponding character instead of just failing when hitting a
surrogate.
2020-10-11 16:06:08 +02:00
FallenWarrior2k
075cba80d3 Fix UB in JSON test/bench
Use safe version of turning u32 into char because the input might
contain surrogates.
This only fixes a symptom and not the underlying issue that surrogates
are not handled at the moment.
2020-10-11 16:06:08 +02:00
Jamey Sharp
6c643a3932 Correct Incomplete errors from length_data/value
If they didn't have enough input data, these two functions were
returning a `Needed` value reflecting the entire expected length, not
the length remaining after the available input.

As a result, a caller that blocks until the specified number of bytes
are available could get stuck waiting forever.

I've fixed the affected tests at the same time as fixing this bug. For
most of them I made sure the tests would detect this error. But for
`tests/overflow.rs`, I deleted the partial input after the length
instead (meaning the tests pass either way), because I don't think it
matters for the purposes of checking if the parsers have an unsigned
overflow.
2020-10-11 12:01:43 +02:00
Jamey Sharp
03bd957db6 Numbers that are ToUsize needn't be Copy
Because they're just converted to usize, and that is Copy.
2020-10-11 12:01:43 +02:00
Jamey Sharp
44dc361705 bytes::streaming::tag incomplete-match doctests
These tests demonstrate that for inputs that are shorter than the tag,
this parser reports failure as soon as possible.
2020-10-11 12:01:43 +02:00
Tony Finch
8717d521ff Clarify description of take_until
It consumes input until the first occurrence of the tag, not the
longest possible input until the last occurrence of the tag.
2020-10-11 11:54:06 +02:00
Jan Ruzicka
24f4b27734
Make map, map_res and map_opt accept FnMut instead of Fn (#1202)
* Make `map`, `map_res` and `map_opt` accept FnMut
2020-10-11 11:53:14 +02:00
Geoffroy Couprie
7d2addcd23 remove the deprecation notice on be_u8, be_i8, le_u8, le_i8
even if they do not make sense (there's no endianness to care for on a
single byte), importing the new functions is annoying (`use
nom::number::comlete::u8` conflicting, etc), and it will be consistent
with other byte sizes
2020-10-07 16:36:18 +02:00
Geoffroy Couprie
e7799fc195 switch to cargo-tarpaulin 2020-10-07 16:13:04 +02:00
Geoffroy Couprie
bcd337ef58 some regex parsers require the alloc feature 2020-10-07 15:58:34 +02:00
Geoffroy Couprie
a34ee445cd cargo-travis 0.0.10 and 0.0.11 do not build currently 2020-10-07 15:41:32 +02:00
Geoffroy Couprie
120c36e9f2 raise the minimum supported version
Bitvec works from Rust 1.44.0
2020-10-07 15:29:18 +02:00
Chip Senkbeil
3e19239def Add vimwiki parser and associated macro library 2020-10-07 14:48:11 +02:00
Geoffroy Couprie
eb0ccc9385 v6.0.0-alpha3 2020-10-04 18:13:56 +02:00
Geoffroy Couprie
c22d049bcd bitvec 0.19.3 has the offset functions now 2020-10-04 18:10:03 +02:00
Geoffroy Couprie
63f90d6968 make number parser with endianness generic over the input type 2020-09-27 18:26:42 +02:00
Geoffroy Couprie
3418541a30 streaming version of number parsers with configurable endianness 2020-09-27 17:04:47 +02:00
Geoffroy Couprie
c806cc85fa point to a bitvec branch for now
the currently published crate is missing the offset functions on
BitSlice
2020-09-27 16:15:31 +02:00
myrrlyn
5b427b2268 Add bitvec and implement support for it
The trait implementations permit `bitvec` types to be used directly
within the `bytes` parsers, as demonstrated by the `tests/bitstream`
module using `bytes::tag` to process a bitstream.

This unification allows the removal of the `bits` module in favor of
ordinary combinators written to be generic over a consumable input
type.
2020-09-26 14:51:00 +02:00
Geoffroy Couprie
f4e11bcf23 v6.0.0-alpha2 2020-09-26 14:48:52 +02:00