Top Fields Methods
org.antlr.runtime

public Interface Token

Known Direct Implementers
org.antlr.runtime.debug.RemoteDebugEventSocketListener.ProxyToken, org.antlr.runtime.ClassicToken, org.antlr.runtime.CommonToken

Field Summary

Modifier and TypeField and Description
public static final int
DEFAULT_CHANNEL

All tokens go to the parser (unless skip() is called in that rule) on a particular "channel".

public static final int
DOWN

imaginary tree navigation type; traverse "get child" link

public static final int
public static final int
public static final int
HIDDEN_CHANNEL

Anything on different channel than DEFAULT_CHANNEL is not parsed by parser.

public static final Token
public static final int
public static final int
public static final Token
SKIP_TOKEN

In an action, a lexer rule can set token to this SKIP_TOKEN and ANTLR will avoid creating a token for this symbol and try to fetch another.

public static final int
UP

imaginary tree navigation type; finish with a child list

Method Summary

Modifier and TypeMethod and Description
public int
public int
getCharPositionInLine()

The index of the first character relative to the beginning of the line 0..n-1

public CharStream
getInputStream()

From what character stream was this token created?

public int
getLine()

The line number on which this token was matched; line=1..n

public String
getText()

Get the text of the token

public int
getTokenIndex()

An index from 0..n-1 of the token object in the input stream.

public int
public void
setChannel(int channel)

public void
public void
public void
setLine(int line)

public void
public void
setTokenIndex(int index)

public void
setType(int ttype)

Field Detail

DEFAULT_CHANNELback to summary
public static final int DEFAULT_CHANNEL

All tokens go to the parser (unless skip() is called in that rule) on a particular "channel". The parser tunes to a particular channel so that whitespace etc... can go to the parser on a "hidden" channel.

DOWNback to summary
public static final int DOWN

imaginary tree navigation type; traverse "get child" link

EOFback to summary
public static final int EOF
EOR_TOKEN_TYPEback to summary
public static final int EOR_TOKEN_TYPE
HIDDEN_CHANNELback to summary
public static final int HIDDEN_CHANNEL

Anything on different channel than DEFAULT_CHANNEL is not parsed by parser.

INVALID_TOKENback to summary
public static final Token INVALID_TOKEN
INVALID_TOKEN_TYPEback to summary
public static final int INVALID_TOKEN_TYPE
MIN_TOKEN_TYPEback to summary
public static final int MIN_TOKEN_TYPE
SKIP_TOKENback to summary
public static final Token SKIP_TOKEN

In an action, a lexer rule can set token to this SKIP_TOKEN and ANTLR will avoid creating a token for this symbol and try to fetch another.

UPback to summary
public static final int UP

imaginary tree navigation type; finish with a child list

Method Detail

getChannelback to summary
public int getChannel()
getCharPositionInLineback to summary
public int getCharPositionInLine()

The index of the first character relative to the beginning of the line 0..n-1

getInputStreamback to summary
public CharStream getInputStream()

From what character stream was this token created? You don't have to implement but it's nice to know where a Token comes from if you have include files etc... on the input.

getLineback to summary
public int getLine()

The line number on which this token was matched; line=1..n

getTextback to summary
public String getText()

Get the text of the token

getTokenIndexback to summary
public int getTokenIndex()

An index from 0..n-1 of the token object in the input stream. This must be valid in order to use the ANTLRWorks debugger.

getTypeback to summary
public int getType()
setChannelback to summary
public void setChannel(int channel)
setCharPositionInLineback to summary
public void setCharPositionInLine(int pos)
setInputStreamback to summary
public void setInputStream(CharStream input)
setLineback to summary
public void setLine(int line)
setTextback to summary
public void setText(String text)
setTokenIndexback to summary
public void setTokenIndex(int index)
setTypeback to summary
public void setType(int ttype)