ListTokenSource

@uml Provides an implementation of {@link TokenSource} as a wrapper around a list of {@link Token} objects.

<p>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.</p>

Constructors

this
this(Token[] tokens)

@uml Constructs a new {@link ListTokenSource} instance from the specified collection of {@link Token} objects.

this
this(Token[] tokens, string sourceName)

@uml Constructs a new {@link ListTokenSource} instance from the specified collection of {@link Token} objects and source name.

Members

Functions

getCharPositionInLine
int getCharPositionInLine()
Undocumented in source. Be warned that the author may not have intended to support it.
getInputStream
CharStream getInputStream()
Undocumented in source. Be warned that the author may not have intended to support it.
getLine
int getLine()
Undocumented in source. Be warned that the author may not have intended to support it.
getSourceName
string getSourceName()
Undocumented in source. Be warned that the author may not have intended to support it.
nextToken
Token nextToken()
Undocumented in source. Be warned that the author may not have intended to support it.
tokenFactory
void tokenFactory(TokenFactory!CommonToken factory)
Undocumented in source. Be warned that the author may not have intended to support it.
tokenFactory
TokenFactory!CommonToken tokenFactory()
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

_factory
TokenFactory!CommonToken _factory;

@uml This is the backing field for {@link #getTokenFactory} and {@link setTokenFactory}.

eofToken
Token eofToken;

@uml This field caches the EOF token for the token source.

i
int i;

@uml 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}.

tokens
Token[] tokens;

@uml The wrapped collection of {@link Token} objects to return.

Inherited Members

From TokenSource

getCharPositionInLine
int getCharPositionInLine()

@uml Get the index into the current line for the current position in the input stream. The first character on a line has position 0.

nextToken
Token nextToken()

@uml Return a {@link Token} object from your input stream (usually a {@link CharStream}). Do not fail/return upon lexing error; keep chewing on the characters until you get a good one; errors are not passed through to the parser.

getLine
int getLine()

@uml Get the line number for the current position in the input stream. The first line in the input is line 1.

getInputStream
CharStream getInputStream()

@uml Get the {@link CharStream} from which this token source is currently providing tokens.

getSourceName
string getSourceName()

@uml Gets the name of the underlying input source. This method returns a non-null, non-empty string. If such a name is not known, this method returns {@link IntStream#UNKNOWN_SOURCE_NAME}.

tokenFactory
void tokenFactory(TokenFactory!CommonToken factory)

@uml Set the {@link TokenFactory} this token source should use for creating {@link Token} objects from the input.

tokenFactory
TokenFactory!CommonToken tokenFactory()

@uml Gets the {@link TokenFactory} this token source is currently using for creating {@link Token} objects from the input.

Meta