Class BNFsupport.lazyStream


class ['a] lazyStream : 'a Stream.t -> object .. end
The primary lazy stream class. It should take an existing stream as a parameter to new when the class is instantiated.

This class can present a stream interface itself via the to_stream call.

Accesses to the stream represented by this class will read -- but not consume -- data from the stream passed in. Once the data is ready to be consumed, you may call consumeall. This will consume all parent data read since the object was instantiated or reset.


method next_item : 'a option
Returns the next item available, or None if no more items are available.
method nth_item : int -> 'a option
Returns the nth item available, starting from 0, or None if no more items are available.
method consume_stream : unit
Consumes on the parent stream all items that have been consumed by the stream returned by to_stream on this object.
method to_stream : 'a Stream.t
Returns a stream for this object. This stream can be used as normal, and calls to Stream.next or String.junk on it will