ListTokenSource class

Provides an implementation of TokenSource as a wrapper around a list of Token objects.

If the final token in the list is an {@link Token#EOF} token, it will be used as the EOF token for every call to {@link #nextToken} after the end of the list is reached. Otherwise, an EOF token will be created.

Implemented types

Constructors

ListTokenSource(List<Token> tokens, [String? _sourceName])
Constructs a new ListTokenSource instance from the specified collection of Token objects and source name.

Properties

charPositionInLine int
{@inheritDoc}
no setteroverride
eofToken Token?
This field caches the EOF token for the token source.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
i int
The index into {@link #tokens} of token to return by the next call to {@link #nextToken}. The end of the input is indicated by this value being greater than or equal to the number of items in {@link #tokens}.
getter/setter pair
inputStream CharStream?
{@inheritDoc}
no setteroverride
line int?
{@inheritDoc}
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sourceName String
The name of the input source. If this value is null, a call to {@link #getSourceName} should return the source name used to create the the next token in {@link #tokens} (or the previous token if the end of the input has been reached).
no setteroverride
tokenFactory TokenFactory<Token>
This is the backing field for {@link #getTokenFactory} and setTokenFactory.
getter/setter pairoverride
tokens List<Token>
The wrapped collection of Token objects to return.
final

Methods

nextToken() Token
{@inheritDoc}
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited