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 |
|---|---|---|---|---|---|---|---|
d856810f52ba509df06387c8e34b7c05affc6bc4 | Markus Westerlind | 2017-01-31T18:19:31 | test: Don't import satisfy twice in the boxed test
Worked on nightly but not on stable | diff --git a/src/primitives.rs b/src/primitives.rs
index 13c09a8..f7679e5 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -1531,7 +1531,6 @@ pub trait Parser {
/// ```
/// # extern crate combine;
/// # use combine::*;
- /// # use combine::{satisfy, token};
/// # fn main() {
/// fn ... | 1 | 0 | 1 |
3706349cf5aeb3e34d5df9727ac09044ce27b190 | Markus Westerlind | 2017-01-31T18:11:51 | feat: Version 2.2.0 | diff --git a/Cargo.toml b/Cargo.toml
index 0dd987f..75b523a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "combine"
-version = "2.1.2"
+version = "2.2.0"
authors = ["Markus Westerlind <marwes91@gmail.com>"]
description = "Parser combinators based on the Haskell library parsec." | 1 | 1 | 1 |
2bfeca065ad586c6d8f03fa6ae84a9135a5e15b2 | Markus Westerlind | 2017-01-31T18:11:35 | docs: Document the zero copy parsers | diff --git a/src/range.rs b/src/range.rs
index 53b65cb..6e079af 100644
--- a/src/range.rs
+++ b/src/range.rs
@@ -33,6 +33,9 @@ impl<I> Parser for Range<I>
}
}
+/// Zero-copy parser which reads a range of length `i.len()` and succeds if `i` is equal to that
+/// range
+///
/// ```
/// # extern crate combine;
... | 1 | 9 | 1 |
3af9c9b3cac90c9439835943e5fda65bffde234a | Markus Westerlind | 2017-01-31T17:05:22 | feat: Add Parser::boxed
Convenience method for turning a parser into a trait object | diff --git a/src/primitives.rs b/src/primitives.rs
index 0c4dacf..13c09a8 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -7,8 +7,8 @@ use std::io::{Read, Bytes};
use self::FastResult::*;
-use combinator::{AndThen, and_then, Expected, expected, FlatMap, flat_map, Iter, Map, map,
- Message... | 1 | 26 | 2 |
de8b92f1aa2b9b8e23c77c0d1c0718b60b7a314d | Markus Westerlind | 2017-01-20T22:07:46 | feat: Version 2.1.2 | diff --git a/Cargo.toml b/Cargo.toml
index 741a7a6..0dd987f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "combine"
-version = "2.1.1"
+version = "2.1.2"
authors = ["Markus Westerlind <marwes91@gmail.com>"]
description = "Parser combinators based on the Haskell library parsec." | 1 | 1 | 1 |
90c416539781d41d36440f2aa4a068316fefb118 | Markus Westerlind | 2017-01-20T22:07:24 | chore: Add crates.io categories to Cargo.toml | diff --git a/Cargo.toml b/Cargo.toml
index 0c43896..741a7a6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,6 +13,8 @@ readme = "README.md"
keywords = ["parser", "combinators", "ll"]
+categories = ["parsing"]
+
license = "MIT"
[lib] | 1 | 2 | 0 |
6a748bdcb8f583fe988ad0b071e8e1ca5ff9c476 | Richard Newman | 2017-01-12T02:15:16 | Fix a typo. | diff --git a/src/combinator.rs b/src/combinator.rs
index 3d8fdaf..7aad27b 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -153,7 +153,7 @@ impl<I, P, R> Parser for SatisfyMap<I, P>
/// Parses a token and passes it to `predicate`. If `predicate` returns `Some` the parser succeeds
/// and returns the value ... | 1 | 1 | 1 |
da8020ca35e681daf61f3b4fc6ce5b8ccbc8a2b1 | Markus Westerlind | 2017-01-06T19:43:09 | feat: Version 2.1.1 | diff --git a/Cargo.toml b/Cargo.toml
index 2ca874c..0c43896 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "combine"
-version = "2.1.0"
+version = "2.1.1"
authors = ["Markus Westerlind <marwes91@gmail.com>"]
description = "Parser combinators based on the Haskell library parsec." | 1 | 1 | 1 |
c308819562e02fef1f2c688b93c7bef0f4159d12 | Nick Alexander | 2017-01-06T00:59:55 | Add test showing that token() works with Clone item types. Verifies #74.
This test verifies we can use token() with a StreamSlice. | diff --git a/src/combinator.rs b/src/combinator.rs
index 797ad92..3d8fdaf 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -2093,4 +2093,18 @@ mod tests {
errors: vec![Error::Unexpected('a'.into()), Error::Expected("digit".into())],
}));
}
+
+ #[derive(Clone,... | 1 | 14 | 0 |
fda4038e801822854f0d725072dc46e91dbf1b7b | Nick Alexander | 2017-01-05T23:49:20 | Make StreamOnce for &'a [T] require Clone rather than Copy.
Clone is a super-type of Copy, so everything that implements Copy
already implements Clone. Therefore, this is strictly more general.
In addition, .clone() on things that implement Copy should be
inlined (to `return *self`) and essentially zero cost. And pe... | diff --git a/src/primitives.rs b/src/primitives.rs
index bc28315..9ae94f2 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -711,7 +711,7 @@ impl<'a, T> Range for &'a [T] {
}
impl<'a, T> RangeStream for &'a [T]
- where T: Copy + PartialEq
+ where T: Clone + PartialEq
{
#[inline]
fn uncons_r... | 1 | 17 | 4 |
f41296652255545352f5a188943b5785a2bb97f7 | Nick Alexander | 2017-01-06T00:55:18 | Pre: Add test for take_while1. | diff --git a/src/range.rs b/src/range.rs
index fdb3d31..53b65cb 100644
--- a/src/range.rs
+++ b/src/range.rs
@@ -183,6 +183,16 @@ mod tests {
fn take_while_test() {
let result = take_while(|c: char| c.is_digit(10)).parse("123abc");
assert_eq!(result, Ok(("123", "abc")));
+ let result = tak... | 1 | 10 | 0 |
a2a9f214af7de3e80b6991e3802b93233a22fdfb | Markus Westerlind | 2016-10-26T21:21:25 | feat: Add a read adapter for the stream trait | diff --git a/src/primitives.rs b/src/primitives.rs
index 265338b..bc28315 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -1,8 +1,9 @@
-use std::fmt;
-use std::error::Error as StdError;
use std::any::Any;
use std::cell::UnsafeCell;
use std::collections::VecDeque;
+use std::error::Error as StdError;
+use st... | 1 | 58 | 2 |
44927da557495a3ced1880d1ded8017b3b87ca0c | Markus Westerlind | 2016-10-27T16:38:47 | docs: Actually compare the error message in the first example in lib.rs | diff --git a/src/lib.rs b/src/lib.rs
index 6941a96..fd21b44 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -22,13 +22,14 @@
//! use combine::{Parser, State};
//! use combine::char::{digit, letter};
//! const MSG: &'static str = r#"Parse error at line: 1, column: 1
-//! Unexpected '|'
-//! ... | 1 | 4 | 3 |
efa2eb1cc8996eab1a29fd84c7219dcfcacf65c6 | Markus Westerlind | 2016-10-22T16:07:12 | docs: Deliver the promised line and column in the error of the first example | diff --git a/src/lib.rs b/src/lib.rs
index f7fea59..6941a96 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -19,17 +19,16 @@
//!
//! ```rust
//! extern crate combine;
-//! use combine::Parser;
+//! use combine::{Parser, State};
//! use combine::char::{digit, letter};
+//! const MSG: &'static str = r#"Parse error at lin... | 1 | 7 | 8 |
a7949f3aef8585523e730e2c1224c3725b360d32 | Markus Westerlind | 2016-10-19T18:40:54 | feat: Add the count parser | diff --git a/src/combinator.rs b/src/combinator.rs
index 96baf94..797ad92 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -460,7 +460,6 @@ pub fn one_of<T, I>(tokens: T) -> OneOf<T, I>
}
}
-
#[derive(Clone)]
pub struct NoneOf<T, I>
where I: Stream
@@ -507,6 +506,55 @@ pub fn none_of<T, I>(token... | 1 | 49 | 1 |
15554d0c64a2415e8c234708595cc544ada6c585 | Markus Westerlind | 2016-10-19T18:36:55 | feat: Add the Parser::by_ref method
This mirrors `Iterator::by_ref` making `&mut P` parsers easier to find and use. | diff --git a/src/primitives.rs b/src/primitives.rs
index 77b1f2d..265338b 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -1137,6 +1137,32 @@ pub trait Parser {
/// Adds the first error that would normally be returned by this parser if it failed
fn add_error(&mut self, _error: &mut ParseError<Self::... | 1 | 26 | 0 |
941b277c8f4d8e8af804c88678181be7743f912b | Markus Westerlind | 2016-10-19T17:39:31 | feat: Add the one_of and none_of parsers | diff --git a/src/combinator.rs b/src/combinator.rs
index feb8c8a..96baf94 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -408,6 +408,106 @@ impl<I, O, S, P> Parser for Choice<S, P>
}
}
+#[derive(Clone)]
+pub struct OneOf<T, I>
+ where I: Stream
+{
+ tokens: T,
+ _marker: PhantomData<I>,
+}
+... | 2 | 102 | 2 |
d6c65f6da5a2af47254abe2db4b04c3ecbd74803 | Markus Westerlind | 2016-10-19T17:11:17 | feat: Add the position parser
The position parser just returns the current position in the stream without consuming anything | diff --git a/src/combinator.rs b/src/combinator.rs
index a571c28..feb8c8a 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -325,6 +325,48 @@ pub fn tokens<C, T, I>(cmp: C, expected: Info<I::Item, I::Range>, tokens: T) ->
}
}
+
+#[derive(Clone)]
+pub struct Position<I>
+ where I: Stream
+{
+ _mark... | 2 | 45 | 3 |
ee6b430d17508daf305d5f48fabae2d662a94d34 | Markus Westerlind | 2016-09-15T18:43:22 | feat: Add bytes_cmp and string_cmp | diff --git a/src/byte.rs b/src/byte.rs
index 318e22e..46ea6e9 100644
--- a/src/byte.rs
+++ b/src/byte.rs
@@ -147,10 +147,6 @@ pub fn hex_digit<I>() -> HexDigit<I>
#[derive(Clone)]
pub struct Bytes<I>(&'static [u8], PhantomData<I>) where I: Stream<Item = u8>;
-fn eq(&l: &u8, r: u8) -> bool {
- l == r
-}
-
impl<'... | 2 | 83 | 6 |
886c45235be207241874a0a412ebcc0733959466 | Markus Westerlind | 2016-09-15T18:20:42 | feat: Add the `tokens` parser
`tokens` is similiar to `token` but allows for a sequence of tokens to be parsed. It is more complex however since it needs to handle both comparing of tokens and which error is returned on error. | diff --git a/src/byte.rs b/src/byte.rs
index 0bc7fe7..318e22e 100644
--- a/src/byte.rs
+++ b/src/byte.rs
@@ -4,8 +4,8 @@ use std::marker::PhantomData;
use self::ascii::AsciiChar;
-use combinator::{Expected, satisfy, Satisfy, skip_many, SkipMany, token, Token, With};
-use primitives::{Consumed, ConsumedResult, Erro... | 4 | 117 | 90 |
93eaa0b02774d432af6fbaf3202d0bb97587040c | Markus Westerlind | 2016-09-13T19:48:33 | refactor: Rename combine_fast to combine_consumed | diff --git a/src/byte.rs b/src/byte.rs
index 25e8cd2..0bc7fe7 100644
--- a/src/byte.rs
+++ b/src/byte.rs
@@ -173,7 +173,7 @@ impl<'a, I> Parser for Bytes<I>
input = rest.into_inner();
}
Err(error) => {
- return error.combine_fast(|mut error| {
+ ... | 5 | 11 | 6 |
b6ccb0c1807f0f182878b68d4dbdcfa739fd5157 | Markus Westerlind | 2016-09-12T20:27:16 | feat: Break out the error formatting into a separate function
This lets users still get the convenience of printing expected, unexpected and message errors while also being able to customize how the position is displayed. | diff --git a/src/combinator.rs b/src/combinator.rs
index e34c87a..97366ab 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1103,8 +1103,8 @@ impl<I, P, Op> Parser for Chainl1<P, Op>
/// let number = digit().map(|c: char| c.to_digit(10).unwrap());
/// let sub = token('-').map(|_| |l: u32, r: u32| l - r);
//... | 3 | 85 | 77 |
b375df4811570d14bbd8db7cb74a6834e54679cf | Markus Westerlind | 2016-09-11T11:57:28 | feat: Rename parse_state to parse_stream
The name `parse_state` is a carried over from 1.x but makes no sense anymore. | diff --git a/benches/json.rs b/benches/json.rs
index 6476504..4709822 100644
--- a/benches/json.rs
+++ b/benches/json.rs
@@ -113,7 +113,7 @@ impl<I> Json<I>
}
});
match c {
- '\\' => input.combine(|input| back_slash_char.parse_state(input)),
+ '\\' => input.c... | 6 | 62 | 62 |
08a91ce201b67f5528a18228bdfb079e7d86dd7f | Markus Westerlind | 2016-09-11T11:21:26 | feat: Simplify the flat_map parser | diff --git a/benches/mp4.rs b/benches/mp4.rs
index f8ff2bd..381d91a 100644
--- a/benches/mp4.rs
+++ b/benches/mp4.rs
@@ -50,7 +50,7 @@ fn parse_mp4(data: &[u8]) -> Result<(Vec<MP4Box>, &[u8]), ParseError<&[u8]>> {
.or(range(&b"skip"[..]).map(|_| MP4Box::Skip))
.or(range(&b"wide"[..]).map(|_| MP4Box::W... | 3 | 21 | 7 |
26a841540107b79542bb874a60abb83f99c78a58 | Markus Westerlind | 2016-09-11T09:05:26 | feat: Merge the ParserExt trait into Parser | diff --git a/benches/json.rs b/benches/json.rs
index d6fe9ec..6476504 100644
--- a/benches/json.rs
+++ b/benches/json.rs
@@ -9,7 +9,7 @@ use std::path::Path;
use pc::primitives::{Consumed, Parser, ParseError, ParseResult, State, Stream, BufferedStream};
use pc::combinator::{any, between, choice, many, many1, option... | 8 | 383 | 326 |
0d90c718315288f5485d7677a649d0ef87d452be | Markus Westerlind | 2016-09-11T08:19:40 | docs: u8acter -> character | diff --git a/src/byte.rs b/src/byte.rs
index 93342ee..9496a56 100644
--- a/src/byte.rs
+++ b/src/byte.rs
@@ -7,7 +7,7 @@ use self::ascii::AsciiChar;
use combinator::{Expected, ParserExt, satisfy, Satisfy, skip_many, SkipMany, token, Token, With};
use primitives::{Consumed, ConsumedResult, Error, Info, Parser, ParseEr... | 1 | 3 | 3 |
d846bf0e7ddb3350ce9245b3682d7c054ff5cdd8 | Markus Westerlind | 2016-09-10T23:20:05 | fix: Rename the String parser to Str
This way it no longer conflicts with `std::string::String` letting the char module be wildcard imported. | diff --git a/src/char.rs b/src/char.rs
index 64b9a10..d3d3590 100644
--- a/src/char.rs
+++ b/src/char.rs
@@ -147,8 +147,8 @@ pub fn hex_digit<I>() -> HexDigit<I>
#[derive(Clone)]
-pub struct String<I>(&'static str, PhantomData<I>);
-impl<I> Parser for String<I>
+pub struct Str<I>(&'static str, PhantomData<I>);
+im... | 1 | 4 | 4 |
9c73c053f37b149c35d60377f6dcbbbfc145dda9 | Markus Westerlind | 2016-09-10T23:17:31 | feat: Add the bytes parser | diff --git a/src/byte.rs b/src/byte.rs
index 5a108c7..93342ee 100644
--- a/src/byte.rs
+++ b/src/byte.rs
@@ -5,7 +5,7 @@ use std::marker::PhantomData;
use self::ascii::AsciiChar;
use combinator::{Expected, ParserExt, satisfy, Satisfy, skip_many, SkipMany, token, Token, With};
-use primitives::{ConsumedResult, Parse... | 1 | 76 | 1 |
01ba375929daac2cb81a3e966e529f0909014620 | Markus Westerlind | 2016-09-10T22:48:58 | feat: Add parsers specialized on byte streams | diff --git a/Cargo.toml b/Cargo.toml
index 7f76364..4371f53 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,6 +20,9 @@ license = "MIT"
name = "combine"
path = "src/lib.rs"
+[dependencies]
+ascii = "0.7.0"
+
[dev-dependencies]
byteorder = "0.5.3"
diff --git a/src/byte.rs b/src/byte.rs
new file mode 100644
index ... | 4 | 189 | 37 |
9dc7dc6b9bcb638888be448efb7002d362aded16 | Markus Westerlind | 2016-09-10T13:48:33 | perf: Specialize and_then, then and flat_map | diff --git a/src/combinator.rs b/src/combinator.rs
index de0921d..98ea7c0 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -536,10 +536,10 @@ impl<F, P> Parser for Many<F, P>
{
type Input = P::Input;
type Output = F;
- fn parse_state(&mut self, input: P::Input) -> ParseResult<F, P::Input> {
+ ... | 1 | 47 | 18 |
f45740dd71cf9c71e0900e932c2f10ccbefae35e | Markus Westerlind | 2016-09-10T13:47:42 | feat: Make ctry usable outside the crate | diff --git a/src/primitives.rs b/src/primitives.rs
index 18f6a97..e0cdadb 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -10,10 +10,10 @@ use self::FastResult::*;
macro_rules! ctry {
($result: expr) => {
match $result {
- ConsumedOk((x, i)) => (x, Consumed::Consumed(i)),
- ... | 1 | 4 | 4 |
36ef2bcbabf1f501cfd96294f6d8b23a8b7d8a08 | Markus Westerlind | 2016-09-10T13:18:05 | test: Add a mp4 parser modeled on the nom parser in Geal/nom_benchmarks | diff --git a/Cargo.toml b/Cargo.toml
index f5d8f19..7f76364 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,3 +19,11 @@ license = "MIT"
name = "combine"
path = "src/lib.rs"
+
+[dev-dependencies]
+byteorder = "0.5.3"
+
+
+[features]
+# Run the mp4 benchmark, requires a mp4 file named `small.mp4` in the benches direc... | 3 | 108 | 0 |
77d6f38002f000061c19b50e2c9168160389f157 | Markus Westerlind | 2016-09-10T11:39:04 | refactor: Move the zero-copy parsers to the range module | diff --git a/benches/http.rs b/benches/http.rs
index eeeb4af..291633d 100644
--- a/benches/http.rs
+++ b/benches/http.rs
@@ -4,7 +4,7 @@ extern crate combine;
use combine::*;
use combine::primitives::Error;
-use combine::combinator::{take_while1, range};
+use combine::range::{take_while1, range};
#[derive(Debug)... | 4 | 198 | 191 |
eb089f5bef175b96e097286b9c8c3e7d5f6e3922 | Markus Westerlind | 2016-09-10T11:26:13 | fix: Use five copies in the large http test anyway to match nom_benchmarks | diff --git a/benches/http.rs b/benches/http.rs
index bbcba90..eeeb4af 100644
--- a/benches/http.rs
+++ b/benches/http.rs
@@ -108,8 +108,8 @@ fn http_requests_small(b: &mut ::test::Bencher) {
fn http_requests_large(b: &mut ::test::Bencher) {
use std::iter;
- let mut buffer = Vec::with_capacity(REQUESTS.len() ... | 1 | 2 | 2 |
9912507a80e178737e16d4ff3d19d7a1fee9fbc8 | Markus Westerlind | 2016-09-10T11:24:58 | fix: Avoid storing the position in primitives::uncons_while
All current `RangeStream`'s never return an error on uncons_while so they will not change behavior and as long as `RangeStream`s don't update their positions if they fail there will be no change in behavior anyway. | diff --git a/src/primitives.rs b/src/primitives.rs
index 0e3d09f..18f6a97 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -608,9 +608,8 @@ pub fn uncons_while<I, F>(mut input: I, predicate: F) -> ConsumedResult<I::Range
I: RangeStream,
I::Range: Range
{
- let position = input.positio... | 1 | 1 | 2 |
2b294f8009021897d9652981dfb107dd2102a902 | Markus Westerlind | 2016-09-10T10:43:25 | perf: Specialize the tuple parser to avoid unnecessary branches
Unfortunately LLVM seems unable to optimize the default implementation of `Parser::parse_state_fast` to this specialization so we have to do this manually. Gives a ~1.1x speedup. | diff --git a/src/combinator.rs b/src/combinator.rs
index b794f49..16c3101 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1767,13 +1767,17 @@ macro_rules! tuple_parser {
}
};
$(
- let $id = match $id.parse_state_fast(input) {
+ ... | 1 | 6 | 2 |
0e5ee38e1b15847908f6676c0c4032dc844e3462 | Markus Westerlind | 2016-09-10T10:36:46 | perf: Add inline annotations and more forwarding parse functions
This does not seem to give any change in performance in the benchmarks but ít shouldn't hurt and may help in other cases. | diff --git a/src/char.rs b/src/char.rs
index f977b7f..a5db180 100644
--- a/src/char.rs
+++ b/src/char.rs
@@ -11,6 +11,7 @@ macro_rules! impl_char_parser {
where I: Stream<Item=char> $(, $ty_var : Parser<Input=I>)* {
type Input = I;
type Output = <$inner_type as Parser>::Output;
+ #[inl... | 3 | 157 | 20 |
52d335caa2e698de9be50e46e8fbcf241d4e3081 | Markus Westerlind | 2016-08-23T21:32:55 | perf: Avoid indirection in Skip and With
May give a very tiny speedup | diff --git a/src/combinator.rs b/src/combinator.rs
index 9e8c32e..2d15aa2 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1220,7 +1220,7 @@ pub fn look_ahead<P>(p: P) -> LookAhead<P>
}
#[derive(Clone)]
-pub struct With<P1, P2>(P1, P2)
+pub struct With<P1, P2>((P1, P2))
where P1: Parser,
P... | 1 | 6 | 12 |
9631700a306cb5546e37dfb8f05d54728fb3bc8c | Markus Westerlind | 2016-08-23T19:55:52 | perf: Optimize Iter by simplifying the state machine | diff --git a/src/combinator.rs b/src/combinator.rs
index 842de01..9e8c32e 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -2,7 +2,7 @@ use std::iter::FromIterator;
use std::marker::PhantomData;
use primitives::{Info, Parser, ParseResult, ConsumedResult, ParseError, Stream, StreamOnce, Error,
... | 2 | 57 | 48 |
5d86dcf2d14f1cae078d1a4b8831d37041eaf7a2 | Markus Westerlind | 2016-08-23T19:07:48 | perf: Speedup tuple parsers by simplifying the expanded code | diff --git a/src/combinator.rs b/src/combinator.rs
index 4bcd5ed..842de01 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -713,7 +713,6 @@ impl<F, P, S> Parser for SepBy1<F, P, S>
type Output = F;
fn parse_lazy(&mut self, input: P::Input) -> ConsumedResult<F, P::Input> {
- // FIXME FastResu... | 1 | 41 | 18 |
2bbd14abd2b372afbfda56fb73d4aa036bd427e1 | Markus Westerlind | 2016-08-17T18:55:16 | feat: Add versions of parse_* which return an unpacked version of ParseResult
This can give a speedup of up to 1.5x for simple parsers (measured on
the http benchmark) | diff --git a/benches/json.rs b/benches/json.rs
index 2b3fa59..d6fe9ec 100644
--- a/benches/json.rs
+++ b/benches/json.rs
@@ -46,7 +46,7 @@ impl<I> Json<I>
fn_parser(Json::<I>::integer_, "integer")
}
fn integer_(input: I) -> ParseResult<i64, I> {
- let (s, input) = try!(lex(many1::<String, _>(d... | 5 | 360 | 165 |
4d97d2968c48026e8369e1f0bcee3c6ef5784664 | Markus Westerlind | 2016-09-09T16:31:51 | feat: Add the satisy_map parser
Fixed #67 | diff --git a/src/combinator.rs b/src/combinator.rs
index 86485ef..d28a6e5 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -71,18 +71,16 @@ pub struct Satisfy<I, P> {
_marker: PhantomData<I>,
}
-fn satisfy_impl<I, P, F>(input: I, predicate: &mut P, f: F) -> ParseResult<I::Item, I>
+fn satisfy_impl<I, P... | 2 | 65 | 12 |
b1f561139169caa1a5a2e3e2d84248b28f22bb82 | Markus Westerlind | 2016-08-23T19:09:51 | feat: Replace the And parser with the pair parser | diff --git a/src/combinator.rs b/src/combinator.rs
index 6770e04..86485ef 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1126,27 +1126,6 @@ pub fn look_ahead<P>(p: P) -> LookAhead<P>
LookAhead(p)
}
-#[derive(Clone)]
-pub struct And<P1, P2>(P1, P2);
-impl<I, P1, P2> Parser for And<P1, P2>
- where ... | 1 | 2 | 23 |
9bad15c0f79e3ff897fb92cdca6b92f988c69347 | Markus Westerlind | 2016-08-21T19:18:11 | perf: Avoid creating an error when take_while1 parses no input | diff --git a/src/combinator.rs b/src/combinator.rs
index 958af0d..6770e04 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1850,13 +1850,9 @@ impl<I, F> Parser for TakeWhile1<I, F>
::primitives::uncons_while(input, &mut self.0).and_then(|(v, input)| {
match input {
Consu... | 1 | 2 | 6 |
5743581ff0b71e7261df0d153d20ba830fcf9ead | Markus Westerlind | 2016-08-21T13:40:00 | Version 2.0.0-beta2 | diff --git a/Cargo.toml b/Cargo.toml
index 88f5407..f5d8f19 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "combine"
-version = "2.0.0-beta"
+version = "2.0.0-beta2"
authors = ["Markus Westerlind <marwes91@gmail.com>"]
description = "Parser combinators based on the Haskell library par... | 1 | 1 | 1 |
cce6214ed4722880881c8c6998e00f4509a22588 | Markus Westerlind | 2016-08-21T13:39:03 | fix: Calling uncons_range with the same size as is remaining should succeed | diff --git a/src/combinator.rs b/src/combinator.rs
index ea8e671..958af0d 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1786,6 +1786,9 @@ impl<I, E> Parser for Take<I>
/// # use combine::combinator::take;
/// # use combine::*;
/// # fn main() {
+/// let mut parser = take(1);
+/// let result = parser.par... | 2 | 19 | 3 |
5bdbf58484800717c7d7c20b9161562520f425cb | Markus Westerlind | 2016-06-06T16:01:27 | feat: Version 2.0.0-beta | diff --git a/Cargo.toml b/Cargo.toml
index 6fd83de..12a7ca8 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "combine"
-version = "1.3.0"
+version = "2.0.0-beta"
authors = ["Markus Westerlind <marwes91@gmail.com>"]
description = "Parser combinators based on the Haskell library parsec." | 1 | 1 | 1 |
3fdbf217ec0a66b052b8d11792ce3ff3d13b7463 | Markus Westerlind | 2016-06-06T16:00:42 | feat: Remove the buffered_stream feature | diff --git a/Cargo.toml b/Cargo.toml
index d32f582..6fd83de 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,8 +21,3 @@ name = "combine"
path = "src/lib.rs"
[features]
-# Using a feature in combine is considered to be unstable (does not adhere to semver) if you use one or more features
-# then you have been warned t... | 2 | 6 | 16 |
22add3eca62ff5e6f4d58122a4b366290b1d9385 | Markus Westerlind | 2016-06-05T14:38:33 | fix: Add Sync to to the Error::Other variant | diff --git a/src/primitives.rs b/src/primitives.rs
index 95d8cdd..a0bf1f8 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -91,7 +91,7 @@ pub enum Error<T, R> {
///Generic message
Message(Info<T, R>),
///Variant for containing other types of errors
- Other(Box<StdError + Send>),
+ Other(Bo... | 1 | 2 | 2 |
abb1de7f15b65b9bc2c40572319269191bd0819f | Markus Westerlind | 2016-04-17T15:27:06 | perf: Possibly improve performance of the RangeStream impl for &str
If nothing else this should make the llvm's work a bit easier | diff --git a/benches/json.rs b/benches/json.rs
index dfc8bc4..19e128f 100644
--- a/benches/json.rs
+++ b/benches/json.rs
@@ -7,8 +7,7 @@ use std::io::Read;
use std::fs::File;
use std::path::Path;
-use pc::primitives::{from_iter, Consumed, Parser, ParseError, ParseResult, State, Stream,
- Buffere... | 2 | 15 | 10 |
acea26cda536ffc681ca4fa9e4c1bf28f5184582 | Markus Westerlind | 2016-04-16T09:32:48 | feat: Version 1.3.0
* Added the eof parser
* Stabilized RangeStream | diff --git a/Cargo.toml b/Cargo.toml
index 53ce66c..d32f582 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "combine"
-version = "1.2.1"
+version = "1.3.0"
authors = ["Markus Westerlind <marwes91@gmail.com>"]
description = "Parser combinators based on the Haskell library parsec." | 1 | 1 | 1 |
6a89cbf2ef11ed5bf4145a296c208e5f5f90438c | Markus Westerlind | 2016-04-16T09:08:09 | feat: Add the eof parser
eof succeeds only at end of input | diff --git a/src/char.rs b/src/char.rs
index 7893a46..b2678ee 100644
--- a/src/char.rs
+++ b/src/char.rs
@@ -154,7 +154,8 @@ pub fn hex_digit<I>() -> HexDigit<I>
#[derive(Clone)]
pub struct String<I>(&'static str, PhantomData<I>);
-impl<I> Parser for String<I> where I: Stream<Item = char>
+impl<I> Parser for String... | 4 | 80 | 20 |
d932375d13a196fc74602f8e76ad5bd3512ca370 | Markus Westerlind | 2016-04-16T08:43:09 | feat: Stabilize RangeStream and all functions using it | diff --git a/Cargo.toml b/Cargo.toml
index 85d768f..53ce66c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,7 +23,6 @@ path = "src/lib.rs"
[features]
# Using a feature in combine is considered to be unstable (does not adhere to semver) if you use one or more features
# then you have been warned that you may experien... | 3 | 3 | 23 |
2c2b3f5cd21a04fbc157a95ce76fe72bfdc1a2c3 | Markus Westerlind | 2016-04-06T20:43:30 | feat: Reexport Stream and StreamOnce from the crate root | diff --git a/src/combinator.rs b/src/combinator.rs
index a859363..156511e 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -766,7 +766,7 @@ pub struct FnParser<I, F>(F, PhantomData<fn(I) -> I>);
/// ```
/// extern crate combine;
/// use combine::*;
-/// use combine::primitives::{Consumed, Error, Stream, Str... | 4 | 7 | 9 |
66eab92a7dd63269f48cf0fbd0722a6eeea9135d | Markus Westerlind | 2016-04-06T20:43:02 | fix: Fix positions of BufferedStream being for the next token | diff --git a/src/primitives.rs b/src/primitives.rs
index 099ff97..580a0d8 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -977,6 +977,17 @@ pub struct BufferedStream<'a, I>
buffer: &'a SharedBufferedStream<I>,
}
+#[cfg(feature = "buffered_stream")]
+impl<'a, I> fmt::Debug for BufferedStream<'a, I>
+ ... | 2 | 35 | 4 |
3bda4a163e8f3b57dd4efa65384c97f9c3554aeb | Markus Westerlind | 2016-04-06T17:31:31 | feat: Merge the HasPosition trait into StreamOnce | diff --git a/src/combinator.rs b/src/combinator.rs
index 8ad80b5..a859363 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1,6 +1,6 @@
use std::iter::FromIterator;
use std::marker::PhantomData;
-use primitives::{HasPosition, Info, Parser, ParseResult, ParseError, Stream, StreamOnce, Error, Consumed};
+use p... | 3 | 39 | 53 |
9ea0ed5d6c8f8cead773a24b968d4a0bbb606721 | Markus Westerlind | 2016-03-19T12:02:33 | feat: Add the StreamOnce trait
This allows `BufferedStream` to be bounded by `StreamOnce` instead of
`Iterator` allowing the inner stream to indicate other errors than end of
input. `Stream` should still be used as a trait bound in parser code but
`StreamOnce` must now be used when implementing a stream.
BREAKING CHA... | diff --git a/src/combinator.rs b/src/combinator.rs
index f1ce681..8ad80b5 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1,6 +1,6 @@
use std::iter::FromIterator;
use std::marker::PhantomData;
-use primitives::{HasPosition, Info, Parser, ParseResult, ParseError, Stream, Error, Consumed};
+use primitives::{... | 3 | 37 | 32 |
4ddc4257d1e719a9f1c17a49c39f08ebf20d2999 | Markus Westerlind | 2016-03-19T13:11:34 | feat: Make Stream::uncons take &mut self
Taking streams by value was nice since it mimicked how parsers work,
however it has the unfortunate consequence that streams which contain
other streams loses ownership of the contained stream (and after end of
input don't loses ownership completely). | diff --git a/src/combinator.rs b/src/combinator.rs
index 412ebd5..f1ce681 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -35,11 +35,11 @@ impl<I> Parser for Any<I> where I: Stream
{
type Input = I;
type Output = I::Item;
- fn parse_lazy(&mut self, input: I) -> ParseResult<I::Item, I> {
+ fn ... | 3 | 98 | 96 |
f21148b3c4c5c6f10d8b6d90ce4a7925596879b3 | Markus Westerlind | 2016-02-18T20:22:57 | fix: Fix the position handling of BufferedStream | diff --git a/src/primitives.rs b/src/primitives.rs
index 1984aba..ac3b137 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -979,21 +979,24 @@ impl<I, O, P: ?Sized> Parser for Box<P>
#[cfg(feature = "buffered_stream")]
pub struct BufferedStream<'a, I>
- where I: Iterator + 'a,
+ where I: Iterator + Ha... | 1 | 24 | 15 |
9cfb9a895be34b288ee9fc9f926cd1b9c5b97b03 | Markus Westerlind | 2016-02-18T17:38:24 | feat: Separate the Position type and position method from Stream | diff --git a/benches/json.rs b/benches/json.rs
index 3861e75..83cbaab 100644
--- a/benches/json.rs
+++ b/benches/json.rs
@@ -244,7 +244,7 @@ fn bench_buffered_json(bencher: &mut ::test::Bencher) {
.and_then(|mut file| file.read_to_string(&mut data))
.unwrap();
bencher.iter(|| {
- let buffe... | 5 | 64 | 29 |
f737af27306160088188900a1cdad255b5ca58d3 | Markus Westerlind | 2016-02-17T11:22:03 | feat: Version 1.2.1 | diff --git a/Cargo.toml b/Cargo.toml
index cc7c459..85d768f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "combine"
-version = "1.2.0"
+version = "1.2.1"
authors = ["Markus Westerlind <marwes91@gmail.com>"]
description = "Parser combinators based on the Haskell library parsec." | 1 | 1 | 1 |
2682e185d11a86811cbbc9d61ca46171fe37b682 | Markus Westerlind | 2016-02-16T22:54:57 | refactor: Remove State::update
It was unused | diff --git a/src/primitives.rs b/src/primitives.rs
index 311fadb..0093352 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -445,14 +445,6 @@ impl<I> State<I>
input: input,
}
}
-
- ///Updates the `position` and `input` to be as if `item` was removed and `rest` is
- ///the remain... | 1 | 0 | 8 |
f5679dc954be093a7a0278d2311cf5a162396833 | Markus Westerlind | 2016-02-16T22:45:15 | feat(range_stream): Implement RangeStream on State | diff --git a/src/primitives.rs b/src/primitives.rs
index b2025fe..311fadb 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -237,7 +237,9 @@ impl<S: Stream> ParseError<S> {
ParseError::from_errors(position, vec![])
}
- pub fn from_errors(position: S::Position, errors: Vec<Error<S::Item, S::Ra... | 1 | 32 | 54 |
fba3f1e760505305b6a586b6ff5a53eff645e1d1 | Markus Westerlind | 2016-02-16T22:02:12 | fix: Remove the Positioner bound from Stream::Item an Stream::Range | diff --git a/src/primitives.rs b/src/primitives.rs
index 3c7fcb3..b2025fe 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -228,7 +228,7 @@ pub struct ParseError<S: Stream> {
pub errors: Vec<Error<S::Item, S::Range>>,
}
-impl<P: Positioner + Clone, S: Stream<Item = P>> ParseError<S> {
+impl<S: Stream> ... | 1 | 27 | 18 |
d9536da3848191c656978237195b95f8f925929a | Markus Westerlind | 2016-02-16T23:07:07 | refactor: Simplify some functions in primitives.rs | diff --git a/src/primitives.rs b/src/primitives.rs
index 544e306..472093b 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -245,7 +245,7 @@ impl<P: Positioner + Clone, S: Stream<Item = P>> ParseError<S> {
}
pub fn end_of_input(position: P::Position) -> ParseError<S> {
- ParseError::from_erro... | 1 | 24 | 27 |
d883ff287d71f5a340e8933ecd0e7ef706eab522 | Markus Westerlind | 2016-02-16T22:19:36 | refactor: Use split_at instead of slicing twice | diff --git a/src/primitives.rs b/src/primitives.rs
index e458e8b..544e306 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -583,7 +583,7 @@ impl<'a> RangeStream for &'a str {
let len = self.chars()
.take_while(|c| f(*c))
.fold(0, |len, c| len + c.len_utf8(... | 1 | 14 | 14 |
3f038eba9e60657bedafad5f0ebf9d41bb77a88b | Markus Westerlind | 2016-02-15T19:51:32 | style: Run rustfmt | diff --git a/benches/json.rs b/benches/json.rs
index 222cdd4..dfc8bc4 100644
--- a/benches/json.rs
+++ b/benches/json.rs
@@ -7,8 +7,10 @@ use std::io::Read;
use std::fs::File;
use std::path::Path;
-use pc::primitives::{from_iter, Consumed, Parser, ParseError, ParseResult, State, Stream, BufferedStream};
-use pc::co... | 6 | 265 | 200 |
6532884cc16307e1753584dd40b2b59e3daa6267 | Markus Westerlind | 2016-02-15T11:08:23 | fix(buffered_stream): BufferedStream no longer emits the last token after EOF | diff --git a/src/primitives.rs b/src/primitives.rs
index 3cbe9eb..e458e8b 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -948,11 +948,11 @@ impl<I> BufferedStreamInner<I>
{
fn uncons(&mut self, offset: usize) -> Result<I::Item, Error<I::Item, I::Item>> {
if offset >= self.offset {
- ... | 2 | 16 | 1 |
5f59ed5338fca36da02add5c6dd41794bd3651d7 | Scott Whittaker | 2016-01-31T03:36:33 | Fix 'succeed' typos | diff --git a/src/combinator.rs b/src/combinator.rs
index 75c3ded..fbc475d 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1334,7 +1334,7 @@ pub trait ParserExt : Parser + Sized {
}
///Parses with `self` followed by `p`
- ///Succeds if both parsers succed, otherwise fails
+ ///Succeeds if bo... | 1 | 1 | 1 |
6b505ed3127a80828c2ae314121e2bd81390a776 | Scott Whittaker | 2016-01-31T03:00:13 | Fix 'character' typos
...in some instances where it's misspelled as 'characther'. | diff --git a/src/char.rs b/src/char.rs
index 70f7905..7893a46 100644
--- a/src/char.rs
+++ b/src/char.rs
@@ -22,7 +22,7 @@ macro_rules! impl_char_parser {
}
}
-///Parses a character and succeeds if the characther is equal to `c`
+///Parses a character and succeeds if the character is equal to `c`
///
/// ```
///... | 3 | 3 | 3 |
436352bf3f2d77a74ed5f90e03d23b7d8b298ad3 | Markus | 2015-12-31T14:45:22 | Improve the documentation for `or` and `choice` with better examples | diff --git a/src/combinator.rs b/src/combinator.rs
index 7feaaeb..7d26f7c 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -202,7 +202,7 @@ impl<I, O, S, P> Parser for Choice<S, P>
}
/// Takes an array of parsers and tries to apply them each in order.
-/// Fails if all parsers fails or if an applied parser... | 1 | 20 | 3 |
5b5ef5bc4d15babd14be42074e31d5101489d1ba | Ildar Sharafutdinov | 2015-11-29T16:10:47 | Adjust look_ahead description to be more precise.
Make usage sample to show explicitly that look_ahead does not consume input. | diff --git a/src/combinator.rs b/src/combinator.rs
index 18959d8..7feaaeb 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1025,19 +1025,19 @@ impl <I, O, P> Parser for LookAhead<P>
}
}
-///look_ahead acts as `p`, however doesn't consume input
+///look_ahead acts as p but doesn't consume input on succ... | 1 | 8 | 8 |
c6c599a5b5626727242e6e953daf4c6a0b702fef | Ildar Sharafutdinov | 2015-11-29T12:50:29 | Add look_ahead combinator. | diff --git a/src/combinator.rs b/src/combinator.rs
index f0ea6a2..18959d8 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1006,6 +1006,46 @@ pub fn try<P>(p: P) -> Try<P>
Try(p)
}
+#[derive(Clone)]
+pub struct LookAhead<P>(P);
+
+impl <I, O, P> Parser for LookAhead<P>
+ where I: Stream
+ , ... | 2 | 41 | 1 |
883f466be100886a22cab9b5c83921a4e9cbd610 | Markus Westerlind | 2015-11-28T21:44:03 | Version 1.1.1 | diff --git a/Cargo.toml b/Cargo.toml
index e6f1c37..8739cbc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "combine"
-version = "1.1.0"
+version = "1.1.1"
authors = ["Markus Westerlind <marwes91@gmail.com>"]
description = "Parser combinators based on the Haskell library parsec." | 1 | 1 | 1 |
3bb29a3caf1f8233498d0402abb8d93f597238c9 | Markus Westerlind | 2015-11-28T21:40:20 | Derive Copy and Clone for EnvParser | diff --git a/src/combinator.rs b/src/combinator.rs
index e594680..f0ea6a2 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1509,6 +1509,7 @@ tuple_parser!(A, B, C, D, E, F, G, H, I, J);
tuple_parser!(A, B, C, D, E, F, G, H, I, J, K);
tuple_parser!(A, B, C, D, E, F, G, H, I, J, K, L);
+#[derive(Copy, Clone... | 1 | 1 | 0 |
5f7e98db6ae91bc37d4e2c1b3ad6d2fcb18fef3f | Markus Westerlind | 2015-11-23T11:29:35 | Version 1.1.0 | diff --git a/Cargo.toml b/Cargo.toml
index 076879d..e6f1c37 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "combine"
-version = "1.0.2"
+version = "1.1.0"
authors = ["Markus Westerlind <marwes91@gmail.com>"]
description = "Parser combinators based on the Haskell library parsec." | 1 | 1 | 1 |
37e801bb75701892ff17f26958b7d20a5969fa52 | Markus | 2015-11-20T11:15:15 | Add EnvParser (env_parser
The function `env_parser` works in the same way as the `parser` function but allows the construction of parsers from `fn (Env, State<I>) -> ParseResult<O, I>`. An implementation of this has been in both `combine-language` and `embed_lang` where it has been very useful by allowing parsers to s... | diff --git a/src/combinator.rs b/src/combinator.rs
index 7bbbfca..9b6d268 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1394,6 +1394,63 @@ tuple_parser!(A, B, C, D, E, F, G, H, I, J);
tuple_parser!(A, B, C, D, E, F, G, H, I, J, K);
tuple_parser!(A, B, C, D, E, F, G, H, I, J, K, L);
+pub struct EnvParse... | 2 | 58 | 0 |
99f301be227c3cf35d0862bd3d5059a32b2e45ff | Markus | 2015-11-20T10:22:42 | Mention LL parsing in src/lib.rs | diff --git a/src/lib.rs b/src/lib.rs
index ce72706..06b5f43 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -9,6 +9,29 @@
//!
//!# Overview
//!
+//! `combine` limits itself to creating [LL(1) parsers](https://en.wikipedia.org/wiki/LL_parser)
+//! (it is possible to opt-in to LL(k) parsing using the `try` combinator) whi... | 1 | 23 | 0 |
dc0d28bfdf7c96021a23e66a869b18692925f45c | Markus | 2015-11-20T10:22:28 | Mention that `.or` will fail if a parser fails after consuming input | diff --git a/src/combinator.rs b/src/combinator.rs
index aae0fbe..7bbbfca 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -178,8 +178,8 @@ impl <I, O, S, P> Parser for Choice<S, P>
}
}
-/// Takes an array of parsers and tries them each in turn.
-/// Fails if all parsers fails or when a parsers fails w... | 1 | 10 | 8 |
a46f52434cc3bcb96db4bdbb2415dab9ec922d56 | Markus | 2015-11-20T09:55:17 | Improve the src/lib.rs docs by rewriting some hard to understand parts | diff --git a/src/lib.rs b/src/lib.rs
index 5ab4346..ce72706 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -4,23 +4,24 @@
//! is succesful, returns a value together with the remaining input.
//! A parser combinator is a function which takes one or more parsers and returns a new parser.
//! For instance the `many` parse... | 1 | 25 | 21 |
2b8ed3c06108cc7ecb608d47b59a05400816fe8c | Markus Westerlind | 2015-10-07T15:42:52 | Fix compile error on stable rust | diff --git a/src/primitives.rs b/src/primitives.rs
index c15675f..29181b0 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -803,14 +803,16 @@ impl <I, O, P: ?Sized> Parser for Box<P>
#[cfg(feature = "buffered_stream")]
pub struct BufferedStream<'a, I>
- where I: Iterator + 'a {
+ where I: Iterator + ... | 1 | 4 | 2 |
79993c9d3e8721f88dd4aeb1487a9711efc41115 | Ingo Blechschmidt | 2015-09-29T16:36:27 | Move input definition in code example to better reflect data dependencies
The definition of the parsers doesn't depend on the input string in any way. In particular, merely building the parsers doesn't cause a parse to take place. This comment makes this clear by defining the input string only after the parsers have b... | diff --git a/src/lib.rs b/src/lib.rs
index 33c192a..5ab4346 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -29,7 +29,6 @@
//! use combine::{spaces, many1, sep_by, digit, char, Parser, ParserExt, ParseError};
//!
//! fn main() {
-//! let input = "1234, 45,78";
//! let spaces = spaces();
//! let integer = ... | 1 | 1 | 1 |
1bfe26d6453dbe89212b4809d3434f9fa0d3d761 | Markus Westerlind | 2015-09-27T00:47:38 | Implement RangeStream for SliceStream | diff --git a/src/primitives.rs b/src/primitives.rs
index f724de6..0cf6716 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -625,6 +625,27 @@ impl <'a, T> Stream for SliceStream<'a, T>
}
}
+#[cfg(feature = "range_stream")]
+impl <'a, T> RangeStream for SliceStream<'a, T>
+where T: Positioner + 'a {
+ ... | 1 | 21 | 0 |
81ce9597bcdaa18e896ca1adaf6fabc08c9fb5b2 | Markus Westerlind | 2015-09-27T00:40:39 | Change RangeStream's methods to return Self::Range instead of Range
Returning Self assumed that Self == Self::Range which would cause the SliceStream wrapper to not work | diff --git a/src/combinator.rs b/src/combinator.rs
index e5a46cf..aae0fbe 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1394,17 +1394,19 @@ tuple_parser!(A, B, C, D, E, F, G, H, I, J, K, L);
#[cfg(feature = "range_stream")]
-pub struct Range<I>(I)
- where I: RangeStream + PartialEq;
+pub struct Ran... | 2 | 41 | 22 |
07e33849e237daacf1d8a8f2c71390bd75530d2b | Markus | 2015-07-16T16:50:03 | Added a stream which allows for non-cloneable iterators to be used | diff --git a/benches/json.rs b/benches/json.rs
index e86d57c..222cdd4 100644
--- a/benches/json.rs
+++ b/benches/json.rs
@@ -7,8 +7,8 @@ use std::io::Read;
use std::fs::File;
use std::path::Path;
-use pc::primitives::{from_iter, Consumed, Parser, ParseError, ParseResult, State, Stream};
-use pc::combinator::{any, b... | 3 | 186 | 10 |
8393d8df4dc95061b0c903db548e6bc83c47bb8b | Markus Westerlind | 2015-09-16T21:12:19 | Version 1.0.1
* Adds the range_stream feature | diff --git a/Cargo.toml b/Cargo.toml
index f898ce5..29aa594 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "combine"
-version = "1.0.0"
+version = "1.0.1"
authors = ["Markus Westerlind <marwes91@gmail.com>"]
description = "Parser combinators based on the Haskell library parsec." | 1 | 1 | 1 |
a21dc9dcd79e28ca14bd3693b6690cc591ba0c6a | Markus Westerlind | 2015-09-09T19:12:18 | Fix: str::uncons_range no longer panics for ranges which are not on a char boundary | diff --git a/src/combinator.rs b/src/combinator.rs
index f2d3b1c..c222fb7 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1601,4 +1601,11 @@ mod tests {
let result = take_while(|c: char| c.is_digit(10)).parse("123abc");
assert_eq!(result, Ok(("123", "abc")));
}
+
+ #[test]
+ fn r... | 2 | 20 | 1 |
b5a7f282a100490efe00e7bd2f284c5aba179154 | Markus Westerlind | 2015-09-07T19:10:01 | Added documention for RangeStream | diff --git a/src/primitives.rs b/src/primitives.rs
index 6f48107..4c2396a 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -422,6 +422,9 @@ impl <I: Stream> State<I> {
impl <I, E> State<I>
where I: RangeStream<Item=E> + Positioner<Position=E::Position>
, E: Positioner + Clone {
+
+ ///Rem... | 1 | 13 | 2 |
0ec27bc2aa2d855f89c67ec19a48bef018ca5575 | Markus | 2015-08-20T17:46:47 | Added RangeStream primitive which allows implementation of zero copy parsers | diff --git a/src/combinator.rs b/src/combinator.rs
index dae7e6a..f2d3b1c 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -1,6 +1,6 @@
use std::iter::FromIterator;
use std::marker::PhantomData;
-use primitives::{Info, Parser, ParseResult, ParseError, Positioner, Stream, State, Error, Consumed};
+use primiti... | 2 | 262 | 2 |
df7f92eb23187c98db16afee6b050ed6284084b1 | Markus Westerlind | 2015-09-02T20:23:15 | Added an example ini parser | diff --git a/tests/ini.rs b/tests/ini.rs
new file mode 100644
index 0000000..3cf7319
--- /dev/null
+++ b/tests/ini.rs
@@ -0,0 +1,102 @@
+//! Parser example for INI files.
+extern crate combine;
+
+use std::collections::HashMap;
+
+use combine::*;
+use combine::primitives::{Error, SourcePosition, Stream};
+
+#[derive(Pa... | 1 | 102 | 0 |
ce1e5da9674b2db4351aea6afdf4d03836b5d9a1 | Markus Westerlind | 2015-09-02T19:19:06 | Move examples/date.rs to tests/date.rs so that it is run when running tests | diff --git a/examples/date.rs b/tests/date.rs
similarity index 99%
rename from examples/date.rs
rename to tests/date.rs
index 82d988f..c37b6fd 100644
--- a/examples/date.rs
+++ b/tests/date.rs
@@ -118,7 +118,8 @@ where I: Stream<Item=char> {
.parse_state(input)
}
-fn main() {
+#[test]
+fn test() {
//A ... | 1 | 2 | 1 |
012853c82cb3f470e94025b8f31fe8ab8dbaf727 | Markus Westerlind | 2015-09-02T19:18:44 | Change the end of input error to be an unexpected error instead
Just being a message was a holdover from when the unexpected variant did not hold Info | diff --git a/src/char.rs b/src/char.rs
index d3cf70a..fac60ee 100644
--- a/src/char.rs
+++ b/src/char.rs
@@ -206,7 +206,7 @@ mod tests {
let result = space()
.parse("");
assert!(result.is_err());
- assert_eq!(result.unwrap_err().errors, vec![Error::Message("End of input".into()), E... | 4 | 6 | 6 |
f12b34f948cca949d256d19c80d4b5082aa08710 | Markus | 2015-09-02T13:27:19 | Fix: expected and unexpected did not add their errors on a consumed error | diff --git a/src/combinator.rs b/src/combinator.rs
index ea469e7..bdefdbe 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -990,9 +990,20 @@ impl <I, P> Parser for Message<P>
type Input = I;
type Output = P::Output;
+
+ fn parse_state(&mut self, input: State<I>) -> ParseResult<Self::Output, I> {... | 1 | 23 | 0 |
7ae8d32a592f8042ef09fac8758ae5c483116519 | Markus Westerlind | 2015-08-28T18:03:49 | Added the sep_end_by and sep_end_by1 combinators | diff --git a/src/combinator.rs b/src/combinator.rs
index a8aef4e..ea469e7 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -554,6 +554,122 @@ pub fn sep_by1<F, P, S>(parser: P, separator: S) -> SepBy1<F, P, S>
SepBy1 { parser: parser, separator: separator, _marker: PhantomData }
}
+#[derive(Clone)]
+pu... | 2 | 118 | 0 |
169a6bb250e92f9b5003e84ced751b98543d1209 | Markus Westerlind | 2015-08-28T11:35:52 | Added the sep_by1 combinator | diff --git a/src/combinator.rs b/src/combinator.rs
index 2c661ce..a8aef4e 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -456,12 +456,57 @@ impl <F, P, S> Parser for SepBy<F, P, S>
type Input = P::Input;
type Output = F;
+
fn parse_lazy(&mut self, input: State<P::Input>) -> ParseResult<F, P:... | 2 | 66 | 12 |
2edc6917fb7a34c89a8e380f5f5908b14135c269 | Markus Westerlind | 2015-08-26T15:22:13 | Fix mention of parse_ok to refer to parse_lazy | diff --git a/src/primitives.rs b/src/primitives.rs
index 8b1b29f..3b0b93c 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -561,7 +561,7 @@ impl Positioner for u8 {
///the type `Output`.
///
///All methods have a default implementation but there needs to be at least an implementation of
-///`parse_state` or... | 1 | 1 | 1 |
e0e06c2c9f523e3900667aec649a111a339303ef | Markus Westerlind | 2015-08-21T06:44:26 | Make T: Copy for &[T] streams
As &[T] is likely to be used mainly with &[u8] it would be a gain in usability to avoid &u8 references etc. | diff --git a/src/combinator.rs b/src/combinator.rs
index bef5668..2c661ce 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -46,7 +46,7 @@ impl <I> Parser for Any<I>
/// assert_eq!(char_parser.parse("!").map(|x| x.0), Ok('!'));
/// assert!(char_parser.parse("").is_err());
/// let mut byte_parser = any();
-//... | 2 | 43 | 5 |
04c4ea21c9717be6688cfa1bd5d27483b9b0b552 | Markus Westerlind | 2015-08-26T08:06:33 | Simplified all combinator parsers
* Replaced <Type as Tratit>::AssocType with Type::AssocType
* Added the merge method to Consumed to simplify the consumed state carrying over between inputs | diff --git a/src/combinator.rs b/src/combinator.rs
index b888313..bef5668 100644
--- a/src/combinator.rs
+++ b/src/combinator.rs
@@ -11,10 +11,10 @@ macro_rules! impl_parser {
where $first: Parser $(, $ty_var : Parser<Input=<$first as Parser>::Input>)* {
type Input = <$first as Parser>::Input;
... | 2 | 104 | 107 |
ca5a4be961de53310e9cb587d1b4d924e8c4d631 | Markus | 2015-08-22T08:23:26 | Documented associated types and fields in primitives.rs
This also removes the undocumented State::as_empty method which is redundant. Use .clone() instead. | diff --git a/src/primitives.rs b/src/primitives.rs
index c3438a5..7bc43ec 100644
--- a/src/primitives.rs
+++ b/src/primitives.rs
@@ -207,7 +207,7 @@ impl <T> Consumed<T> {
}
}
///Struct which hold information about an error that occured at a specific position.
-///Can hold multiple instances of `Error` if more t... | 1 | 23 | 17 |
8a30280a121162121901f283fad5fc059fb80a0b | Markus | 2015-08-14T14:51:56 | Make unexpected errors to take Info<T, R> instead of T
This is a breaking change which I should have done a long time ago but had forgotten about. I'd expect it to break very little code though and I think only `Unexpected` not taking `Info` is a wart at the moment and sneaking this in before 1.0 is worth it. | diff --git a/src/char.rs b/src/char.rs
index f8baa6a..d3cf70a 100644
--- a/src/char.rs
+++ b/src/char.rs
@@ -150,7 +150,10 @@ impl <I> Parser for String<I>
Ok((other, rest)) => {
if c != other {
return Err(if consumed {
- let erro... | 4 | 17 | 8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.