CommonToken

TODO add class description

Constructors

this
this(int type)

Constructs a new {@link CommonToken} with the specified token type.

this
this(TokenFactorySourcePair source, int type, int channel, int start, int stop)
Undocumented in source.
this
this(int type, string text)

Constructs a new {@link CommonToken} with the specified token type and text.

this
this(Token oldToken)

Constructs a new {@link CommonToken} as a copy of another {@link Token}. * <p> If {@code oldToken} is also a {@link CommonToken} instance, the newly constructed token will share a reference to the {@link #text} field and the {@link Pair} stored in {@link #source}. Otherwise, {@link #text} will be assigned the result of calling {@link #getText}, and {@link #source} will be constructed from the result of {@link Token#getTokenSource} and {@link Token#getInputStream}.</p>

Members

Functions

getChannel
int getChannel()

@uml @override

getCharPositionInLine
int getCharPositionInLine()

@uml @override

getInputStream
CharStream getInputStream()

@uml @override

getLine
int getLine()

@uml @override

getStartIndex
int getStartIndex()

@uml @override

getStopIndex
int getStopIndex()

@uml @override

getText
string getText()

@uml @override

getTokenIndex
int getTokenIndex()

@uml @override

getTokenSource
TokenSource getTokenSource()

@uml @override

getType
int getType()
Undocumented in source. Be warned that the author may not have intended to support it.
setChannel
void setChannel(int channel)

@uml @override

setCharPositionInLine
void setCharPositionInLine(int charPositionInLine)
Undocumented in source. Be warned that the author may not have intended to support it.
setLine
void setLine(int line)
Undocumented in source. Be warned that the author may not have intended to support it.
setStartIndex
void setStartIndex(int start)
Undocumented in source. Be warned that the author may not have intended to support it.
setStopIndex
void setStopIndex(int stop)
Undocumented in source. Be warned that the author may not have intended to support it.
setText
void setText(string text)

@uml @override Explicitly set the text for this token. If {code text} is not {@code null}, then {@link #getText} will return this value rather than extracting the text from the input.

setTokenIndex
void setTokenIndex(int index)

@uml @override

setType
void setType(int type)

@uml @override

toString
string toString()

@uml @override

Static variables

EMPTY_SOURCE
TokenFactorySourcePair EMPTY_SOURCE;

An empty {@link Pair} which is used as the default value of {@link #source} for tokens that do not have a source.

Variables

channel
int channel;

This is the backing field for {@link #getChannel} and {@link #setChannel}.

charPositionInLine
int charPositionInLine;

This is the backing field for {@link #getCharPositionInLine} and {@link #setCharPositionInLine}.

index
int index;

This is the backing field for {@link #getTokenIndex} and {@link #setTokenIndex}.

line
int line;

This is the backing field for {@link #getLine} and {@link #setLine}.

source
TokenFactorySourcePair source;

This is the backing field for {@link #getTokenSource} and {@link #getInputStream}.

start
int start;

This is the backing field for {@link #getStartIndex} and {@link #setStartIndex}.

stop
int stop;

This is the backing field for {@link #getStopIndex} and {@link #setStopIndex}.

text
string text;

This is the backing field for {@link #getText} when the token text is explicitly set in the constructor or via {@link #setText}.

type
int type;

This is the backing field for {@link #getType} and {@link #setType}.

Inherited Members

From WritableToken

setText
void setText(string text)
Undocumented in source.
setType
void setType(int ttype)
Undocumented in source.
setLine
void setLine(int line)
Undocumented in source.
setCharPositionInLine
void setCharPositionInLine(int charPositionInLine)
Undocumented in source.
setChannel
void setChannel(int channel)
Undocumented in source.
setTokenIndex
void setTokenIndex(int index)
Undocumented in source.

Meta