From #13:
- Add
Tokens::parse
method, which attempt to parse the remaining tokens into some type viaFromStr
(andstr::parse
). This requires a buffer type (oftenString
) to be provided as the second generic arg, and may use this to buffer tokens prior to parsing if necessary. - Add some helper functions which allow
Tokens::parse
to be optimised in cases likeStrToken
, so that eg callingtoks.slice(from, to).parse::<u16,String>
forStrTokens
and similar won't allocate. - Add
Tokens::take
for takingn
tokens (can be useful in conjunction withparse
, above). - Add
Tokens::eof
,Tokens::collect
andTokens::consume
for finding an EOF (None
), collecting tokens and consuming all tokens. - Add
Tokens::into_iter
, for when you need to work around lifetime issues withTokens::as_iter
. - Rename
Tokens::tokens_while
toTokens::take_while
, andTokens::skip_tokens_while
toTokens::skip_while
; we no longer have to worry about conflicts withIterator
methods. Tokens::{surrounded, optional, optional_err}
now accept anFnOnce
instead of anFnMut
, allowing a little more flexibility in what is given.- Anything which returned something implementing
Iterator
now returns something implementingTokens
instead (you can still call.as_iter()
to then get a standardIterator
from this).
A shoutout to @EasyOakland for their contributions in this!
From #13:
- Add
yap::chars
module which contains some helper functions (likeparse_f64
) specific toimpl Tokens<Item=char>
. - Generalise
yap::one_of!
andTokens::optional
; the output from expressions passed to either of these can now beOption<T>
orbool
, or more specifically anything implementingyap::one_of::IsMatch
.
Thankyou @Easyoakland for both of these contributions!
- Add support for
no_std
environments (#7). - Add
yap::types::IterToken
, which can be used for parsing tokens from arbitrary iterators (as long as they impl Clone).
- Remove pointless
skip_optional
function.
- Tidy up some docs and deny missing docs on public items.
- Remove the
Iterator
supertrait requirement fromTokens
, and instead require implementing those methods directly onTokens
. Add aTokens::as_iter()
method to return an Iterator from our Tokens. This is done to keep the Iterator interface and methods in a separate namespace from the Tokens ones.
- Fix a bug whereby
.tokens("foo")
will return true if we run out of input before completing the match.
- Add
optional_err
parser, which is likeoptional
but allows any error to be propagated.
- Fix clippy warnings on
one_of
macro invocations. - Run clippy on the codebase and add it to the CI.