All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.
std
feature which is enabled by default. Disabling this feature will result in ano_std
-compatible version of Chomp.ascii::float
parses a floating-point number with optional sign, fraction and exponent.combinators::choice
which attempts multiple heterogenous parsers from an iterator until one succeeds.parsers::skip_while1
skips at least one token matching a predicate.
- Updated
either
dependency to1.0.0
.
combinators::either
: Likeor
but allows different result types from the parsers.
- Chomp is now licensed under both MIT and Apache-2.0 licenses.
- Feature
tendril
now compiles again.
-
prelude
module containing basic types, parsers and combinators.This is supposed to be the equivalent of Attoparsec's main package.
-
run_parser
which executes a parser on any givenInput
type. -
buffer::InputBuf
which contains a slice and an incomplete flag, much as the oldInput
struct. -
Input<Token=T, Buffer=&[T]>
implementation for&[T]
whereT: Copy + PartialEq
. -
Input<Token=char, Buffer=&str>
implementation for&str
. -
types::Buffer
trait which is implemented for all buffers providing common logic to perform the final parsing on a buffer without knowing the exact buffer implementation. -
types::U8Input
trait alias forInput<Token=u8>
. -
primitives::Primitives
trait providing access to the primitive methods of theInput
trait.This is used for building fundamental parsers/combinators.
-
ParseResult::inspect
allowing code to observe the success value. -
types::numbering
module for creating position-awareInput
types. -
parsers::skip_while
using an efficient way of skipping data if provided, otherwise falls back on usingtake_while
and throws the result away. -
chomp::Error
now includes a backtrace intest
anddebug
build profiles thanks to the debugtrace crate. Backtraces can also be activated permanently using thebacktrace
feature but this will incur the significant cost of allocating backtraces even in therelease
profile. -
Feature
noop_error
provides a zero-sized error type for the cases when the expected token is unimportant. Provides a small performance boost.
-
Backwards-incompatible:
Input
is now a trait with associated typesToken
andBuffer
.This removes all incomplete logic from the parsers themselves and moves it into the
InputBuf
type. ThisInputBuf
is used if a partial buffer is in memory. It also allows the parsers to operate directly on slices or use more effective means of storing buffers depending on theInput
implementation.To upgrade you replace the previous concrete
Input
type with a generic, use its associated type if required, and refer to theBuffer
associated type to allow for zero-copy parsing::-fn http_version(i: Input<u8>) -> U8Result<&[u8]>; +fn http_version<I: Input<Token=u8>>(i: I) -> SimpleResult<I, I::Buffer>;
The associated types can be restricted if requried:
fn request<I: U8Input>(i: I) -> SimpleResult<I, (Request<I::Buffer>, Vec<Header<I::Buffer>>)> where I::Buffer: ::std::ops::Deref<Target=[u8]>;
-
Backwards-incompatible: Moved types into a more logical module structure, prelude now exists as a
prelude
module. -
Backwards-incompatible:
chomp::Error
is no longer an enum, this is to facillitate the support of backtraces while keeping code compatible between the different build profiles.Use
chomp::Error::expected_token
to determine if a specific token was expected. -
Feature
verbose_error
is now default
Input::incomplete
Input::new
ParseResult::expect
ParseResult::unwrap_err
ParseResult::unwrap
buffer::IntoStream
primitives::InputClone
primitives::State
combinators::bounded
now have a defined behavior when aRange<usize>
hasstart == end
: They will parse exactlystart
times. This also fixed a few overflows and unreachable code being reachable.combinators::bounded::many_till
got fixed for an overflow happening when0: usize
was used to limit the number of iterations.
- Macro expansion is now again compatible with nightly.
- Now uses
std
feature of conv dependency, fixing build breakage on rustc 1.2.0.
combinators::bounded::sep_by
: Bounded version ofcombinators::sep_by
andcombinators::sep_by1
.
- Improved performance of combinators using iterators.
- Updated bitflags dependency
- Backwards-incompatible:
combinators::option
will now return the default value if the parser reports incomplete and the input is finite.
buffer::StreamError
now implementsFrom<ParseError>
-
Backwards-incompatible:
combinators::or
will now retry with the second parser if the first parser reports incomplete and the input is finite. -
Improvements to
parse!
macro to make it more general and to make it easier to write simple parsers as one line. Completely updated grammar and reimplemented the macro to include:- Alternation operator (
<|>
) - Skip operator (
<*
) - Then operator (
>>
) ret
anderr
can now be used inline- Backwards-incompatible:
;
is no longer allowed to terminate aparse!
block.
- Alternation operator (
Input::ret
,ParseResult::bind
andParseResult::then
no longer have type parameter defaults. This change only affects people on nightly who havetype-parameter-defaults
enabled. See Rust pull request #30724.
buffer::GrowingBuffer
andbuffer::data_source::ReadDataSource
now deriveDebug
.- Rustdoc for public items previously lacking any documentation.
parse_only
: Runs a given parser on a finite input.combinators::bounded::many
: combinator applying a parser within a range bound, storing the data in aT: FromIterator
.combinators::bounded::skip_many
: combinator applying a parser within a range bound, throwing away all produced data.combinators::bounded::many_till
: combinator applying a parser within a range bound until a second parser succeeds. If the second parser does not succeed within the given range the parsing will fail. The matches from the first parser will be stored in aT: FromIterator
.
count
,many1
,sep_by1
now properly usesIterator::size_hint
- Backwards-incompatible:
many
,many1
,sep_by
,sep_by1
,skip_many
,skip_many1
are no longer considered incomplete if they end with a partial match as long as they have managed to satisfy the minimum count of matches. - Backwards-incompatible:
buffer::ParseError
has been renamed tobuffer::StreamError
to not conflict with the simpleParseError
. - Slightly improved performance for
count
,many
,many1
,sep_by
,sep_by1
.
-
Input::new
Use
parse_only
orbuffer::SliceStream
to parse a slice instead. For any advanced usage create anInput
usingprimitives::input::new
. -
ParseResult::unwrap
,ParseResult::unwrap_err
,ParseResult::expect
Use
parse_only
or thebuffer::Stream
implementations to obtain aResult
instead of acting on theParseResult
directly.
ascii::digit
ascii::is_end_of_line
ascii::is_horizontal_space
ascii::signed
ascii::skip_whitespace
combinators::look_ahead
combinators::many_till
combinators::matched_by
combinators::sep_by1
combinators::sep_by
combinators::skip_many1
parsers::peek_next
parsers::run_scanner
parsers::satisfy_with
parsers::Error::new
, useful for creating error values of unknown type.
Initial release.