The Pushback
trait can be mixed into an SafeIterator
to permit
arbitrary pushback.
The Pushback
trait can be mixed into an SafeIterator
to permit
arbitrary pushback.
NOTE: This trait it not thread-safe.
SafeIterator
places a simple stream on top of an iterator,
returning Option
-wrapped instances from the underlying iterator.
SafeIterator
places a simple stream on top of an iterator,
returning Option
-wrapped instances from the underlying iterator.
When the stream is exhausted, the Iterator
stream returns
None
. Differences from a plain Iterator
include:
- An SafeIterator
will not throw an exception if you try to read
past the end of it. Instead, it will just keep returning None
.
Example of use with a string:
import grizzled.parsing.SafeIterator val s = ... val istream = new SafeIterator[Char](s.elements)
A simple string token class, consisting of:
A simple string token class, consisting of:
- a string token - the starting position of the token in the original string from which the token was parsed
This class is used by the toTokens()
method in
grizzled.string.Implicits.String.GrizzledString.
the string token
the start of the token within the original string
Companion object for SafeIterator
.
Methods and classes useful for parsing various things.