All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.
stdfeature which is enabled by default. Disabling this feature will result in ano_std-compatible version of Chomp.ascii::floatparses a floating-point number with optional sign, fraction and exponent.combinators::choicewhich attempts multiple heterogenous parsers from an iterator until one succeeds.parsers::skip_while1skips at least one token matching a predicate.
- Updated
eitherdependency to1.0.0.
combinators::either: Likeorbut allows different result types from the parsers.
- Chomp is now licensed under both MIT and Apache-2.0 licenses.
- Feature
tendrilnow compiles again.
-
preludemodule containing basic types, parsers and combinators.This is supposed to be the equivalent of Attoparsec's main package.
-
run_parserwhich executes a parser on any givenInputtype. -
buffer::InputBufwhich contains a slice and an incomplete flag, much as the oldInputstruct. -
Input<Token=T, Buffer=&[T]>implementation for&[T]whereT: Copy + PartialEq. -
Input<Token=char, Buffer=&str>implementation for&str. -
types::Buffertrait which is implemented for all buffers providing common logic to perform the final parsing on a buffer without knowing the exact buffer implementation. -
types::U8Inputtrait alias forInput<Token=u8>. -
primitives::Primitivestrait providing access to the primitive methods of theInputtrait.This is used for building fundamental parsers/combinators.
-
ParseResult::inspectallowing code to observe the success value. -
types::numberingmodule for creating position-awareInputtypes. -
parsers::skip_whileusing an efficient way of skipping data if provided, otherwise falls back on usingtake_whileand throws the result away. -
chomp::Errornow includes a backtrace intestanddebugbuild profiles thanks to the debugtrace crate. Backtraces can also be activated permanently using thebacktracefeature but this will incur the significant cost of allocating backtraces even in thereleaseprofile. -
Feature
noop_errorprovides a zero-sized error type for the cases when the expected token is unimportant. Provides a small performance boost.
-
Backwards-incompatible:
Inputis now a trait with associated typesTokenandBuffer.This removes all incomplete logic from the parsers themselves and moves it into the
InputBuftype. ThisInputBufis 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 theInputimplementation.To upgrade you replace the previous concrete
Inputtype with a generic, use its associated type if required, and refer to theBufferassociated 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
preludemodule. -
Backwards-incompatible:
chomp::Erroris 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_tokento determine if a specific token was expected. -
Feature
verbose_erroris now default
Input::incompleteInput::newParseResult::expectParseResult::unwrap_errParseResult::unwrapbuffer::IntoStreamprimitives::InputCloneprimitives::State
combinators::boundednow have a defined behavior when aRange<usize>hasstart == end: They will parse exactlystarttimes. This also fixed a few overflows and unreachable code being reachable.combinators::bounded::many_tillgot fixed for an overflow happening when0: usizewas used to limit the number of iterations.
- Macro expansion is now again compatible with nightly.
- Now uses
stdfeature of conv dependency, fixing build breakage on rustc 1.2.0.
combinators::bounded::sep_by: Bounded version ofcombinators::sep_byandcombinators::sep_by1.
- Improved performance of combinators using iterators.
- Updated bitflags dependency
- Backwards-incompatible:
combinators::optionwill now return the default value if the parser reports incomplete and the input is finite.
buffer::StreamErrornow implementsFrom<ParseError>
-
Backwards-incompatible:
combinators::orwill 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 (
>>) retanderrcan now be used inline- Backwards-incompatible:
;is no longer allowed to terminate aparse!block.
- Alternation operator (
Input::ret,ParseResult::bindandParseResult::thenno longer have type parameter defaults. This change only affects people on nightly who havetype-parameter-defaultsenabled. See Rust pull request #30724.
buffer::GrowingBufferandbuffer::data_source::ReadDataSourcenow 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_by1now properly usesIterator::size_hint- Backwards-incompatible:
many,many1,sep_by,sep_by1,skip_many,skip_many1are 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::ParseErrorhas been renamed tobuffer::StreamErrorto not conflict with the simpleParseError. - Slightly improved performance for
count,many,many1,sep_by,sep_by1.
-
Input::newUse
parse_onlyorbuffer::SliceStreamto parse a slice instead. For any advanced usage create anInputusingprimitives::input::new. -
ParseResult::unwrap,ParseResult::unwrap_err,ParseResult::expectUse
parse_onlyor thebuffer::Streamimplementations to obtain aResultinstead of acting on theParseResultdirectly.
ascii::digitascii::is_end_of_lineascii::is_horizontal_spaceascii::signedascii::skip_whitespacecombinators::look_aheadcombinators::many_tillcombinators::matched_bycombinators::sep_by1combinators::sep_bycombinators::skip_many1parsers::peek_nextparsers::run_scannerparsers::satisfy_with
parsers::Error::new, useful for creating error values of unknown type.
Initial release.