commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
706611f3c5d2a4b656f8ceee4dded036dfd305bf | Markus Westerlind | 2017-09-11T20:50:26 | Split custom errors into ParsingError and StreamingError
Essentially, ParsingError may have multiple causes while StreamingError is just a single cause (and returned by the stream) | diff --git a/examples/date.rs b/examples/date.rs
index cce6089..bc9857a 100644
--- a/examples/date.rs
+++ b/examples/date.rs
@@ -197,7 +197,7 @@ where
let mut text = String::new();
read.read_to_string(&mut text)?;
date_time()
- .parse(State::new(&*text))
+ .simple_parse(State::new(&*text))
... | 6 | 225 | 71 |
a6379120beddadcb8f7a3250989a6ed9f40ad4f9 | Markus Westerlind | 2017-09-10T15:29:03 | Start refactoring for no_std support | diff --git a/src/byte.rs b/src/byte.rs
index 712bc90..2e29c3b 100644
--- a/src/byte.rs
+++ b/src/byte.rs
@@ -5,8 +5,7 @@ use std::marker::PhantomData;
use self::ascii::AsciiChar;
use combinator::{satisfy, skip_many, token, tokens, Expected, Satisfy, SkipMany, Token, With};
-use primitives::{ConsumedResult, Parser, ... | 6 | 181 | 166 |
ff8686d7771e50b7270a66f94ed29303b7f734db | Markus Westerlind | 2017-09-10T15:05:12 | Fixup compile errors | diff --git a/examples/date.rs b/examples/date.rs
index b9eca1e..cce6089 100644
--- a/examples/date.rs
+++ b/examples/date.rs
@@ -10,7 +10,7 @@ use std::fs::File;
use std::io::{self, Read};
use combine::char::{char, digit};
-use combine::{choice, many, optional, parser, ParseResult, Parser, ParsingError, Stream};
+u... | 5 | 38 | 16 |
75e9de1fcca9e60848ff8c2d07cbaac122e0b8e4 | Markus | 2017-08-04T16:20:36 | chore: Add benchmarks for parsers with cheap errors
```
running 3 tests
test http_requests_large ... bench: 655,890 ns/iter (+/- 57,711)
test http_requests_large_cheap_error ... bench: 525,276 ns/iter (+/- 70,809)
test http_requests_small ... bench: 129,677 ns/iter (+/- 8,843)
``` | diff --git a/benches/http.rs b/benches/http.rs
index b5ffe86..d0681fc 100644
--- a/benches/http.rs
+++ b/benches/http.rs
@@ -4,8 +4,10 @@ extern crate combine;
use bencher::{black_box, Bencher};
+use std::fmt;
+
use combine::*;
-use combine::primitives::Error;
+use combine::primitives::{RangeStream, SimpleStream}... | 3 | 118 | 30 |
61469f0a2db899a1144d0335dd47b9bb8d3105f2 | Markus Westerlind | 2017-10-11T18:11:14 | feat: Re-export the type generated by parser! if it is public
BREAKING CHANGE | diff --git a/src/char.rs b/src/char.rs
index fefc5ed..776044d 100644
--- a/src/char.rs
+++ b/src/char.rs
@@ -18,7 +18,6 @@ where
token(c)
}
-pub use self::digit::Digit;
parser!{
#[derive(Copy, Clone)]
pub struct Digit;
diff --git a/src/combinator.rs b/src/combinator.rs
index 04bd765..fadfebb 100644
-... | 4 | 13 | 4 |
e60395d683faf52be772d222f28a5d38aec05f5c | Taylor Cramer | 2017-08-18T08:05:38 | Implement Copy for more types | diff --git a/src/byte.rs b/src/byte.rs
index f88881e..200354e 100644
--- a/src/byte.rs
+++ b/src/byte.rs
@@ -263,7 +263,7 @@ where
byte_parser!(hex_digit, HexDigit, is_hex)
}
-#[derive(Clone)]
+#[derive(Copy, Clone)]
pub struct Bytes<I>(&'static [u8], PhantomData<I>)
where
I: Stream<Item = u8>;
@@ -312,7... | 4 | 40 | 40 |
a5df829fa635e95653e411bc1e3d7918b7b34e48 | Markus Westerlind | 2017-08-13T19:09:51 | chore: version 3.0.0-alpha.2 | diff --git a/Cargo.toml b/Cargo.toml
index b5ab0b8..6d50612 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "combine"
-version = "3.0.0-alpha.1"
+version = "3.0.0-alpha.2"
authors = ["Markus Westerlind <marwes91@gmail.com>"]
description = "Fast parser combinators on arbitrary streams w... | 1 | 1 | 1 |
fc4505eb1f05fcfa54830782e1ae187a2d15f096 | Markus | 2017-08-13T07:35:58 | fix: sep_end_by1 should not be able to skip parsing elements
Fixes #119 | diff --git a/src/combinator.rs b/src/combinator.rs
index 040fde2..9bbba36 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1591,12 +1591,10 @@ where
input.combine_consumed(|input| {
let rest = (&mut self.separator).with(optional(&mut self.parser));
let mut iter = Iter::new(r... | 1 | 8 | 4 |
d6badf44541b8e42afc1a79eede61492a28d3fcb | Markus | 2017-08-11T17:22:02 | fix: not_followed_by now does not consume any input
The `not_followed_by` doc says that it never consumes any input,
however it does if parser succeeds.
The implementation was missing a `try` before which made the parser preserve the `Consumed` status if `P` consumed input before failing. This is because `try` only m... | diff --git a/src/combinator.rs b/src/combinator.rs
index 4b71d73..040fde2 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1069,10 +1069,9 @@ where
Value(v, PhantomData)
}
-impl_parser! { NotFollowedBy(P,),
- Then<LookAhead<P>, fn(P::Output) -> Unexpected<P::Input>>
-}
-
+parser!{
+#[der... | 1 | 14 | 11 |
75173ab948c66774b1abdf213d1677675ad0bb0c | Andronik Ordian | 2017-08-11T10:43:32 | fix: not_followed_by now does not consume any input
The `not_followed_by` doc says that it never consumes any input,
however it does if parser succeeds. | diff --git a/src/combinator.rs b/src/combinator.rs
index 1363c82..4b71d73 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1070,7 +1070,7 @@ where
}
impl_parser! { NotFollowedBy(P,),
- Or<Then<Try<P>, fn(P::Output) -> Unexpected<P::Input>>, Value<P::Input, ()>>
+ Then<LookAhead... | 1 | 10 | 2 |
d3716becbf0ccb4d331f8713f8b68a2189792abb | Andronik Ordian | 2017-08-08T11:23:56 | apply review suggestions | diff --git a/src/range.rs b/src/range.rs
index 8e1174e..fa350e4 100644
--- a/src/range.rs
+++ b/src/range.rs
@@ -41,8 +41,7 @@ pub type Recognize<P> = recognize::Recognize<P>;
parser!{
#[derive(Clone)]
pub struct Recognize;
- /// Zero-copy parser which reads a range of length `i.len()` and succeds if `i` ... | 1 | 5 | 2 |
09facf398aef20aa8f18a0bd09a94fa156e99902 | Andronik Ordian | 2017-08-08T09:12:39 | feat: add new range parser, returning (range, value) | diff --git a/src/range.rs b/src/range.rs
index 33e206f..8e1174e 100644
--- a/src/range.rs
+++ b/src/range.rs
@@ -37,48 +37,82 @@ where
}
}
-pub struct Recognize<P>(P);
+pub type Recognize<P> = recognize::Recognize<P>;
+parser!{
+ #[derive(Clone)]
+ pub struct Recognize;
+ /// Zero-copy parser which rea... | 1 | 47 | 13 |
57b58c94652e1fc0a811ef3fc9388e701879ba09 | Markus | 2017-08-06T18:30:23 | refactor: Rename range_of to recognize
This collides with the equivalent function in `combinator` but it can
trivial be renamed using `recognize as recognize_range` if that is a
problem. | diff --git a/src/range.rs b/src/range.rs
index b166526..33e206f 100644
--- a/src/range.rs
+++ b/src/range.rs
@@ -37,9 +37,9 @@ where
}
}
-pub struct RangeOf<P>(P);
+pub struct Recognize<P>(P);
-impl<P> Parser for RangeOf<P>
+impl<P> Parser for Recognize<P>
where
P: Parser,
P::Input: RangeStream,
@@... | 1 | 6 | 6 |
357e162ca2c673de7fe7a2fb5226fe9ca9d47660 | Markus | 2017-08-06T08:54:29 | refactor: Rename TrackedError to Tracked | diff --git a/src/combinator.rs b/src/combinator.rs
index ac69704..3dc7d6c 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -618,6 +618,7 @@ where
type Input = P::Input;
type Output = P::Output;
+ #[inline(always)]
fn parse_choice(&mut self, input: Self::Input) -> ConsumedResult<Self::Output... | 1 | 5 | 2 |
81cffe7d1a141c010345d11039123c384c86ca6b | Markus | 2017-07-31T21:21:20 | Test implementing choice by specializing with macros instead of forwarding to or
Fixes an issue with deeply nested types | diff --git a/src/combinator.rs b/src/combinator.rs
index d30b72c..ac69704 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -626,6 +626,45 @@ where
}
}
+macro_rules! merge {
+ ($head: ident) => {
+ $head.error
+ };
+ ($head: ident $($tail: ident)+) => {
+ $head.error.merge(merge!(... | 1 | 51 | 40 |
3cb29bc293a94ac21ce73272af806f45bc83375b | Markus | 2017-08-04T15:25:30 | fix compilation of json.rs | diff --git a/benches/json.rs b/benches/json.rs
index 832838f..8c41a9f 100644
--- a/benches/json.rs
+++ b/benches/json.rs
@@ -12,9 +12,9 @@ use bencher::{black_box, Bencher};
use pc::primitives::{BufferedStream, Consumed, IteratorStream, ParseError, ParseResult, Parser,
Stream};
+use pc::char::{... | 1 | 1 | 1 |
3fbcad40c84cf87a98a2c64544823598a274e662 | Markus | 2017-08-04T13:30:28 | Handle EmptyOk -> EmptyErr when composing sequencing and alternating parsers
This is a tricky fix. Essentially, anytime errors are merged we lost the offset information which is used to add the correct errors after a sequencing parser has failed | diff --git a/src/combinator.rs b/src/combinator.rs
index af41714..d30b72c 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -716,33 +716,67 @@ where
type Output = O;
#[inline]
fn parse_choice(&mut self, input: I) -> ConsumedResult<O, I> {
- let mut empty_err = None;
- for p in self ... | 4 | 144 | 24 |
9107342a89a5efc664bac9c2919a93a992ca6809 | Markus | 2017-08-02T18:24:13 | fix: Remove depreceated items
BREAKING CHANGE
Use the recommended alternatives that has been suggested since they were
depreceated (2.4.0 have all the warnings with the alternatives) | diff --git a/src/lib.rs b/src/lib.rs
index 249c27d..fb3c944 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -166,12 +166,6 @@ pub use primitives::{ConsumedResult, ParseError, ParseResult, Parser, Positioned
#[doc(inline)]
pub use state::State;
-// import this one separately, so we can set the allow(deprecated) for just... | 3 | 8 | 62 |
626011bda752c37ae368d96d5ef179bb5d3b2b0a | Markus | 2017-08-02T15:59:19 | docs: Explain TrackedError a bit | diff --git a/benches/json.rs b/benches/json.rs
index 8b9f89f..832838f 100644
--- a/benches/json.rs
+++ b/benches/json.rs
@@ -120,10 +120,9 @@ where
});
match c {
'\\' => input.combine(|input| back_slash_char.parse_stream(input)),
- '"' => Err(Consumed::Empty(ParseError::from_er... | 9 | 170 | 136 |
4d6ff992507da31b1c79954dbe83c2925191bb60 | Markus | 2017-07-26T07:14:00 | Remove the frunk dependency | diff --git a/Cargo.toml b/Cargo.toml
index 19bd88d..e359273 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -25,7 +25,6 @@ path = "src/lib.rs"
ascii = "0.7.0"
byteorder = "1.1.0"
regex = { version = "0.2.0", optional = true }
-frunk = "0.1.30"
[dev-dependencies]
bencher = "0.1.3"
diff --git a/src/combinator.rs b/src... | 3 | 29 | 123 |
7e27c523da46828b254ee4fc7c1f9750623e5aff | Markus | 2017-07-25T21:41:08 | fix: Don't forward tuple parsers to frunk to prevent a performance loss
~10% when using hlists | diff --git a/src/combinator.rs b/src/combinator.rs
index 3be8382..f60ec91 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -2424,18 +2424,15 @@ macro_rules! hlist {
hlist!($first)
};
// Forwarding of trailing comma variants -->
-
}
-macro_rules! hlist_pat {
- {} => { _ };
- { $head:... | 1 | 71 | 14 |
54fecc62938445aae15373a6b1ec7c4419582025 | Markus Westerlind | 2017-07-22T11:53:50 | fix: Add the correct errors after sequencing has returned EmptyOk
Fixes #95 | diff --git a/Cargo.toml b/Cargo.toml
index ae35229..19bd88d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -25,6 +25,7 @@ path = "src/lib.rs"
ascii = "0.7.0"
byteorder = "1.1.0"
regex = { version = "0.2.0", optional = true }
+frunk = "0.1.30"
[dev-dependencies]
bencher = "0.1.3"
@@ -49,4 +50,4 @@ harness = false
r... | 6 | 263 | 159 |
3add407eecf886cc72ce05414d58a2b3b19a0bb9 | Markus | 2017-08-01T06:59:06 | fix: Renamed SharedBufferedStream and BufferedStream to be less confusing
This makes it so that `BufferedStream::new` actually returns a `BufferedStream` value.
BREAKING CHANGE
Renamed used of `SharedBufferedStream` to `BufferedStream` and `BufferedStream` to `BufferedStreamRef`. Calls to `BufferedStream::new` do no... | diff --git a/src/primitives.rs b/src/primitives.rs
index a6e431c..2da22fa 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -991,7 +991,7 @@ where
/// Converts an `Iterator` into a stream.
///
/// NOTE: This type do not implement `Positioned` and `Clone` and must be wrapped with types
- /// ... | 1 | 35 | 30 |
8e987d3c80d639116b2b54b2b015f79f6a9c685f | Markus | 2017-07-31T22:28:32 | refactor: Remove unused types such as BytePosition
BREAKING CHANGE | diff --git a/benches/json.rs b/benches/json.rs
index b54fb3e..38f4bcb 100644
--- a/benches/json.rs
+++ b/benches/json.rs
@@ -11,10 +11,11 @@ use std::path::Path;
use bencher::{black_box, Bencher};
use pc::primitives::{BufferedStream, Consumed, IteratorStream, ParseError, ParseResult, Parser,
- S... | 6 | 35 | 57 |
ae43f8ae2b303aca3b5ae9fbb1a87475349f2745 | Markus | 2017-07-31T22:07:26 | feat: Remove the old State type and Positioner trait
These have been superseeded by the new type and trait in the `State` module which should prove more flexible (at a slight complexity cost)
BREAKING CHANGE
Import and use the types from the state module instead. Simple uses should look identical | diff --git a/src/char.rs b/src/char.rs
index 3dc4f42..b4bbb70 100644
--- a/src/char.rs
+++ b/src/char.rs
@@ -382,7 +382,8 @@ where
#[cfg(test)]
mod tests {
use super::*;
- use primitives::{Error, ParseError, Parser, SourcePosition, State};
+ use primitives::{Error, ParseError, Parser};
+ use state::{Sou... | 6 | 143 | 264 |
4cf8cff64466519bf2d4a4dc1dcbe8deb449e004 | Markus | 2017-07-31T20:05:02 | fix: Add From<u8> for Info
Brings byte parsers closer to char parsers | diff --git a/src/primitives.rs b/src/primitives.rs
index 6638bda..0bd555f 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -159,6 +159,12 @@ impl<T, R> From<&'static str> for Info<T, R> {
}
}
+impl<R> From<u8> for Info<u8, R> {
+ fn from(s: u8) -> Info<u8, R> {
+ Info::Token(s)
+ }
+}
+
/... | 1 | 6 | 0 |
c085decb5fe95aa9719e39cf0687875179750880 | Markus | 2017-07-31T20:02:52 | Make the added positioner traits take the Item/Range by parameter
This lets us remove the type parameters on `IndexPositioner` | diff --git a/src/combinator.rs b/src/combinator.rs
index a50bc7d..edc9c87 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1,7 +1,7 @@
use std::iter::FromIterator;
use std::marker::PhantomData;
-use primitives::{Consumed, ConsumedResult, Error, Info, ParseError, ParseResult, Parser, Positioned, Stream,
- ... | 5 | 91 | 80 |
59698a4fa55b315ea7b03ad682ea1b51c69316bb | Markus | 2017-07-31T17:31:14 | Update the new State type to work with 3.0 | diff --git a/src/state.rs b/src/state.rs
index c242e64..6df8857 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -1,7 +1,6 @@
-use std::fmt;
use std::marker::PhantomData;
-use primitives::{Error, RangeStream, Stream, StreamOnce};
+use primitives::{Error, Positioned, RangeStream, Stream, StreamOnce};
/// Trait for ... | 1 | 21 | 31 |
98ed5a3f964551bc7c22e19667c5bc7c772a8362 | Nick Alexander | 2017-01-13T18:04:35 | Add {Range}Positioner and State 2.0 for parsing third-party tokens. Fixes #79.
This approach separates Positioner from the underlying Stream and from
the underlying Item and Range types. This allows to track positions
in streams where the Item type is third-party and the 1.0 Positioner
trait cannot be implemented (du... | diff --git a/src/lib.rs b/src/lib.rs
index 86ac79f..aed1a3d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -490,6 +490,8 @@ pub mod range;
pub mod byte;
/// Module containing parsers specialized on character streams.
pub mod char;
+/// Module containing stateful stream wrappers
+pub mod state;
#[cfg(feature = "regex... | 2 | 216 | 0 |
900f6a4ca0ad3f3c0a0fb15dba581dc2679f8c2c | Markus | 2017-07-31T21:22:44 | chore: Remove use of deprecated functions | diff --git a/benches/json.rs b/benches/json.rs
index a229675..b54fb3e 100644
--- a/benches/json.rs
+++ b/benches/json.rs
@@ -152,7 +152,7 @@ where
}
#[allow(unconditional_recursion)]
fn value_(input: I) -> ParseResult<Value, I> {
- let mut array = between(
+ let array = between(
... | 1 | 1 | 1 |
96da7ee0cf8a112e60747a0be8a4dbd90efbecba | Markus | 2017-07-31T21:02:47 | feat: Teach the choice parser to take tuples
This makes it possible to use `choice` to create an alternation parser where the component parsers are of different types. This was still possible before by using `or` or the `choice!` macro but by overloading `choice` we get an easy to read solution without macros
BREAKIN... | diff --git a/benches/json.rs b/benches/json.rs
index befa777..a229675 100644
--- a/benches/json.rs
+++ b/benches/json.rs
@@ -158,15 +158,15 @@ where
sep_by(Json::<I>::value(), lex(char(','))),
).map(Value::Array);
- choice::<[&mut Parser<Input = I, Output = Value>; 7], _>([
- &... | 2 | 165 | 56 |
2b96afc83553fcf01766c1ef13eac11c8d823421 | Markus | 2017-07-31T17:08:55 | refactor: Split the position out of the StreamOnce trait
The `StreamOnce` trait do not need the position to work even if many users of the trait needs it. So this way it becomes possible for wrappers such as `State` to carry types implementing `StreamOnce` but which are not `Positioned`
BREAKING CHANGE
Implementors ... | diff --git a/src/combinator.rs b/src/combinator.rs
index b5ee9e4..4498e31 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1,6 +1,6 @@
use std::iter::FromIterator;
use std::marker::PhantomData;
-use primitives::{Consumed, ConsumedResult, Error, Info, ParseError, ParseResult, Parser, Stream,
+use primitives:... | 6 | 141 | 84 |
7e69208650f7fdc75279370b193030b09ccdbc7a | Markus | 2017-07-29T15:02:13 | feat: Add the range_of parser
The `range_of` parser makes it possible to "match" on the input parsed
by a non-range parser and extract the range of input which was parsed.
This makes range parsing much more expressive with only a small cost of
an additional method on `RangeStream`
Closes #83
BREAKING CHANGE
`distan... | diff --git a/src/primitives.rs b/src/primitives.rs
index 3062ef3..245fa9e 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -740,6 +740,11 @@ where
false
})
}
+
+ #[inline]
+ fn distance(&self, end: &Self) -> usize {
+ self.input.distance(&end.input)
+ }
}
impl<I, ... | 2 | 75 | 1 |
2f92b29669b618535bcd7533b7dd39b7daa8579b | Markus Westerlind | 2017-07-24T17:30:14 | feat: Add map_token and map_range methods to ParseError
cc @ncalexan
Fixes #86 | diff --git a/benches/http.rs b/benches/http.rs
index 4c835c9..510b32e 100644
--- a/benches/http.rs
+++ b/benches/http.rs
@@ -60,7 +60,7 @@ fn is_http_version(c: u8) -> bool {
c >= b'0' && c <= b'9' || c == b'.'
}
-fn parse_http_request(input: &[u8]) -> Result<((Request, Vec<Header>), &[u8]), ParseError<&[u8]>> ... | 4 | 53 | 4 |
520da8e89f7162b4d6ba3a3bca05a05f3bd37999 | Markus Westerlind | 2017-03-25T13:05:14 | feat: Allow ParseError to be used without the StreamOnce constraint
This will make mappings over parse errors be possible as desired in #86
BREAKING CHANGE
Changes the type parameters of `ParseError` | diff --git a/src/byte.rs b/src/byte.rs
index 23998bb..d4ff4bb 100644
--- a/src/byte.rs
+++ b/src/byte.rs
@@ -4,8 +4,8 @@ use std::marker::PhantomData;
use self::ascii::AsciiChar;
-use combinator::{satisfy, skip_many, token, tokens, Expected, Satisfy, SkipMany, Token, With};
-use primitives::{ConsumedResult, Info, ... | 6 | 111 | 119 |
d1bbf1d4198cb71d9c4b9e6d13399e38078518f0 | Andronik Ordian | 2017-08-07T13:03:11 | fix(doc): regex find consumes input until the end of the first match | diff --git a/src/regex.rs b/src/regex.rs
index 17cb413..14c92d0 100644
--- a/src/regex.rs
+++ b/src/regex.rs
@@ -278,7 +278,7 @@ where
}
/// Matches `regex` on the input by running `find` on the input and returns the first match.
-/// Consumes all input up until the end of the last match.
+/// Consumes all input up... | 1 | 1 | 1 |
cfead493e072dd654e4decbb04b5b2f7fdce7e9b | Markus | 2017-08-07T09:10:45 | Add an expected message when a regex fails to parse | diff --git a/src/regex.rs b/src/regex.rs
index cd510db..17cb413 100644
--- a/src/regex.rs
+++ b/src/regex.rs
@@ -37,7 +37,7 @@ extern crate regex;
use std::iter::FromIterator;
use std::marker::PhantomData;
-use primitives::{ConsumedResult, FullRangeStream, ParseError, Parser};
+use primitives::{ConsumedResult, Erro... | 1 | 28 | 2 |
9d301e42ee2da23c90ce78982d9dbef6d7586b4c | Markus | 2017-08-07T08:10:53 | feat: Rename captures to captures_many and add a captures parser
The `captures` parser now only returns the first match | diff --git a/src/regex.rs b/src/regex.rs
index ea7982b..cd510db 100644
--- a/src/regex.rs
+++ b/src/regex.rs
@@ -41,6 +41,18 @@ use primitives::{ConsumedResult, FullRangeStream, ParseError, Parser};
use primitives::FastResult::*;
use range::take;
+struct First<T>(Option<T>);
+
+impl<A> FromIterator<A> for First<A>
... | 1 | 77 | 18 |
a833a61f905055956a723d0f8ac67f04a9ed2d13 | Markus | 2017-08-07T08:04:34 | Add the regex find parser which returns only the first match | diff --git a/src/regex.rs b/src/regex.rs
index 7b7b847..ea7982b 100644
--- a/src/regex.rs
+++ b/src/regex.rs
@@ -227,6 +227,69 @@ where
Match(regex, PhantomData)
}
+#[derive(Clone)]
+pub struct Find<R, I>(R, PhantomData<fn() -> I>);
+
+impl<'a, R, I> Parser for Find<R, I>
+where
+ R: Regex<I::Range>,
+ I:... | 1 | 63 | 0 |
7670e3610e9d2370a3a78639b9c2b4d3c2d36f8f | Markus | 2017-08-07T07:40:43 | Tell docs.rs about the regex feature | diff --git a/Cargo.toml b/Cargo.toml
index f9181cc..32f0523 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -33,6 +33,7 @@ lazy_static = "0.2.8"
[features]
# Run the mp4 benchmark, requires a mp4 file named `small.mp4` in the benches directory
mp4 = []
+doc = ["regex"]
[[bench]]
name = "json"
@@ -45,4 +46,7 @@ harne... | 1 | 5 | 1 |
c85bb46aa607ffd6a3b7ce39507b4eed73a17f60 | Markus | 2017-08-07T07:04:41 | docs: Document the regex module better | diff --git a/Cargo.toml b/Cargo.toml
index bac1950..f9181cc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -28,6 +28,7 @@ regex = { version = "0.2.0", optional = true }
[dev-dependencies]
bencher = "0.1.3"
+lazy_static = "0.2.8"
[features]
# Run the mp4 benchmark, requires a mp4 file named `small.mp4` in the bench... | 3 | 30 | 5 |
ff2bbf57606a5f63941c933d508b806f294fa742 | Markus | 2017-08-07T06:43:58 | Add a captures regex parser | diff --git a/src/regex.rs b/src/regex.rs
index 812af45..ddafe6d 100644
--- a/src/regex.rs
+++ b/src/regex.rs
@@ -1,9 +1,33 @@
+//! All regex parsers are overloaded on `&str` and `&[u8]` ranges and can take a `Regex` by value
+//! or shared reference (`&`)
+//!
+//! ```
+//! extern crate regex;
+//! extern crate combine... | 1 | 171 | 27 |
1656a620960e2b6256e724058cf39892d6e16944 | Markus | 2017-08-07T11:35:19 | feat: Add a macro to parse values directly into structs
This associates the output of a parser diretly to the struct which can make some parser easier to read | diff --git a/benches/http.rs b/benches/http.rs
index 36b2db1..4c835c9 100644
--- a/benches/http.rs
+++ b/benches/http.rs
@@ -66,19 +66,15 @@ fn parse_http_request(input: &[u8]) -> Result<((Request, Vec<Header>), &[u8]), P
let http_version = range(&b"HTTP/"[..]).with(take_while1(is_http_version));
- let requ... | 2 | 128 | 13 |
8f3413a7431f4459d67695156f0b259df422bf09 | Andronik Ordian | 2017-08-07T09:20:14 | feat: add count_min_max and skip_count_min_max | diff --git a/src/combinator.rs b/src/combinator.rs
index 5bbe16e..35588bd 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -624,6 +624,107 @@ parser!{
}
}
+#[derive(Clone)]
+pub struct CountMinMax<F, P> {
+ parser: P,
+ min: usize,
+ max: usize,
+ _marker: PhantomData<fn() -> F>,
+}
+
+impl... | 2 | 106 | 4 |
15171d10495a5a221713ca0f67f3afc0b0eaf580 | Markus | 2017-08-07T07:33:08 | feat: Add the skip_count parser | diff --git a/src/combinator.rs b/src/combinator.rs
index 911373a..5bbe16e 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -598,6 +598,32 @@ where
}
}
+pub type SkipCount<P> = skip_count::SkipCount<P>;
+parser!{
+ #[derive(Clone)]
+ pub struct SkipCount;
+ /// Parses `parser` from zero up to `... | 2 | 28 | 2 |
b71a78f12a40e90425d59f72d28c628d28aebe1d | Markus | 2017-08-07T07:24:46 | fix: Report and_then errors as if at the start of the parse | diff --git a/src/combinator.rs b/src/combinator.rs
index 080c185..911373a 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -2014,14 +2014,15 @@ where
type Output = O;
#[inline]
fn parse_lazy(&mut self, input: Self::Input) -> ConsumedResult<O, Self::Input> {
+ let position = input.position... | 2 | 9 | 5 |
95bb9510a928b93937bb4f109b5950673b45e632 | Markus | 2017-08-06T20:04:22 | chore: Add the required bounds for recognize
Should give better error messages | diff --git a/src/combinator.rs b/src/combinator.rs
index 4e8a191..080c185 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -2257,7 +2257,10 @@ where
/// assert_eq!(parser.parse("123.45"), Ok(("123.45".to_string(), "")));
/// ```
#[inline(always)]
-pub fn recognize<F, P>(parser: P) -> Recognize<F, P> where
+... | 1 | 4 | 1 |
61c9b269826707e7fa7409512f21122c9fd8f137 | Markus | 2017-08-06T18:28:48 | feat: Add the recognize parser
`recognize` can be used to recognize what a parser consumed and return the tokens accumulated into a `FromIterator`. A range based version of this is coming in 3.0 | diff --git a/src/combinator.rs b/src/combinator.rs
index e6adbb3..4e8a191 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -2193,6 +2193,75 @@ where
}
}
+#[derive(Copy, Clone)]
+pub struct Recognize<F, P>(P, PhantomData<fn() -> F>);
+
+impl<P, F> Parser for Recognize<F, P>
+where
+ P: Parser,
+ F... | 1 | 69 | 0 |
ca2e93fb833bb8942f3d3a2364eef601ae086aff | Markus | 2017-08-06T17:36:48 | chore: Remove depreceation warnings | diff --git a/benches/json.rs b/benches/json.rs
index de01e28..befa777 100644
--- a/benches/json.rs
+++ b/benches/json.rs
@@ -10,11 +10,11 @@ use std::path::Path;
use bencher::{black_box, Bencher};
-use pc::primitives::{BufferedStream, Consumed, ParseError, ParseResult, Parser, State, Stream};
+use pc::primitives::... | 2 | 8 | 5 |
a74909b14fa6e591610a8d238c2d30c620f21818 | Markus | 2017-08-06T17:25:26 | Allow parsers defined using parser! to derive traits | diff --git a/src/char.rs b/src/char.rs
index 8976689..70cf6b0 100644
--- a/src/char.rs
+++ b/src/char.rs
@@ -19,8 +19,10 @@ where
token(c)
}
-pub type Digit<I> = digit::__Parser<I>;
+pub use self::digit::Digit;
parser!{
+ #[derive(Clone)]
+ pub struct Digit;
/// Parses a base-10 digit.
///
... | 3 | 86 | 38 |
187fd8a193c066af3f62f8dbfaf976f67425f45a | Markus | 2017-08-06T16:56:26 | Hide the __marker field from user code in the parser macro | diff --git a/src/lib.rs b/src/lib.rs
index ff53df9..7d4fe4e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -126,7 +126,7 @@
//! }
//!
//! fn main() {
-//! let result = parser(expr)
+//! let result = expr()
//! .parse("[[], (hello, world), [rust]]");
//! let expr = Expr::Array(vec![
//! ... | 1 | 40 | 30 |
0fb8b696f8ef0e556758d61ce1335d1b758044d2 | Markus | 2017-08-06T16:45:47 | Add pub overload for when no where clause exists | diff --git a/src/lib.rs b/src/lib.rs
index dfdd7eb..ff53df9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -259,6 +259,19 @@ macro_rules! impl_token_parser {
/// ```
#[macro_export]
macro_rules! parser {
+ (
+ $(#[$attr:meta])*
+ pub fn $name: ident [$($type_params: tt)*]( $($arg: ident : $arg_type: t... | 1 | 13 | 0 |
eef37214ed213109b8f01d02ee34dcb47b7a90c0 | Markus | 2017-08-06T16:44:06 | Requires a `fn` in parser definitions
While this is redundant it fixes some problems with syntax highlighting
in the macro | diff --git a/src/char.rs b/src/char.rs
index d14ff7c..8976689 100644
--- a/src/char.rs
+++ b/src/char.rs
@@ -29,7 +29,7 @@ parser!{
/// assert_eq!(digit().parse("9"), Ok(('9', "")));
/// assert!(digit().parse("A").is_err());
/// ```
- pub digit[I]()(I) -> char
+ pub fn digit[I]()(I) -> char
wh... | 4 | 21 | 21 |
cc6b191020ff197e92bddfb61fa87d3b20ef4969 | Markus | 2017-08-06T16:37:15 | refactor: Split out the implementation of parser!
Makes the docs look better | diff --git a/src/lib.rs b/src/lib.rs
index 271b50d..f97b436 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -259,19 +259,6 @@ macro_rules! impl_token_parser {
/// ```
#[macro_export]
macro_rules! parser {
- (
- $(#[$attr:meta])*
- pub $name: ident [$($type_params: tt)*]( $($arg: ident : $arg_type: ty),... | 1 | 46 | 55 |
c87e1b1c3a695b885860327ef70d28f0c437f68b | Markus | 2017-08-06T16:24:02 | Allow the parser! macro to take parameters | diff --git a/src/char.rs b/src/char.rs
index 2161db7..d14ff7c 100644
--- a/src/char.rs
+++ b/src/char.rs
@@ -19,7 +19,7 @@ where
token(c)
}
-pub type Digit<I> = digit::P<I>;
+pub type Digit<I> = digit::__Parser<I>;
parser!{
/// Parses a base-10 digit.
///
@@ -29,7 +29,7 @@ parser!{
/// assert_eq... | 4 | 78 | 48 |
153a9bc9c9f9b25048e6469c10273a3787246052 | Markus | 2017-08-06T15:13:40 | Document what the parser! body must contain | diff --git a/src/lib.rs b/src/lib.rs
index ae25743..9c35006 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -212,7 +212,10 @@ macro_rules! impl_token_parser {
/// integer[I](I) -> i32
/// where [I: Stream<Item = char>]
/// {
-/// many1(digit()).and_then(|s: String| s.parse())
+/// // The ... | 1 | 4 | 1 |
9b70f866f78fac2111994a0774d6682d18915708 | Markus | 2017-08-06T15:08:48 | Allow doc comments in parser! definitions | diff --git a/src/char.rs b/src/char.rs
index 55aff32..2161db7 100644
--- a/src/char.rs
+++ b/src/char.rs
@@ -2,6 +2,7 @@ use primitives::{ConsumedResult, ParseError, Parser, Stream};
use combinator::{satisfy, skip_many, token, tokens, Expected, Satisfy, SkipMany, Token, With};
use std::marker::PhantomData;
+
/// P... | 2 | 31 | 20 |
4622d0de07a316b68f9d5c4fd3ceacb58c4905ba | Markus | 2017-08-06T14:45:25 | Rewrite the parser expression macro expansion to work on stable/beta
There seems to be a fix on nightly which have yet to get to stable or beta which would allow `block` to be used for the parser body instead. | diff --git a/src/lib.rs b/src/lib.rs
index 4918ada..69040df 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -38,7 +38,7 @@
//! This library currently contains five modules:
//!
//! * [`combinator`] contains the before mentioned parser combinators and thus contains the main
-//! building blocks for creating any sort of c... | 2 | 41 | 20 |
0377c0438a47e79a7b63d3ec4a41fd78a254c4d4 | Markus | 2017-08-06T14:08:41 | Let the parser! macro define public parsers | diff --git a/src/lib.rs b/src/lib.rs
index e2ef684..4918ada 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -206,7 +206,7 @@ macro_rules! impl_token_parser {
/// #[macro_use]
/// extern crate combine;
/// use combine::char::digit;
-/// use combine::{many1, Parser, Stream};
+/// use combine::{any, choice, many1, Parser, ... | 1 | 67 | 9 |
5481b295ade4021c3caa5dbfafcafea417121c3a | Markus | 2017-08-06T13:56:13 | doc: Document the parser! macro | diff --git a/src/combinator.rs b/src/combinator.rs
index 6450851..e6adbb3 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1318,68 +1318,6 @@ impl<'a, I: Stream, O> Parser for FnMut(I) -> ParseResult<O, I> + 'a {
}
}
-#[derive(Clone)]
-pub struct LazyParser<I, F, G>(F, G, PhantomData<fn(I) -> I>);
-
-... | 2 | 24 | 63 |
c2d861eee6fdc9943cd201d44779b05f9d8cfcf0 | Markus | 2017-08-06T13:45:45 | refactor: Define a unique type with the `parser!` macro instead
This avoids a slight overhead since the returned parser do not need to carry two function pointers | diff --git a/src/lib.rs b/src/lib.rs
index 67a654e..bbf5280 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -197,6 +197,7 @@ macro_rules! impl_token_parser {
}
}
+/// Declares a named parser which can easily be reused
#[macro_export]
macro_rules! parser {
(
@@ -214,32 +215,47 @@ macro_rules! parser {
... | 3 | 45 | 27 |
7fe1d9f723a14d20c9879849e104283ee24d254e | Markus | 2017-08-06T13:19:35 | feat: Add a macro for declaring parsers
While it has a slightly weird syntax to use this to work around some ambiguity problems this should provide a defacto way to implement reusable parsers.
Fixes #70 | diff --git a/src/combinator.rs b/src/combinator.rs
index df8dd56..6450851 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1317,6 +1317,69 @@ impl<'a, I: Stream, O> Parser for FnMut(I) -> ParseResult<O, I> + 'a {
self(input)
}
}
+
+#[derive(Clone)]
+pub struct LazyParser<I, F, G>(F, G, PhantomD... | 4 | 251 | 141 |
087a671c0f69108f0657ad3c183f86b0904b1d1c | Daan Sprenkels | 2017-08-05T15:06:32 | docs: Fix some broken links | diff --git a/src/primitives.rs b/src/primitives.rs
index f485e87..46ae174 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -1350,7 +1350,7 @@ pub trait Parser {
/// Returns the parsed result and the remaining input if the parser succeeds, or a
/// [`ParseError`] otherwise.
///
- /// [`ParseEr... | 1 | 4 | 4 |
05ec0bc8675a2de0a71268a458ceefa7ee99f7a0 | Markus | 2017-08-04T08:12:05 | feat: Provide parsers for decoding big-endian and little-endian numbers
These parsers can be found under `byte::num` and only work on parser
which supply a `&[u8]` as the `Range | diff --git a/Cargo.toml b/Cargo.toml
index ac06914..dd40063 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,9 +23,9 @@ path = "src/lib.rs"
[dependencies]
ascii = "0.7.0"
+byteorder = "1.1.0"
[dev-dependencies]
-byteorder = "0.5.3"
bencher = "0.1.3"
[features]
diff --git a/benches/http.rs b/benches/http.rs
in... | 6 | 185 | 7 |
6a56441b8b9d438a3617ee13e1146adc6050aa20 | Markus | 2017-07-31T20:29:13 | style: Run rustfmt | diff --git a/benches/http.rs b/benches/http.rs
index fa0bcc2..2aaa7af 100644
--- a/benches/http.rs
+++ b/benches/http.rs
@@ -4,7 +4,7 @@ extern crate combine;
use combine::*;
use combine::primitives::Error;
-use combine::range::{take_while1, range};
+use combine::range::{range, take_while1};
#[derive(Debug)]
st... | 11 | 115 | 149 |
e4da997190773e4511f640c81b38f3aabfb5ac5b | Markus Westerlind | 2017-07-23T16:18:52 | docs: Document all the char and byte functions | diff --git a/src/byte.rs b/src/byte.rs
index 14e83e2..addc99d 100644
--- a/src/byte.rs
+++ b/src/byte.rs
@@ -7,18 +7,14 @@ use self::ascii::AsciiChar;
use combinator::{Expected, satisfy, Satisfy, skip_many, SkipMany, token, Token, tokens, With};
use primitives::{ConsumedResult, Info, Parser, ParseError, Stream};
-/... | 3 | 209 | 30 |
2bb03f49e59ec89b1e888da4a46dc0290660f4e3 | Johannes Schilling | 2017-07-10T20:04:25 | move from_iter, from_read into respective impl blocks
this makes it much clearer how to construct an IteratorStream/ReadStream
and the `new` methods show up in docs for the respective structs.
increase the minor version to 4, as this adds new API. remove the
compatibility-wrappers for the old names when releasing 3.0... | diff --git a/Cargo.toml b/Cargo.toml
index be1f77b..2aa607d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "combine"
-version = "2.3.2"
+version = "2.4.0"
authors = ["Markus Westerlind <marwes91@gmail.com>"]
description = "Fast parser combinators on arbitrary streams with zero-copy su... | 4 | 62 | 28 |
93208e9c6fd92628eb02c0b32a0d6d3120a9af7f | Markus Westerlind | 2017-05-12T19:09:07 | fix: Return EmptyErr when the any parser fails
Fixes #99 | diff --git a/src/combinator.rs b/src/combinator.rs
index 6bc26c0..3aa5c10 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -45,7 +45,7 @@ impl<I> Parser for Any<I>
let position = input.position();
match input.uncons() {
Ok(x) => ConsumedOk((x, input)),
- Err(err) => Co... | 1 | 6 | 1 |
13b11a6a7bc76a3a7bdce62a1d4170c7b8b55f2a | Markus Westerlind | 2017-05-12T19:07:16 | style: Rustfmt the library | diff --git a/benches/http.rs b/benches/http.rs
index b73743a..e68ad04 100644
--- a/benches/http.rs
+++ b/benches/http.rs
@@ -42,7 +42,11 @@ fn is_http_version(c: u8) -> bool {
fn parse_http_request(input: &[u8]) -> Result<((Request, Vec<Header>), &[u8]), ParseError<&[u8]>> {
// Making a closure, because parser ... | 8 | 225 | 212 |
5f8f5bc04d6e7a10c0d23f0bf1aba73ce90ced7f | Barret Rennie | 2017-04-27T21:34:02 | Add the take_until_range parser
The `take_until_range(r)` parser parses until the range `r` is found, at
which point all input up to (but not including) `r` will be returned. If
`r` is not found, an error will be returned. | diff --git a/src/range.rs b/src/range.rs
index ffe3866..a5876d9 100644
--- a/src/range.rs
+++ b/src/range.rs
@@ -182,6 +182,74 @@ pub fn take_while1<I, F>(f: F) -> TakeWhile1<I, F>
TakeWhile1(f, PhantomData)
}
+pub struct TakeUntilRange<I>(I::Range) where I: RangeStream;
+impl<I> Parser for TakeUntilRange<I>
+ ... | 1 | 68 | 0 |
60bfe8e0392fc18994eb9bd0fe1a8536d683b981 | Markus Westerlind | 2017-04-12T06:51:29 | chore: Version 2.3.2 | diff --git a/Cargo.toml b/Cargo.toml
index ac22a50..be1f77b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "combine"
-version = "2.3.1"
+version = "2.3.2"
authors = ["Markus Westerlind <marwes91@gmail.com>"]
description = "Fast parser combinators on arbitrary streams with zero-copy su... | 1 | 1 | 1 |
bcf10819817b8b2d4af4d287d69efee54881ac54 | Markus Westerlind | 2017-04-12T06:51:09 | docs: Fix the documentation link on crates.io | diff --git a/Cargo.toml b/Cargo.toml
index bc24ae0..ac22a50 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,7 +7,7 @@ authors = ["Markus Westerlind <marwes91@gmail.com>"]
description = "Fast parser combinators on arbitrary streams with zero-copy support."
repository = "https://github.com/Marwes/combine"
-documentati... | 1 | 1 | 1 |
c103acf4696a8e139b4471d0ae6a8e33c136cee0 | Markus Westerlind | 2017-03-25T11:25:48 | style: Update rustfmt version | diff --git a/benches/http.rs b/benches/http.rs
index 51854e6..b73743a 100644
--- a/benches/http.rs
+++ b/benches/http.rs
@@ -51,27 +51,27 @@ fn parse_http_request(input: &[u8]) -> Result<((Request, Vec<Header>), &[u8]), P
take_while1(is_not_space),
take_while1(is_space)... | 10 | 218 | 260 |
ea04beb715b0f4aa2dbaaa929743a145a7805ce9 | Cheng Sun | 2017-03-30T13:04:44 | expected: remove erroneous `parse_stream` impl
This now ensures `expected` behaves as documented, by never reporting
its error if the child parser consumes any input | diff --git a/src/combinator.rs b/src/combinator.rs
index e035c46..79d7664 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1882,19 +1882,6 @@ impl<P> Parser for Expected<P>
type Input = P::Input;
type Output = P::Output;
- fn parse_stream(&mut self, input: Self::Input) -> ParseResult<Self::Outp... | 1 | 40 | 14 |
a7f9fb416f889cdad275859e6116609334284dcd | Cheng Sun | 2017-03-30T12:59:30 | try: only add error messages once on EmptyErr | diff --git a/src/combinator.rs b/src/combinator.rs
index e4c01d6..e035c46 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1526,14 +1526,10 @@ impl<I, O, P> Parser for Try<P>
type Input = I;
type Output = O;
#[inline]
- fn parse_lazy(&mut self, input: I) -> ConsumedResult<O, I> {
+ fn par... | 1 | 18 | 5 |
2882a2d9b7f23c5d142f9fa93ed9ceca7964dbcf | Cheng Sun | 2017-03-30T14:41:29 | tests/ini.rs: use message instead of expected | diff --git a/tests/ini.rs b/tests/ini.rs
index 6231b65..7e9e85d 100644
--- a/tests/ini.rs
+++ b/tests/ini.rs
@@ -20,7 +20,7 @@ fn property<I>(input: I) -> ParseResult<(String, String), I>
token('='),
many1(satisfy(|c| c != '\n' && c != ';')))
.map(|(key, _, value)| (key, value))
- .expected(... | 1 | 4 | 3 |
34feb737844785a98ac201e3c0ca71b5913f8d84 | Cheng Sun | 2017-03-30T12:02:31 | message: remove unnecessary clone | diff --git a/src/combinator.rs b/src/combinator.rs
index 73ede8f..e4c01d6 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1675,7 +1675,7 @@ impl<I, P> Parser for Message<P>
#[inline]
fn parse_lazy(&mut self, input: I) -> ConsumedResult<Self::Output, I> {
- match self.0.parse_lazy(input.clo... | 1 | 1 | 1 |
45ec8f9fd0f70c89f8d2849c45f809df092c523a | Cheng Sun | 2017-03-30T01:04:44 | message: add unit test | diff --git a/src/combinator.rs b/src/combinator.rs
index b0d5bf0..73ede8f 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -2128,8 +2128,8 @@ pub fn env_parser<E, I, O>(env: E, parser: fn(E, I) -> ParseResult<O, I>) -> Env
#[cfg(test)]
mod tests {
use super::*;
- use primitives::{Error, ParseError, P... | 1 | 43 | 2 |
8f9590e857cc6342d4a0b68e55abea8de30eb303 | Cheng Sun | 2017-03-30T00:37:33 | message: ensure the message error is always added | diff --git a/src/combinator.rs b/src/combinator.rs
index 281f08a..b0d5bf0 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1673,21 +1673,21 @@ impl<I, P> Parser for Message<P>
type Input = I;
type Output = P::Output;
- fn parse_stream(&mut self, input: I) -> ParseResult<Self::Output, I> {
- ... | 1 | 13 | 13 |
e2d3032a5199601ce10dee909b2b3d2298081a4d | Cheng Sun | 2017-03-30T00:29:35 | Documentation: make Parser docs more detailed | diff --git a/src/primitives.rs b/src/primitives.rs
index 2347866..4be52bf 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -1275,10 +1275,12 @@ impl<O, I> From<ParseResult<O, I>> for ConsumedResult<O, I>
/// into the type `Output`.
///
/// All methods have a default implementation but there needs to be at l... | 1 | 43 | 12 |
7099dce450ca77a80ccc0abdfd8c11be99b945c4 | Cheng Sun | 2017-03-30T00:29:07 | Documentation: spelling | diff --git a/src/primitives.rs b/src/primitives.rs
index 1063b68..2347866 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -125,7 +125,7 @@ impl<T, R> From<&'static str> for Info<T, R> {
}
}
-/// Enum used to store information about an error that has occured during parsing.
+/// Enum used to store info... | 1 | 14 | 14 |
0d8341838c9766f805a78809b85ddadb140e5080 | hyone | 2017-03-25T02:20:45 | Fix a bug that causes wrong evaluation in number between 0.0 and 1.0 | diff --git a/benches/json.rs b/benches/json.rs
index 176292f..01b5714 100644
--- a/benches/json.rs
+++ b/benches/json.rs
@@ -79,7 +79,7 @@ impl<I> Json<I>
.and(i)
.map(|(sign, n)| if sign.is_some() { -n } else { n })
.and(optional(char('.')).with(fractional))
- ... | 1 | 3 | 1 |
5b5a4949f19406d12fab031ffdaec3d01ec36214 | hyone | 2017-03-25T02:16:08 | Remove a leading new line causes parse error | diff --git a/benches/json.rs b/benches/json.rs
index 88d4c36..176292f 100644
--- a/benches/json.rs
+++ b/benches/json.rs
@@ -164,8 +164,7 @@ impl<I> Json<I>
#[test]
fn json_test() {
use self::Value::*;
- let input = r#"
-{
+ let input = r#"{
"array": [1, ""],
"object": {},
"number": 3.14, | 1 | 1 | 2 |
3e938b6611919e55c35b2165ffec68198c2f4497 | Markus Westerlind | 2017-03-05T10:29:35 | chore: Version 2.3.1 | diff --git a/Cargo.toml b/Cargo.toml
index d67efbe..bc24ae0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "combine"
-version = "2.3.0"
+version = "2.3.1"
authors = ["Markus Westerlind <marwes91@gmail.com>"]
description = "Fast parser combinators on arbitrary streams with zero-copy su... | 1 | 1 | 1 |
6291607e3db6d864fe28e4bc3073fb43a3a26ac7 | Markus Westerlind | 2017-03-05T10:29:12 | chore: Run clippy on combine | diff --git a/benches/http.rs b/benches/http.rs
index 291633d..51854e6 100644
--- a/benches/http.rs
+++ b/benches/http.rs
@@ -21,26 +21,8 @@ struct Header<'a> {
fn is_token(c: u8) -> bool {
match c {
- 128...255 => false,
- 0...31 => false,
- b'(' => false,
- b')' => false,
- b... | 6 | 91 | 94 |
6f02e4db0a480a45876952d41367990eaa33212f | Markus Westerlind | 2017-03-05T09:36:22 | fix: Don't return ConsumedOk when optional's inner parser returns EmptyOk | diff --git a/src/combinator.rs b/src/combinator.rs
index b0228a0..61fe4cb 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1346,7 +1346,7 @@ impl<P> Parser for Optional<P>
#[inline]
fn parse_lazy(&mut self, input: P::Input) -> ConsumedResult<Option<P::Output>, P::Input> {
match self.0.parse... | 1 | 1 | 1 |
77586c01f5b38923482d866db5be85abc10527d7 | Michael Budde | 2017-02-27T12:59:02 | Fix copy-paste errors in documentation | diff --git a/src/combinator.rs b/src/combinator.rs
index 4114c15..b0228a0 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1624,7 +1624,7 @@ impl<I, P1, P2> Parser for With<P1, P2>
}
}
-/// Equavalent to [`p1.with(p2)`].
+/// Equivalent to [`p1.with(p2)`].
///
/// [`p1.with(p2)`]: ../primitives/trai... | 1 | 10 | 9 |
abea3d8dac82a609017da097cae3681931cd28f1 | Markus Westerlind | 2017-02-22T21:44:26 | docs: Document the Consumed enum | diff --git a/src/primitives.rs b/src/primitives.rs
index 980644d..98fd8fe 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -262,7 +262,11 @@ impl<T, R> Error<T, R> {
}
}
-/// Enum used to indicate if a parser consumed any items of the stream it was given as an input
+/// Enum used to indicate if a pars... | 1 | 11 | 2 |
ea5b1cb9f689e41065a9dd375a37525433afc1aa | Markus Westerlind | 2017-02-22T21:37:17 | fix: Unbreak the failed build caused by the mispelled deprecated attribute | diff --git a/src/combinator.rs b/src/combinator.rs
index 7af0cc6..75d0bc6 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1658,7 +1658,7 @@ impl<I, P> Parser for Message<P>
.parse_stream(input.clone())
.map_err(|errors| {
errors.map(|mut errors| {
- ... | 2 | 15 | 7 |
fd4d95076f4dcde3b4237854273986550b7e0669 | Markus Westerlind | 2017-02-20T22:26:31 | docs: Document ParseError | diff --git a/src/primitives.rs b/src/primitives.rs
index d2a0cd6..22116ac 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -44,7 +44,9 @@ impl fmt::Display for BytePosition {
}
}
-/// Enum holding error information
+/// Enum holding error information. Variants are defined for `Stream::Item` and `Stream... | 1 | 26 | 8 |
9f77f43aa06d3440ec03c63881f49818aebbc73c | Markus Westerlind | 2017-02-20T22:09:49 | fix: Make combine build on rust 1.11 | diff --git a/src/lib.rs b/src/lib.rs
index e17a732..db3df71 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -504,12 +504,12 @@ mod tests {
#[derive(Debug)]
struct ExtractedError(usize, DisplayVec<Error<CloneOnly, DisplayVec<CloneOnly>>>);
- impl std::error::Error for ExtractedError {
+ imp... | 1 | 7 | 3 |
d459495576a5d0ff7cdd988d4b41bcc37c799e4c | Nick Alexander | 2017-02-20T21:55:19 | Post: Test mapping ParseError to StdError without dropping internal details. | diff --git a/src/lib.rs b/src/lib.rs
index 17eff6d..e17a732 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -483,4 +483,69 @@ mod tests {
err
});
}
+
+ #[test]
+ fn extract_std_error() {
+ // The previous test verified that we could map a ParseError to a StdError by dropping the
+ ... | 1 | 65 | 0 |
3cd4951af2524236db0501afde33b6d87936ebdf | Nick Alexander | 2017-02-20T20:07:03 | Review comment: add `map_token`; s/map_err_range/map_range/. | diff --git a/src/primitives.rs b/src/primitives.rs
index c84df14..d2a0cd6 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -57,6 +57,16 @@ pub enum Info<T, R> {
}
impl<T, R> Info<T, R> {
+ pub fn map_token<F, U>(self, f: F) -> Info<U, R> where F: FnOnce(T) -> U {
+ use self::Info::*;
+ mat... | 1 | 21 | 1 |
b6979b750c40a26ea1c665e064b17820cfd2c0eb | Nick Alexander | 2017-02-17T00:06:07 | Add map functions for Error<> and Info<> ranges. (#86)
It's possible to `map_err_range` for `ParseResult<>` too, but it's
awkward because the output type needs to be a compatible `StreamOnce`.
As suggested in
https://github.com/Marwes/combine/issues/86#issuecomment-280487165,
it's probably best to either change the pa... | diff --git a/src/primitives.rs b/src/primitives.rs
index 47acca3..c84df14 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -56,6 +56,18 @@ pub enum Info<T, R> {
Borrowed(&'static str),
}
+impl<T, R> Info<T, R> {
+ pub fn map_range<F, S>(self, f: F) -> Info<T, S> where F: FnOnce(R) -> S {
+ us... | 1 | 24 | 0 |
6f2cec695bc04b2b6d9ac83edca52158f097931a | Markus Westerlind | 2017-02-03T18:23:48 | feat: Add the choice! macro
This macro should give a cleaner way of writing multiple alternative parsers and may also result in faster code. | diff --git a/src/combinator.rs b/src/combinator.rs
index 370613c..7af0cc6 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -567,7 +567,7 @@ pub fn count<F, P>(count: usize, parser: P) -> Count<F, P>
}
/// Takes an array of parsers and tries to apply them each in order.
-/// Fails if all parsers fails or if... | 2 | 33 | 1 |
501322b53754800b26c18a0e6a0a46fdeecbfe92 | Markus Westerlind | 2017-02-02T21:23:39 | feat: Version 2.2.2 | diff --git a/Cargo.toml b/Cargo.toml
index b4c5486..833bce8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "combine"
-version = "2.2.1"
+version = "2.2.2"
authors = ["Markus Westerlind <marwes91@gmail.com>"]
description = "Fast parser combinators on arbitrary streams with zero-copy su... | 1 | 1 | 1 |
a4bf28d2e490405ba362a3324a0b7115972d4044 | Markus Westerlind | 2017-02-01T22:37:03 | perf: Don't call parse_stream in optional
Since an empty error will will result in optional ignoring the error and returning ok we can safely ignore the errors generated by parse_stream | diff --git a/src/combinator.rs b/src/combinator.rs
index 64b2e96..370613c 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1298,10 +1298,11 @@ impl<P> Parser for Optional<P>
type Output = Option<P::Output>;
#[inline]
fn parse_lazy(&mut self, input: P::Input) -> ConsumedResult<Option<P::Output>,... | 1 | 5 | 4 |
2d6def290a4d23f79a313c3b9c43c84b9e738b78 | Markus Westerlind | 2017-02-01T19:31:30 | feat: Version 2.2.1 | diff --git a/Cargo.toml b/Cargo.toml
index 1fc4d2e..b4c5486 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "combine"
-version = "2.2.0"
+version = "2.2.1"
authors = ["Markus Westerlind <marwes91@gmail.com>"]
description = "Fast parser combinators on arbitrary streams with zero-copy su... | 1 | 1 | 1 |
2e0667f03c747c0272d87aa7c9c207ecf10591f8 | Markus Westerlind | 2017-02-01T19:31:05 | docs: Update the description to mention zero-copy
Drops the mention of parsec in the description since the library has evolved away from parsec in quite a few ways. | diff --git a/Cargo.toml b/Cargo.toml
index 75b523a..1fc4d2e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -4,21 +4,20 @@ name = "combine"
version = "2.2.0"
authors = ["Markus Westerlind <marwes91@gmail.com>"]
-description = "Parser combinators based on the Haskell library parsec."
+description = "Fast parser combinat... | 1 | 2 | 3 |
97e3a244c838133e408bce6176830a803fce362e | Markus Westerlind | 2017-02-01T19:14:07 | docs: Fix copy pasted mistakes in count, one_of and none_of | diff --git a/src/combinator.rs b/src/combinator.rs
index 7aad27b..64b2e96 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -482,16 +482,25 @@ impl<T, I> Parser for NoneOf<T, I>
}
}
-/// Extract one token and succeeds if it is part of `tokens`.
+/// Extract one token and succeeds if it is not part of `t... | 2 | 30 | 21 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.