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
b706f9d8c506f134ea5efbe8122a9dce69f2e646
Markus
2015-08-16T16:13:36
Add missing Clone bounds detected on todays nightly As mentioned in https://github.com/rust-lang/rust/pull/27641
diff --git a/src/primitives.rs b/src/primitives.rs index 38d60a5..b5733ea 100644 --- a/src/primitives.rs +++ b/src/primitives.rs @@ -210,7 +210,7 @@ pub struct ParseError<P: Stream> { pub errors: Vec<Error<P::Item, P::Range>> } -impl <P: Positioner, S: Stream<Item=P>> ParseError<S> { +impl <P: Positioner + Clon...
1
16
15
b4143a8e8f293f15b50e53ae884fa894d9d9c715
Markus
2015-08-09T19:28:23
Adds support for range errors in preparation for RangeStream This is a breaking change as it changes the type signature for errors. Info and Error has an extra parameter where they can specify a range error. ParseError now takes the stream type instead of token type as its parameter. The idea is that ParseError will l...
diff --git a/benches/json.rs b/benches/json.rs index 96e7be7..e86d57c 100644 --- a/benches/json.rs +++ b/benches/json.rs @@ -7,9 +7,9 @@ use std::io::Read; use std::fs::File; use std::path::Path; -use pc::primitives::{from_iter, Consumed, Parser, ParseError, State, Stream}; +use pc::primitives::{from_iter, Consumed...
5
186
146
3a0cf4b07baae2ac2d2a9218fe446063915e63b9
Markus
2015-07-27T05:19:19
Add missing derive Clone to Choice and AndThen
diff --git a/src/combinator.rs b/src/combinator.rs index 737f4d3..501dbac 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -141,6 +141,7 @@ pub fn token<I>(c: I::Item) -> Token<I> Token { c: c, _marker: PhantomData } } +#[derive(Clone)] pub struct Choice<S, P>(S, PhantomData<P>); impl <I, O, S, P> ...
1
2
0
664d8b9394da46542bf26f6854545acbd0266439
Markus
2015-07-24T16:32:58
Add examples to chainl1 and chainr1 combinators
diff --git a/src/combinator.rs b/src/combinator.rs index aefb587..737f4d3 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -659,6 +659,17 @@ impl <I, O, P, Op> Parser for Chainl1<P, Op> ///Parses `p` 1 or more times separated by `op` ///The value returned is the one produced by the left associative applica...
2
23
9
1e3e691ca6f1012362f3e167feeba91cc6f68b80
Markus
2015-07-17T13:37:28
Version 1.0.0-beta
diff --git a/Cargo.toml b/Cargo.toml index 9c26632..587bca8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "combine" -version = "0.7.0" +version = "1.0.0-beta" authors = ["Markus Westerlind <marwes91@gmail.com>"] -description = "Parser combinators based on the Haskell library parsec....
1
2
2
f37af099cf65f59a15408bc77592ac362ec04040
Markus
2015-07-17T13:11:40
Fix duplicate State imports not noticed in previous commit
diff --git a/src/lib.rs b/src/lib.rs index 468a153..dc4ca22 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -160,7 +160,7 @@ pub mod char; #[cfg(test)] mod tests { use super::*; - use super::primitives::{SourcePosition, State, Stream, Error, Consumed}; + use super::primitives::{SourcePosition, Stream, Error, C...
2
1
2
efc450f92608c099fad12cbd2ad477b1fa80b8c0
Markus
2015-07-17T13:23:12
Version 0.7.0
diff --git a/Cargo.toml b/Cargo.toml index 1003090..3d682e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,14 +1,16 @@ [package] name = "parser-combinators" -version = "0.6.0" +version = "0.7.0" authors = ["Markus Westerlind <marwes91@gmail.com>"] -description = "Parser combinators based on the Haskell library p...
1
4
2
e0923e86befb48c8244962bc565f485d77201eb4
Markus Westerlind
2015-07-17T12:46:03
Rexport State from lib.rs State is almost always needed so I think it warrants a rexport
diff --git a/src/lib.rs b/src/lib.rs index 88ed990..468a153 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -99,7 +99,7 @@ //!``` #[doc(inline)] -pub use primitives::{Parser, ParseError, from_iter}; +pub use primitives::{Parser, ParseError, State, from_iter}; #[doc(inline)] pub use char::{ char,
1
1
1
e0516bd165d426d8e881cf599e4b414f72b6b5fe
Markus Westerlind
2015-07-17T11:21:56
Add additional tags to crates.io
diff --git a/Cargo.toml b/Cargo.toml index c175d05..1003090 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ description = "Parser combinators based on the Haskell library parsec" repository = "https://github.com/Marwes/parser-combinators" documentation = "https://marwes.github.io/parser-combinators/parser_co...
1
1
1
d23ea9b9272738701485ece775e3a1fa9fbb7272
Markus
2015-07-16T17:39:00
Add additional tests to improve coverage of error cases
diff --git a/src/combinator.rs b/src/combinator.rs index 9cced72..7b7b906 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -187,6 +187,7 @@ impl <I, O, S, P> Parser for Choice<S, P> /// assert_eq!(parser.parse("Banana"), Ok(("Banana", ""))); /// assert_eq!(parser.parse("Orangexx"), Ok(("Orange", "xx"))); //...
2
34
11
d2599dcd0f0ef8d0bade9a2136b0ef7af4ba8972
Markus
2015-07-16T17:05:17
Allow streams to return error information As streams have no knowledge of position they just return Error<Item> instead of a full ParseError
diff --git a/src/combinator.rs b/src/combinator.rs index 79d7745..9cced72 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -71,7 +71,7 @@ fn satisfy_impl<I, P, F>(input: State<I>, predicate: &mut P, f: F) -> ParseResul Err(Consumed::Empty(f(input.position, c))) } } - ...
3
27
13
d6b1518808aa93c7caf704ab6656ab613d1e22d2
Markus
2015-07-09T20:03:03
Fix tuple parse_state not returning an error on empty parses
diff --git a/src/combinator.rs b/src/combinator.rs index 8a73531..79d7745 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -1152,7 +1152,7 @@ macro_rules! tuple_parser { type Input = Input; type Output = ($h::Output, $($id::Output),+); #[allow(non_snake_case)] - ...
1
12
1
261d680ee99c39962c0c5a00ab99c4d82f8712bb
Markus
2015-07-09T15:55:51
Version 0.6.0
diff --git a/Cargo.toml b/Cargo.toml index 48015d7..c175d05 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "parser-combinators" -version = "0.5.1" +version = "0.6.0" authors = ["Markus Westerlind <marwes91@gmail.com>"] description = "Parser combinators based on the Haskell library par...
1
1
1
b35b686d42ac8e344ce34846e021cb3c58df1ced
Markus
2015-07-07T16:37:07
Make the expected combinator call add_error recursively It assumes that not errors added in the recursive calls are inserted before currently available errors which is a fair assumption to make (but not enforced).
diff --git a/src/combinator.rs b/src/combinator.rs index c62aa7d..8a73531 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -895,6 +895,20 @@ impl <P> Parser for Expected<P> self.0.parse_lazy(input) } fn add_error(&mut self, errors: &mut ParseError<<Self::Input as Stream>::Item>) { + l...
1
31
1
71eacf3e15ff953c710601491b7566b742a8af8e
Markus
2015-06-28T18:54:18
Add an extra method to Parser which can delay the generation of errors Parsers such as `choice` and `.or` can result in the creation of several errors before they find the correct parser. The `parse_ok` and `add_error` methods are added to allow parsers to avoid allocating a vector to store the error in some cases. In...
diff --git a/benches/json.rs b/benches/json.rs index 4ba6f59..1e8a351 100644 --- a/benches/json.rs +++ b/benches/json.rs @@ -43,7 +43,7 @@ impl <I> Json<I> } fn integer_(input: State<I>) -> ParseResult<i64, I> { let (s, input) = try!(lex(many1::<String, _>(digit())) - .parse_state(input));...
5
218
112
31ff31012302563c01553181cbc0706d1846c6c1
Markus
2015-06-28T17:22:56
Minor speedup to the json parser ~5% * Uses an iterator stream instead of a raw string * Don't generate a unexpected error message in char
diff --git a/benches/json.rs b/benches/json.rs index 9a813dd..4ba6f59 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::{Parser, State, Stream}; -use pc::combinator::{any, between, many, many1, optional, parser, satisfy...
1
8
7
f1a4299883c1184026052df1d0506b19121f4785
Markus
2015-06-28T16:56:23
Do some minor improvements to the json parser example * lex now skips whitespace after parsing with p
diff --git a/benches/json.rs b/benches/json.rs index 666e0a8..9a813dd 100644 --- a/benches/json.rs +++ b/benches/json.rs @@ -8,7 +8,7 @@ use std::fs::File; use std::path::Path; use pc::primitives::{Parser, State, Stream}; -use pc::combinator::{any, between, many, many1, optional, parser, satisfy, sep_by, unexpected...
1
54
38
7eba2a6bf8f1ade39ff93911bd68c6dee5baa785
Markus
2015-06-15T16:28:27
Version 0.5.1
diff --git a/Cargo.toml b/Cargo.toml index eeb02fc..48015d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "parser-combinators" -version = "0.5.0" +version = "0.5.1" authors = ["Markus Westerlind <marwes91@gmail.com>"] description = "Parser combinators based on the Haskell library par...
1
1
1
7f86f3b3d7079590b6eb258a7bf8a66c4d845b19
Markus
2015-06-15T16:27:49
Fixed the bounds on the StdError impl and Positioner trait
diff --git a/src/lib.rs b/src/lib.rs index 0f8e146..63e784f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -412,4 +412,26 @@ r" assert_eq!(parser.parse("Fig123"), Ok(("Fig", "123"))); assert_eq!(parser.parse("GrapeApple"), Ok(("Grape", "Apple"))); } + + #[test] + fn std_error() { + use ...
2
35
5
af8d52753aaf258e7208437f9ded7b845fb0a19a
Markus Westerlind
2015-06-08T11:11:50
Version 0.5.0 * Tuples allow for easy sequencing of parsers * Generalized positioning allowing for more generic parsers
diff --git a/Cargo.toml b/Cargo.toml index b037a04..eeb02fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "parser-combinators" -version = "0.4.0" +version = "0.5.0" authors = ["Markus Westerlind <marwes91@gmail.com>"] description = "Parser combinators based on the Haskell library par...
1
1
1
cf70da34403ca14211878ab339f1e6b37edcee8c
Markus Westerlind
2015-06-05T09:40:56
Document Info and IteratorStream
diff --git a/src/primitives.rs b/src/primitives.rs index 08682f9..3bbd0e0 100644 --- a/src/primitives.rs +++ b/src/primitives.rs @@ -24,6 +24,10 @@ impl fmt::Display for BytePosition { } } +///Enum holding error information +///As there is implementations of `From` for `T: Positioner`, `String` and `&'static st...
1
6
0
bdf29d4082fafa11f7a7674e6e8c724204ffa6b1
Markus Westerlind
2015-06-05T09:34:11
Removed a few bounds from Positioner
diff --git a/src/combinator.rs b/src/combinator.rs index 503290d..d562545 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -90,13 +90,15 @@ pub fn satisfy<I, P>(predicate: P) -> Satisfy<I, P> #[derive(Clone)] pub struct Token<I> - where I: Stream { + where I: Stream + , I::Item: PartialEq { ...
2
8
5
a4af21ea6d75f076ed67dff2b18687a5bb174d16
Markus Westerlind
2015-06-05T09:19:22
Documented the Positioner trait
diff --git a/src/primitives.rs b/src/primitives.rs index 05cff97..363c22c 100644 --- a/src/primitives.rs +++ b/src/primitives.rs @@ -352,6 +352,8 @@ impl <I: Stream> State<I> { ///successful or not. ///`O` is the type that is output on success ///`I` is the specific stream type used in the parser +///`T` is the item...
1
7
0
a11abf5dda1b8afb130b3b7517168e9e432a6c94
Markus Westerlind
2015-06-02T22:06:03
Remove redundant declarations, uncons_char and impl SourcePositon
diff --git a/src/char.rs b/src/char.rs index b729444..35486db 100644 --- a/src/char.rs +++ b/src/char.rs @@ -145,7 +145,7 @@ impl <I> Parser for String<I> let start = input.position; let mut consumed = false; for c in self.0.chars() { - match input.uncons_char() { + matc...
3
8
24
19a26edd37aad987c9404a6ad4abe9bd09723a57
Markus
2015-05-26T09:30:19
Made `satisfy` generic over the Input::Item and added `token` `token` is a more general version of char but there seems to be some issues with type inference so char is left for convenience
diff --git a/benches/json.rs b/benches/json.rs index c34e8ef..666e0a8 100644 --- a/benches/json.rs +++ b/benches/json.rs @@ -7,9 +7,9 @@ use std::io::Read; use std::fs::File; use std::path::Path; -use pc::primitives::{Parser, State, Stream, ParseResult}; -use pc::combinator::{between, many, many1, optional, parser,...
4
102
78
6faee8f4ef7f02dbf4be5061b0713e38dbff08ed
Markus
2015-05-26T09:07:42
Generalize Error and Info to take tokens instead of chars
diff --git a/src/combinator.rs b/src/combinator.rs index d406733..7feb39c 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -99,7 +99,8 @@ pub fn choice<S, P>(ps: S) -> Choice<S, P> } #[derive(Clone)] -pub struct Unexpected<I>(Info, PhantomData<fn (I) -> I>); +pub struct Unexpected<I>(Info<I::Item>, Phantom...
3
44
41
24c9554e5bf1da91d6fa4b04e7330589d2e8a3d7
Markus
2015-05-26T08:51:26
Replaced `any_char` with the more general `any` parser
diff --git a/src/char.rs b/src/char.rs index 39df636..61fbf65 100644 --- a/src/char.rs +++ b/src/char.rs @@ -20,35 +20,6 @@ macro_rules! impl_char_parser { } } -#[derive(Clone)] -pub struct AnyChar<I>(PhantomData<fn (I) -> I>); - -impl <I> Parser for AnyChar<I> - where I: Stream<Item=char> { - type Input = I;...
3
32
30
4dd46bf0a75a9b54e5616bc4e37e7395dec95f0d
Markus
2015-05-26T08:50:45
Added Positioner for u8
diff --git a/src/primitives.rs b/src/primitives.rs index dd6ccc4..eb3a47e 100644 --- a/src/primitives.rs +++ b/src/primitives.rs @@ -2,7 +2,7 @@ use std::fmt; use std::error::Error as StdError; use std::any::Any; -///Struct which represents the positions in the source file +///Struct which represents a position in ...
1
26
1
1e500c6efa1dab4b3e5fc883900a401228053d89
Markus Westerlind
2015-01-26T19:04:11
Added Positioner trait
diff --git a/src/char.rs b/src/char.rs index 498ba7a..39df636 100644 --- a/src/char.rs +++ b/src/char.rs @@ -1,7 +1,9 @@ -use primitives::{Consumed, Parser, ParseError, ParseResult, Error, State, Stream}; +use primitives::{Consumed, Parser, ParseError, Error, State, Stream}; use combinator::{Expected, skip_many, SkipM...
4
97
61
944bbf63f05ce0b2824a3f208bf1accaeaf4d231
Markus Westerlind
2015-06-05T09:02:27
Fix compilation of benches/json.rs
diff --git a/benches/json.rs b/benches/json.rs index ce84334..c34e8ef 100644 --- a/benches/json.rs +++ b/benches/json.rs @@ -104,7 +104,7 @@ impl <I> Json<I> } fn object(input: State<I>) -> ParseResult<Value, I> { let field = (lex(parser(Json::<I>::string)), lex(char(':')), lex(parser(Json::<I>::valu...
1
1
1
098a0503f548ac5eb420cc57a1677e6c9fe2dd74
Markus Westerlind
2015-06-05T08:01:38
Revert accidental removal of the fix for returning closures
diff --git a/src/lib.rs b/src/lib.rs index f0a40f5..b55906b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -293,11 +293,12 @@ Expected 'identifier', 'integer', '[' or '(' } fn term(input: State<&str>) -> ParseResult<Expr, &str> { - + fn times(l: Expr, r: Expr) -> Expr { Expr::Times(Box::new(l), Box::new...
1
6
4
f8c15a295104ca2d743a8a2b57d695c14e872727
Markus
2015-05-29T08:52:42
Added Parser implementations for tuples allowing easy sequencing of parsers
diff --git a/benches/json.rs b/benches/json.rs index 48fdc92..ce84334 100644 --- a/benches/json.rs +++ b/benches/json.rs @@ -103,9 +103,8 @@ impl <I> Json<I> .parse_state(input) } fn object(input: State<I>) -> ParseResult<Value, I> { - let field = lex(parser(Json::<I>::string)) - ...
3
78
53
3c5fa41a4d601faa2a8d4f99134b615e25f9251d
Markus
2015-06-01T09:23:29
Added the ability to turn a parser into an iterator Can be useful to emulate the many parser while avoiding the need to allocate a new Vec/String/etc each time the parser is called.
diff --git a/src/combinator.rs b/src/combinator.rs index 3fbc815..da8865a 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -152,7 +152,7 @@ pub fn not_followed_by<P>(parser: P) -> NotFollowedBy<P> .or(value(()))) } -struct Iter<P: Parser> { +pub struct Iter<P: Parser> { parser: P, ...
1
30
4
b95554b2b10306d3dba392410a8b723e5d0947b7
Markus
2015-05-29T09:42:26
Fix the rustc bug where returning closures from closures does not work
diff --git a/src/combinator.rs b/src/combinator.rs index caab27a..3fbc815 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -950,8 +950,10 @@ mod tests { #[test] fn chainr1_test() { + fn pow(l: i32, r: i32) -> i32 { l.pow(r as u32) } + let number = digit().map(|c| c.to_digit(10).unwr...
2
9
5
c77a7095f9275b36ac748fafcaae894e97f544e8
Markus
2015-05-22T12:00:30
Version 0.4.0 [breaking-change] * any_char returns a parser instead of being just a parser function * Replaced Cow<'static, str> with the new Info struct * chainl1 and chainr1 does no longer need to Box function returned from the operator parser
diff --git a/Cargo.toml b/Cargo.toml index 86e1f18..b037a04 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "parser-combinators" -version = "0.3.2" +version = "0.4.0" authors = ["Markus Westerlind <marwes91@gmail.com>"] description = "Parser combinators based on the Haskell library par...
1
1
1
3d0e7860810a417ea77fa785ff28d83c37a7738c
Markus
2015-05-22T11:56:54
Added an unexpected message to the error generated by the string parser
diff --git a/src/char.rs b/src/char.rs index ce3e593..498ba7a 100644 --- a/src/char.rs +++ b/src/char.rs @@ -234,7 +234,8 @@ impl <I> Parser for String<I> match input.uncons_char() { Ok((other, rest)) => { if c != other { - let error = ParseError...
1
12
2
0e7a8452bbf20e86faa546ad6f51b1041ef838a6
Markus
2015-05-19T14:16:52
Fix uses of PhantomData where the variance were wrong Many parsers used PhantomData as PhantomData<I> (acting like they contained I) when they should just act as types which contain a function (PhantomData<fn (I) -> I>)
diff --git a/src/char.rs b/src/char.rs index ff48d4d..ce3e593 100644 --- a/src/char.rs +++ b/src/char.rs @@ -5,7 +5,7 @@ use std::marker::PhantomData; macro_rules! impl_char_parser { ($name: ident ($($ty_var: ident),*), $inner_type: ty) => { #[derive(Clone)] - pub struct $name<I $(,$ty_var)*>($inner_type,...
2
7
7
0bfe23289ca4067a82464a66fea931c5e618534d
Markus
2015-05-19T14:02:33
Make any_char a proper parser instead of a free function Any code using it should replace parser(any_char) -> any_char()
diff --git a/benches/json.rs b/benches/json.rs index da4ccab..48fdc92 100644 --- a/benches/json.rs +++ b/benches/json.rs @@ -78,7 +78,7 @@ impl <I> Json<I> } fn char(input: State<I>) -> ParseResult<char, I> { - let (c, input) = try!(parser(any_char).parse_state(input)); + let (c, input) = try!...
2
26
3
4ee9d86d9c0519b6164d1f9cf597fa946ba79654
Markus
2015-05-19T11:13:26
Use more specific parsers than satisfy and string wherever possible string(".") -> char('.') satisfy(|c| c.is_digit(10)) -> digit() etc...
diff --git a/benches/json.rs b/benches/json.rs index e75bcca..da4ccab 100644 --- a/benches/json.rs +++ b/benches/json.rs @@ -9,7 +9,7 @@ use std::path::Path; use pc::primitives::{Parser, State, Stream, ParseResult}; use pc::combinator::{between, many, many1, optional, parser, sep_by, unexpected, With, ParserExt}; -...
5
50
50
3c66ee0e986c28757c862d6785bccdb974cb7548
Markus
2015-05-19T10:47:01
Added char parser
diff --git a/src/char.rs b/src/char.rs index 3d33665..cb635ac 100644 --- a/src/char.rs +++ b/src/char.rs @@ -62,6 +62,46 @@ pub fn satisfy<I, Pred>(pred: Pred) -> Satisfy<I, Pred> Satisfy { pred: pred, _marker: PhantomData } } +#[derive(Clone)] +pub struct Char<I> { c: char, _marker: PhantomData<I> } + +impl <I...
2
41
0
a605027e302dd88dd62b795e9916d77493674ef7
Markus
2015-05-19T10:36:43
Added Info which holds error information It fills the same role as the previous Cow<'static str> type but also allows the message to be a character. This could later be generalized so that the Info enum can hold an arbitrary token of the stream.
diff --git a/src/combinator.rs b/src/combinator.rs index 8a4884f..0ad4dcf 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -1,7 +1,6 @@ use std::iter::FromIterator; -use std::borrow::Cow; use std::marker::PhantomData; -use primitives::{Parser, ParseResult, ParseError, Stream, State, Error, Consumed}; +use pr...
2
58
13
5ed9be52b6fd29028fa8fc14a73bead8aee326f6
Markus
2015-05-19T10:04:42
Change the chainl1 and chainr1 parsers to avoid boxing the function
diff --git a/src/combinator.rs b/src/combinator.rs index 4cd7046..8a4884f 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -484,10 +484,11 @@ pub fn between<I, L, R, P>(open: L, close: R, parser: P) -> Between<L, R, P> #[derive(Clone)] pub struct Chainl1<P, Op>(P, Op); -impl <'a, I, O, P, Op> Parser for Ch...
2
18
17
b99fbd2b538661c73c412fe935d460d4d0733fa2
Markus Westerlind
2015-05-16T08:31:27
Version 0.3.2
diff --git a/Cargo.toml b/Cargo.toml index 6d17923..86e1f18 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "parser-combinators" -version = "0.3.1" +version = "0.3.2" authors = ["Markus Westerlind <marwes91@gmail.com>"] description = "Parser combinators based on the Haskell library par...
1
1
1
ded6c19629c9e710178f27d84e12e294e1a878b3
Hugo Duncan
2015-05-15T20:43:20
Make Error satisfy Send When using parser-combinators with channels and threads, it is useful to be able to send errors. This changes Error so that it satisfies Send.
diff --git a/src/primitives.rs b/src/primitives.rs index bfa9451..e4068d1 100644 --- a/src/primitives.rs +++ b/src/primitives.rs @@ -34,7 +34,7 @@ pub enum Error { ///Generic message Message(Cow<'static, str>), ///Variant for containing other types of errors - Other(Box<StdError>) + Other(Box<StdEr...
1
2
2
cc394fc77aeef0d777c4bbb9b54e833d13c54d73
Markus
2015-05-01T10:19:33
Bump version to 0.3.1
diff --git a/Cargo.toml b/Cargo.toml index 81f84c9..6d17923 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "parser-combinators" -version = "0.3.0" +version = "0.3.1" authors = ["Markus Westerlind <marwes91@gmail.com>"] description = "Parser combinators based on the Haskell library par...
1
1
1
6222a6bdacc26f2682f0981815eef91c13b8abfd
Markus
2015-05-01T09:46:15
Generalized the json parser to work with an type of input
diff --git a/benches/json.rs b/benches/json.rs index ec2dee4..e75bcca 100644 --- a/benches/json.rs +++ b/benches/json.rs @@ -7,7 +7,7 @@ use std::io::Read; use std::fs::File; use std::path::Path; -use pc::primitives::{Parser, State, ParseResult}; +use pc::primitives::{Parser, State, Stream, ParseResult}; use pc::c...
1
101
92
2b420b3bff975438e923484dbbb24d0fb624b343
Markus
2015-05-01T08:56:29
Suppress unconditional_recursion warnings
diff --git a/benches/json.rs b/benches/json.rs index a44b549..ec2dee4 100644 --- a/benches/json.rs +++ b/benches/json.rs @@ -8,7 +8,7 @@ use std::fs::File; use std::path::Path; use pc::primitives::{Parser, State, ParseResult}; -use pc::combinator::{between, many, many1, optional, parser, sep_by, unexpected, value, ...
2
4
2
9e70ed043d0868956429ffe0239deeaa9741b162
Markus
2015-05-01T08:42:10
Added doctests to all of the ParserExt methods
diff --git a/src/combinator.rs b/src/combinator.rs index fdae9b4..be333bb 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -738,6 +738,18 @@ pub trait ParserExt : Parser + Sized { ///Discards the value of the `self` parser and returns the value of `p` ///Fails if any of the parsers fails + /// +...
3
126
9
86013baa465725b8f8a86e72ee3c4090593b08db
Markus
2015-04-30T13:23:23
Add `and_then` combinator `and_then` is intended to mirror the `and_then` function on `Result`. For parsers it can be used to a call a potentially failing operation on a parsed value easily.
diff --git a/src/combinator.rs b/src/combinator.rs index fdae9b4..3b8bdae 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -733,6 +733,25 @@ impl <P> Parser for Expected<P> } } +pub struct AndThen<P, F>(P, F); +impl <P, F, O, E> Parser for AndThen<P, F> + where P: Parser + , F: FnMut(P::Outpu...
1
38
0
f99752f0e149fc8c8d729ced0a1f31ef3c65285c
Markus
2015-04-30T13:21:01
Add a variant to Error which can hold any kind of error
diff --git a/src/primitives.rs b/src/primitives.rs index 02eeb5d..2715468 100644 --- a/src/primitives.rs +++ b/src/primitives.rs @@ -25,14 +25,33 @@ impl SourcePosition { } ///Enum used to store information about an error that has occured -#[derive(Clone, PartialEq, Debug)] +#[derive(Debug)] pub enum Error { ...
1
24
4
564db55c46462052df1be0c009da400fd9ec605e
Markus Westerlind
2015-04-19T18:35:05
Optimized the character parser in the json benchmark
diff --git a/benches/json.rs b/benches/json.rs index 338bd71..a44b549 100644 --- a/benches/json.rs +++ b/benches/json.rs @@ -8,8 +8,8 @@ use std::fs::File; use std::path::Path; use pc::primitives::{Parser, State, ParseResult}; -use pc::combinator::{between, many, many1, optional, parser, sep_by, With, ParserExt}; -...
1
23
21
17862c8a455357b35b7d18fdfb9cf50d776e0fa7
Markus Westerlind
2015-04-16T20:52:11
Bump version to 0.3.0
diff --git a/Cargo.toml b/Cargo.toml index f5e42e1..81f84c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "parser-combinators" -version = "0.2.6" +version = "0.3.0" authors = ["Markus Westerlind <marwes91@gmail.com>"] description = "Parser combinators based on the Haskell library par...
1
1
1
403149eb798c226c782a28da4b37e3b1b362c4a5
Markus Westerlind
2015-04-16T20:40:11
Added a brief overview to the toplevel docs Notably it adds a mention to `ParserExt` to prevent it from being missed when reading the docs
diff --git a/src/lib.rs b/src/lib.rs index 7aae3ad..c6ffa34 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,12 +1,28 @@ -//!This crate contains parser combinators, roughly based on the Haskell library [parsec](http://hackage.haskell.org/package/parsec). +//! This crate contains parser combinators, roughly based on the H...
1
30
14
e7630b3582bc5a986c5258f0f8ead9550e17ec21
Markus Westerlind
2015-04-16T20:02:53
Added missing documentation for choice
diff --git a/src/combinator.rs b/src/combinator.rs index a2d5a2d..fdae9b4 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -48,6 +48,20 @@ 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 wi...
1
14
0
9396703350fa5b3da4ae42d7e7b9b798032208b3
Markus Westerlind
2015-04-04T12:11:53
Made sure that cargo test can be run on the beta compiler This forced the removal of the benchmark for expressions as it was in the lib.rs but as it was the only thing preventing the removal of the test feature gate it is a small price to pay. benches/json.rs was also made to compile on the nightly compiler
diff --git a/benches/json.rs b/benches/json.rs index 22cfb5e..338bd71 100644 --- a/benches/json.rs +++ b/benches/json.rs @@ -1,15 +1,14 @@ -#![feature(unicode, path, test, io, fs)] -extern crate "parser-combinators" as pc; +#![feature(test)] +extern crate parser_combinators as pc; extern crate test; use std::collec...
2
17
45
65f3d985233c4262d785f6ec5276b8a2360f028a
Markus Westerlind
2015-04-04T11:55:02
Replaced the choice_slice and choice_vec parsers with choice Using convert::AsMut both cases are handled by the choice parser
diff --git a/src/combinator.rs b/src/combinator.rs index f3bed6f..a2d5a2d 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -19,17 +19,17 @@ macro_rules! impl_parser { } } -pub struct ChoiceSlice<'a, P>(&'a mut [P]) - where P: Parser + 'a; +pub struct Choice<S, P>(S, PhantomData<P>); -impl <'a, I, O, P...
2
11
29
6398c2e0d7ae240df5cc0ef6d363ed310d552f1d
Markus Westerlind
2015-04-03T08:53:32
Bump version to 0.2.6
diff --git a/Cargo.toml b/Cargo.toml index 2a50252..f5e42e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "parser-combinators" -version = "0.2.5" +version = "0.2.6" authors = ["Markus Westerlind <marwes91@gmail.com>"] description = "Parser combinators based on the Haskell library par...
1
1
1
2a67cf2efc6c77d883129f174a592c886aec3385
Markus Westerlind
2015-04-03T08:48:59
Replaced IntoCow with Into allowing for the removal of the into_cow feature gate
diff --git a/src/char.rs b/src/char.rs index 54bb876..3d33665 100644 --- a/src/char.rs +++ b/src/char.rs @@ -1,7 +1,6 @@ use primitives::{Consumed, Parser, ParseError, ParseResult, Error, State, Stream}; use combinator::{Expected, skip_many, SkipMany, ParserExt, With}; use std::marker::PhantomData; -use std::borrow:...
4
20
28
c3c54a80c93598f808e0f699e9d543924497b154
Markus Westerlind
2015-04-03T08:36:07
Fix for the new coherence rules which prevents the blank impl for Stream Current fix is to wrap iterators in a newtype using the `from_iter` function.
diff --git a/src/combinator.rs b/src/combinator.rs index b62b835..deb7085 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -829,7 +829,6 @@ mod tests { use super::*; use primitives::Parser; use char::{digit, string}; - use std::num::Int; #[test] fn chainr1_test() { diff --git a/sr...
3
27
18
f3d5456de53f920d6de0548bcebb01e5534660d0
Markus Westerlind
2015-03-29T16:33:14
Modify the code to not require the collections and slice_patterns feature gates
diff --git a/src/combinator.rs b/src/combinator.rs index 1b74ca7..b62b835 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -62,7 +62,7 @@ impl <I, O, P> Parser for ChoiceVec<P> type Input = I; type Output = O; fn parse_state(&mut self, input: State<I>) -> ParseResult<O, I> { - choice_slic...
3
7
5
a46e45ba82a5d7f3ed46205951944d086d1b99b0
Hugo Duncan
2015-03-28T22:52:59
Update for latest rustc nightly Adds collections and slice_patterns features.
diff --git a/src/lib.rs b/src/lib.rs index 2155eee..7ed2fa3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,5 @@ #![unstable] -#![feature(into_cow)] +#![feature(collections, into_cow, slice_patterns)] #![cfg_attr(test, feature(core, test))] //!This crate contains parser combinators, roughly based on the Haskel...
1
1
1
612d28a3b56fc13a9cef70e3a135d33e747e9e3c
Markus Westerlind
2015-03-27T22:32:05
Bump version to 0.2.5
diff --git a/Cargo.toml b/Cargo.toml index 38d6eca..2a50252 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "parser-combinators" -version = "0.2.4" +version = "0.2.5" authors = ["Markus Westerlind <marwes91@gmail.com>"] description = "Parser combinators based on the Haskell library par...
1
1
1
3a75699a56e0737e6169f468c53fa83972ca3451
Markus Westerlind
2015-03-27T22:26:20
Fix rustc regression where `expr as type` fails to unify `expr` to `type`
diff --git a/src/char.rs b/src/char.rs index 8c84891..54bb876 100644 --- a/src/char.rs +++ b/src/char.rs @@ -75,7 +75,8 @@ impl_char_parser! { Space(), Expected<Satisfy<I, fn (char) -> bool>> } ///Parses whitespace pub fn space<I>() -> Space<I> where I: Stream<Item=char> { - Space(satisfy(char::is_whitespace ...
3
38
26
380bec32e42582d448163a9c27257828bd2f205f
Markus Westerlind
2015-03-26T11:55:05
Replace unnecessary use of char_indices() by simply using chars()
diff --git a/src/primitives.rs b/src/primitives.rs index c7501eb..febe84b 100644 --- a/src/primitives.rs +++ b/src/primitives.rs @@ -276,8 +276,8 @@ impl <I: Iterator + Clone> Stream for I { impl <'a> Stream for &'a str { type Item = char; fn uncons(self) -> Result<(char, &'a str), ()> { - match self....
1
2
2
e31234c387b78513b5e41ba12e8e06c6f6f3d818
Markus Westerlind
2015-03-26T09:21:40
Fix broken link to docs, bump version to 0.2.4
diff --git a/Cargo.toml b/Cargo.toml index 045132b..38d6eca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,13 +1,13 @@ [package] name = "parser-combinators" -version = "0.2.3" +version = "0.2.4" authors = ["Markus Westerlind <marwes91@gmail.com>"] description = "Parser combinators based on the Haskell library p...
1
2
2
f1733ae6a77f328e6a6a27c33ed5863bcb62e4ed
Markus Westerlind
2015-03-26T09:11:35
Bump version to 0.2.3
diff --git a/Cargo.toml b/Cargo.toml index ef6ca79..045132b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "parser-combinators" -version = "0.2.2" +version = "0.2.3" authors = ["Markus Westerlind <marwes91@gmail.com>"] description = "Parser combinators based on the Haskell library par...
1
1
1
737ea17e2d8913ca02cb40ede1708964dad61484
Markus Westerlind
2015-03-26T08:49:23
Update library to work with newest nightly * Add `into_cow` feature gate * Replace hyphen with underscore for crate name * Replace `slice_shift_char` with the `CharIndices` iterator
diff --git a/Cargo.toml b/Cargo.toml index c032e3a..ef6ca79 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,5 +15,5 @@ license = "MIT" [lib] -name = "parser-combinators" +name = "parser_combinators" path = "src/lib.rs" diff --git a/src/char.rs b/src/char.rs index 917a279..8c84891 100644 --- a/src/char.rs +++ b/sr...
5
25
23
bfc9b741477b8ec4810f922e325f57868db11caf
Hawk Weisman
2015-03-20T21:44:47
Fix incorrect documentation for `lower` Pretty sure the `lower()` parser parses a lowercase letter. :)
diff --git a/src/char.rs b/src/char.rs index 84c02e5..917a279 100644 --- a/src/char.rs +++ b/src/char.rs @@ -120,7 +120,7 @@ pub fn upper<I>() -> Upper<I> } impl_char_parser! { Lower(), Expected<Satisfy<I, fn (char) -> bool>> } -///Parses an uppercase letter +///Parses an lowercase letter pub fn lower<I>() -> Lowe...
1
1
1
b5074b4c309ffd21fba297b6bc8f2b73d3d6e8a1
Markus Westerlind
2015-03-19T19:23:59
Fix CharExt being replaced by direct methods on char
diff --git a/src/char.rs b/src/char.rs index 58c3622..84c02e5 100644 --- a/src/char.rs +++ b/src/char.rs @@ -75,7 +75,7 @@ impl_char_parser! { Space(), Expected<Satisfy<I, fn (char) -> bool>> } ///Parses whitespace pub fn space<I>() -> Space<I> where I: Stream<Item=char> { - Space(satisfy(CharExt::is_whitespa...
1
1
1
fb2814018c3bb506aeea4f285b79507efa5e35e3
Markus Westerlind
2015-03-16T18:28:31
Replace casts to function pointers with the parser function
diff --git a/src/combinator.rs b/src/combinator.rs index 8156426..8d4b73b 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -374,16 +374,43 @@ impl <'a, I: Stream, O> Parser for FnMut(State<I>) -> ParseResult<O, I> + 'a { } } #[derive(Clone)] -pub struct FnParser<I, O, F>(F, PhantomData<(I, O)>); +pub st...
2
35
7
63f1b48abf4d1c30a1688665851a998343ec2fe8
Markus Westerlind
2015-03-16T17:13:58
Made the message parser take a Cow<'string, str> instead of String Should make it a bit more efficient for static messages
diff --git a/src/combinator.rs b/src/combinator.rs index acdb515..8156426 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -614,7 +614,7 @@ impl <I, P1, P2> Parser for Skip<P1, P2> } #[derive(Clone)] -pub struct Message<P>(P, String) where P: Parser; +pub struct Message<P>(P, Cow<'static, str>) where P: Pa...
2
5
4
a81ccaa88e2413b21af97a7d3be3018d49bca404
Markus Westerlind
2015-03-08T20:59:55
Bump version to 0.2.1
diff --git a/Cargo.toml b/Cargo.toml index 1c648c8..a44a0d2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "parser-combinators" -version = "0.2.0" +version = "0.2.1" authors = ["Markus Westerlind <marwes91@gmail.com>"] description = "Parser combinators based on the Haskell library par...
1
1
1
959e9dc6a14e721bfb583873eb0bb26ec59fb935
Markus Westerlind
2015-03-08T20:59:27
Updated rustc rustc 1.0.0-nightly (2fc8b1e7c 2015-03-07) (built 2015-03-08)
diff --git a/src/combinator.rs b/src/combinator.rs index 8b2657a..acdb515 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -799,7 +799,7 @@ mod tests { #[test] fn chainr1_test() { let number = digit().map(|c| c.to_digit(10).unwrap() as i32); - let mut parser = chainr1(number, string("...
2
2
2
0a9c3954e118d4a4460abe43620c96aa9589da03
Markus Westerlind
2015-02-21T21:40:37
Added impl of std::error::Error for ParseError
diff --git a/src/lib.rs b/src/lib.rs index 4fd2d6e..71ca0c9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,6 @@ #![unstable] -#![feature(collections, unicode)] -#![cfg_attr(test, feature(core, test))] +#![feature(core, collections, unicode)] +#![cfg_attr(test, feature(test))] //!This crate contains parser comb...
2
7
4
7201c4dcaec84bfab50173b017726e3a644b94a4
Markus Westerlind
2015-02-20T20:28:13
Updated project to compile with newest nightly Added PhantomData where needed Fixed IntoCow declarations Replaced CowString -> Cow Use new io in benches/json.rs 1 breaking change where FnParser is replaced with the 'parser' function since FnParser now holds an extra PhantomData field
diff --git a/benches/json.rs b/benches/json.rs index 795fe82..22cfb5e 100644 --- a/benches/json.rs +++ b/benches/json.rs @@ -1,9 +1,12 @@ -#![feature(core, unicode, path, test)] +#![feature(unicode, path, test, io, fs)] extern crate "parser-combinators" as pc; extern crate test; use std::collections::HashMap; use...
5
56
68
5294a24c9842685f17292b6ee19db39fe14d803e
Markus Westerlind
2015-02-11T19:55:58
Update Cargo.toml to 0.2.0
diff --git a/Cargo.toml b/Cargo.toml index b700ec9..1c648c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "parser-combinators" -version = "0.1.0" +version = "0.2.0" authors = ["Markus Westerlind <marwes91@gmail.com>"] description = "Parser combinators based on the Haskell library par...
1
1
1
53af10802bcd249bf88dd8f0f87c0ceaafa2728e
Markus Westerlind
2015-02-11T19:55:15
Added docs for skip_many and skip_many1
diff --git a/src/combinator.rs b/src/combinator.rs index a09855d..c219841 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -249,6 +249,17 @@ impl <F, P> Parser for Many1<F, P> } impl_parser!{ SkipMany(P,), Map<Many<Vec<()>, Map<P, fn (<P as Parser>::Output)>>, fn (Vec<()>)> } +///Parses `p` zero or more ti...
2
24
0
5e0030951851bd060c82338e32bf9c241b70ca87
Markus Westerlind
2015-02-08T19:41:17
Fix accidentally breaking the build
diff --git a/src/char.rs b/src/char.rs index c55ddd1..4cde711 100644 --- a/src/char.rs +++ b/src/char.rs @@ -176,15 +176,17 @@ impl <I> Parser for String<I> return Err(if consumed { Consumed::Consumed(error) } else { Consumed::Empty(error) }) } consumed...
1
7
5
8db765cac78a7003488260f75b5f8ac19e67664e
Markus Westerlind
2015-02-08T18:16:08
Fix bug in new strings implementation regarding the consumed state
diff --git a/src/char.rs b/src/char.rs index 9a8f2f6..c55ddd1 100644 --- a/src/char.rs +++ b/src/char.rs @@ -165,23 +165,22 @@ impl <I> Parser for String<I> where I: Stream<Item=char> { type Input = I; type Output = &'static str; - fn parse_state(&mut self, input: State<I>) -> ParseResult<&'static str...
1
17
11
69a120d7a2f2c03802152c05ddaf0171f46f8413
Markus Westerlind
2015-02-08T17:32:45
Reworked the string parser Renamed StringP -> String. The parser only allows for &'static str now. The reason for this is that any other string type could not easily be turned into a parse error.
diff --git a/src/char.rs b/src/char.rs index cc0f891..9a8f2f6 100644 --- a/src/char.rs +++ b/src/char.rs @@ -1,5 +1,5 @@ use primitives::{Consumed, Parser, ParseError, ParseResult, Error, State, Stream}; -use combinator::{Expected, Many, skip_many, SkipMany, Map, ParserExt, With}; +use combinator::{Expected, skip_many...
1
14
14
40e1bc7835fd1a8d85ec0dc76f48efcf42d3a805
Markus Westerlind
2015-02-08T17:09:34
Use skip_many in the spaces combinator
diff --git a/src/char.rs b/src/char.rs index 5b22130..cc0f891 100644 --- a/src/char.rs +++ b/src/char.rs @@ -1,5 +1,5 @@ use primitives::{Consumed, Parser, ParseError, ParseResult, Error, State, Stream}; -use combinator::{Expected, many, Many, Map, ParserExt, With}; +use combinator::{Expected, Many, skip_many, SkipMan...
1
3
3
5dd106ae336c898654fa5d94e5a5193fa7955d8e
Markus Westerlind
2015-02-03T21:57:41
Added skip_many and skip_many1 parsers
diff --git a/src/combinator.rs b/src/combinator.rs index 2a62aff..a09855d 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -248,6 +248,20 @@ impl <F, P> Parser for Many1<F, P> } } +impl_parser!{ SkipMany(P,), Map<Many<Vec<()>, Map<P, fn (<P as Parser>::Output)>>, fn (Vec<()>)> } +pub fn skip_many<P>(p:...
1
14
0
3bc873941a37834cc45f9d33981bfef3b1407028
jxv
2015-02-05T20:06:27
Added choice_vec and choice_slice parsers
diff --git a/src/combinator.rs b/src/combinator.rs index f98be2c..2a62aff 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -19,6 +19,58 @@ macro_rules! impl_parser { } } +pub struct ChoiceSlice<'a, P>(&'a mut [P]) + where P: Parser + 'a; + +impl <'a, I, O, P> Parser for ChoiceSlice<'a, P> + where I: ...
2
73
0
8889f120537ceaf233d0def185aca0e63817370d
jxv
2015-02-06T17:50:13
Update from Rust's obsoleted closure syntax
diff --git a/src/lib.rs b/src/lib.rs index feaa4e4..93e9edf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -274,9 +274,9 @@ Expected 'identifier', 'integer', '[' or '(' fn term(input: State<&str>) -> ParseResult<Expr, &str> { let mul = satisfy(|c| c == '*') - .map(|_| Box::new(|&mut:l, r| Expr::...
1
2
2
410ac253f0162c8a6e3cfe1ad507d4f2f741fcdf
Markus Westerlind
2015-02-04T19:10:25
Added the chainr1 parser
diff --git a/src/combinator.rs b/src/combinator.rs index 55a5264..f98be2c 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -398,6 +398,53 @@ pub fn chainl1<'a, P, Op>(parser: P, op: Op) -> Chainl1<P, Op> Chainl1(parser, op) } +#[derive(Clone)] +pub struct Chainr1<P, Op>(P, Op); +impl <'a, I, O, P, Op> ...
1
62
0
567def81f965e372199921eb34628d3e0fb34d84
Markus Westerlind
2015-02-04T15:39:27
Ordered the functions in combinator.rs to be better grouped according to their use Fixed a couple of bounds that were missing for ParserExt functions
diff --git a/src/combinator.rs b/src/combinator.rs index f66c471..55a5264 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -19,78 +19,6 @@ macro_rules! impl_parser { } } -struct Iter<P: Parser> { - parser: P, - input: Consumed<State<P::Input>>, - error: Option<Consumed<ParseError>> -} - -impl <P: ...
1
162
163
da50aec6d9f18f32b16ceddf56e20f166b6a4617
Markus Westerlind
2015-02-04T14:28:11
Made the displayed error messages more readable See the 'expression_error_message' test for an example
diff --git a/src/lib.rs b/src/lib.rs index 0c52ed7..feaa4e4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -139,6 +139,7 @@ mod tests { fn integer<'a, I>(input: State<I>) -> ParseResult<i64, I> where I: Stream<Item=char> { let (s, input) = try!(many1::<String, _>(digit()) + .expected("int...
2
72
4
65e67966af96706e1505003e851e731327b74a90
Markus Westerlind
2015-02-04T14:26:09
Make expected only remove any already existing Expected errors Other errors may still contain useful information such as end of file message etc.
diff --git a/src/char.rs b/src/char.rs index 8575011..5b22130 100644 --- a/src/char.rs +++ b/src/char.rs @@ -218,7 +218,7 @@ mod tests { let result = space() .parse(""); assert!(result.is_err()); - assert_eq!(result.unwrap_err().errors, vec![Error::Expected("whitespace".into_cow())...
3
10
4
9437a75c162fa3f75ff1d39d5955d2f6e76960ec
Markus Westerlind
2015-02-03T22:44:37
Added more informative error messages to all char parsers
diff --git a/src/char.rs b/src/char.rs index 4e4af0d..8575011 100644 --- a/src/char.rs +++ b/src/char.rs @@ -1,5 +1,5 @@ use primitives::{Consumed, Parser, ParseError, ParseResult, Error, State, Stream}; -use combinator::{Expected, FnParser, many, Many, Map, ParserExt, With}; +use combinator::{Expected, many, Many, Ma...
2
37
25
00928c74a21fd0d95d3c9c8000974e22faea5e60
Markus Westerlind
2015-01-29T17:42:20
Simplified the digit parser
diff --git a/src/char.rs b/src/char.rs index c5b3803..4e4af0d 100644 --- a/src/char.rs +++ b/src/char.rs @@ -62,23 +62,12 @@ pub fn satisfy<I, Pred>(pred: Pred) -> Satisfy<I, Pred> Satisfy { pred: pred } } -impl_char_parser! { Digit(), FnParser<I, char, fn (State<I>) -> ParseResult<char, I>> } +impl_char_parser...
1
4
15
603be4d3cf4ca3c2550039d7ec9bd9f82c1c5cf2
Markus Westerlind
2015-01-29T17:35:40
Added a proper error message to the space parser
diff --git a/src/char.rs b/src/char.rs index 639a16f..c5b3803 100644 --- a/src/char.rs +++ b/src/char.rs @@ -1,5 +1,5 @@ use primitives::{Consumed, Parser, ParseError, ParseResult, Error, State, Stream}; -use combinator::{FnParser, many, Many, Map, ParserExt, With}; +use combinator::{Expected, FnParser, many, Many, Ma...
1
21
4
817e0b5fe42ee98f4f066867dfb066a33029ee72
Markus Westerlind
2015-01-29T17:24:11
Added the expected combinator 'expected' behaves similiar to 'message' but reports an expected message
diff --git a/src/combinator.rs b/src/combinator.rs index cce0725..3af2465 100644 --- a/src/combinator.rs +++ b/src/combinator.rs @@ -547,6 +547,24 @@ pub fn try<P>(p : P) -> Try<P> Try(p) } +#[derive(Clone)] +pub struct Expected<P>(P, CowString<'static>); +impl <P> Parser for Expected<P> + where P: Parser { ...
1
26
1
dd80a5bce78928a2a3c7c06152a6a86de914ed3a
Markus Westerlind
2015-02-02T23:40:31
Removed redundant type parameters from the Map and Then parsers
diff --git a/src/char.rs b/src/char.rs index cf823c8..14d7391 100644 --- a/src/char.rs +++ b/src/char.rs @@ -87,7 +87,7 @@ pub fn space<I>() -> Space<I> Space(satisfy(CharExt::is_whitespace as fn (char) -> bool)) } -impl_char_parser! { Spaces(), Many<Vec<()>, Map<Space<I>, fn (char), ()>> } +impl_char_parser! {...
2
8
8
57ad03b6613f095a7f09c0b427b6e3dd59f4efeb
Markus Westerlind
2015-02-02T22:36:28
Bump version number to 0.1
diff --git a/Cargo.toml b/Cargo.toml index afa0ee8..b700ec9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "parser-combinators" -version = "0.0.2" +version = "0.1.0" authors = ["Markus Westerlind <marwes91@gmail.com>"] description = "Parser combinators based on the Haskell library par...
1
1
1
b1d1204ce6d35c97627138c1aa0be28575cd491d
Markus Westerlind
2015-02-02T20:52:51
Changed the internal Error enum to use CowString<'static> Most of the error messages are &'static str which means using a String as the message type is usually a waste allocation. The parser API should still be relatively unaware of this change since the only change was String -> T where T: IntoCow
diff --git a/src/char.rs b/src/char.rs index cf823c8..fa862dd 100644 --- a/src/char.rs +++ b/src/char.rs @@ -1,5 +1,6 @@ use primitives::{Consumed, Parser, ParseError, ParseResult, Error, State, Stream}; use combinator::{FnParser, many, Many, Map, ParserExt, With}; +use std::borrow::IntoCow; macro_rules! impl_char...
4
23
15
5c3fd6cff626ee7a80474429ba916c36e65f34f5
Markus Westerlind
2015-02-01T17:53:13
Allow &mut P and Box<P> parsers to have unsized P Closes #6
diff --git a/src/lib.rs b/src/lib.rs index 66d27cc..9654f8f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -351,4 +351,11 @@ r"(3 * 4) + 2 * 4 * test + 4 * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa let _: Result<(Vec<_>, _), _> = (many(Box::new(digit()))) .parse("1"); } + + #[test] + fn ...
2
9
2
c5b5b43791908cf998798865fd3eff96c0a9e779
Markus Westerlind
2015-02-01T15:42:07
Added feature(test) to prepare for stabilization changes Also fixed Show -> Debug in a test
diff --git a/src/lib.rs b/src/lib.rs index 91d8d3f..66d27cc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,6 @@ #![unstable] -#![feature(core)] -#![feature(collections)] -#![feature(unicode)] +#![feature(core, collections, unicode)] +#![cfg_attr(test, feature(test))] //!This crate contains parser combinators, ...
1
3
4
ed07f75893ff461483ee8bde9d6fb651443e6f60
jxv
2015-01-31T00:18:46
silence unstable and feature warnings
diff --git a/src/lib.rs b/src/lib.rs index 25233c1..91d8d3f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,7 @@ -#![allow(unstable)] #![unstable] +#![feature(core)] +#![feature(collections)] +#![feature(unicode)] //!This crate contains parser combinators, roughly based on the Haskell library [parsec](http://ha...
1
3
1
176c0d3f31f7cc099dac53b82bb173d8ef68e632
jxv
2015-01-29T23:45:22
add some basic character parsers
diff --git a/src/char.rs b/src/char.rs index 4f2aa3d..cf823c8 100644 --- a/src/char.rs +++ b/src/char.rs @@ -1,5 +1,5 @@ use primitives::{Consumed, Parser, ParseError, ParseResult, Error, State, Stream}; -use combinator::{FnParser, many, Many, Map, ParserExt}; +use combinator::{FnParser, many, Many, Map, ParserExt, Wi...
2
75
1
bb8f7983122d4d62c7f6aaf91622e08a2de801b9
Markus Westerlind
2015-01-29T22:33:45
Hide the digit and space parsers behind a newtype and specialize char parsers Parser creating functions should always be specialized same as when they implement Parser so that they cannot create values which arent parsers.
diff --git a/src/char.rs b/src/char.rs index b287c03..4f2aa3d 100644 --- a/src/char.rs +++ b/src/char.rs @@ -57,12 +57,13 @@ impl <I, Pred> Parser for Satisfy<I, Pred> /// # } /// ``` pub fn satisfy<I, Pred>(pred: Pred) -> Satisfy<I, Pred> - where I: Stream, Pred: FnMut(char) -> bool { + where I: Stream<Item=c...
1
11
9