TokenStreamInterface
A generic stream of tokens used in single LineInterface lines.
The tokenizers create these streams for various lists of tokens, the generic implementation is class TokenStream. For lists of identifier tokens the special class TokenStreamIdentifier is created.
Tags
Table of Contents
Methods
- __toString() : string
- Create a source string from given tokens.
- append() : self
- Stream creation.
- getAll() : array<string|int, TokenInterface>
- Only used internally when one Stream is transferred to another, in particular when a TokenStream is turned into TokenStreamConstantAware.
- getNext() : TokenInterface|null
- Get next token and raise pointer.
- isEmpty() : bool
- We sometimes create a stream but don't add tokens.
- peekNext() : TokenInterface|null
- Get next token but do not raise pointer.
- reset() : self
- Reset current pointer. Typically, call this before iterating with getNext().
- setAll() : self
- Only used internally when one Stream is transferred to another, in particular when a TokenStream is turned into TokenStreamConstantAware.
Methods
__toString()
Create a source string from given tokens.
    public
                    __toString() : string
    Return values
stringappend()
Stream creation.
    public
                    append(TokenInterface $token) : self
    Parameters
- $token : TokenInterface
Return values
selfgetAll()
Only used internally when one Stream is transferred to another, in particular when a TokenStream is turned into TokenStreamConstantAware.
    public
                    getAll() : array<string|int, TokenInterface>
    Return values
array<string|int, TokenInterface>getNext()
Get next token and raise pointer.
    public
                    getNext() : TokenInterface|null
    Return values
TokenInterface|nullisEmpty()
We sometimes create a stream but don't add tokens.
    public
                    isEmpty() : bool
    This method returns true if tokens have been added.
Return values
boolpeekNext()
Get next token but do not raise pointer.
    public
                    peekNext() : TokenInterface|null
    Return values
TokenInterface|nullreset()
Reset current pointer. Typically, call this before iterating with getNext().
    public
                    reset() : self
    Return values
selfsetAll()
Only used internally when one Stream is transferred to another, in particular when a TokenStream is turned into TokenStreamConstantAware.
    public
                    setAll(array<string|int, TokenInterface> $tokens) : self
    Parameters
- $tokens : array<string|int, TokenInterface>