org.antlr.runtime.Token Interface Reference

Inheritance diagram for org.antlr.runtime.Token:

Inheritance graph
[legend]
Collaboration diagram for org.antlr.runtime.Token:

Collaboration graph
[legend]

List of all members.

Public Member Functions

String getText ()
void setText (String text)
int getType ()
void setType (int ttype)
int getLine ()
void setLine (int line)
int getCharPositionInLine ()
void setCharPositionInLine (int pos)
int getChannel ()
void setChannel (int channel)
int getTokenIndex ()
void setTokenIndex (int index)
CharStream getInputStream ()
void setInputStream (CharStream input)

Static Public Attributes

static final int EOR_TOKEN_TYPE = 1
static final int DOWN = 2
static final int UP = 3
static final int MIN_TOKEN_TYPE = UP+1
static final int EOF = CharStream.EOF
static final Token EOF_TOKEN = new CommonToken(EOF)
static final int INVALID_TOKEN_TYPE = 0
static final Token INVALID_TOKEN = new CommonToken(INVALID_TOKEN_TYPE)
static final Token SKIP_TOKEN = new CommonToken(INVALID_TOKEN_TYPE)
static final int DEFAULT_CHANNEL = 0
static final int HIDDEN_CHANNEL = 99


Detailed Description

Definition at line 30 of file Token.java.


Member Function Documentation

String org.antlr.runtime.Token.getText (  ) 

void org.antlr.runtime.Token.setText ( String  text  ) 

int org.antlr.runtime.Token.getType (  ) 

void org.antlr.runtime.Token.setType ( int  ttype  ) 

int org.antlr.runtime.Token.getLine (  ) 

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

Implemented in org.antlr.runtime.ClassicToken, org.antlr.runtime.CommonToken, and org.antlr.runtime.debug.RemoteDebugEventSocketListener.ProxyToken.

void org.antlr.runtime.Token.setLine ( int  line  ) 

int org.antlr.runtime.Token.getCharPositionInLine (  ) 

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

Implemented in org.antlr.runtime.ClassicToken, org.antlr.runtime.CommonToken, and org.antlr.runtime.debug.RemoteDebugEventSocketListener.ProxyToken.

void org.antlr.runtime.Token.setCharPositionInLine ( int  pos  ) 

int org.antlr.runtime.Token.getChannel (  ) 

void org.antlr.runtime.Token.setChannel ( int  channel  ) 

int org.antlr.runtime.Token.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.

Implemented in org.antlr.runtime.ClassicToken, org.antlr.runtime.CommonToken, and org.antlr.runtime.debug.RemoteDebugEventSocketListener.ProxyToken.

void org.antlr.runtime.Token.setTokenIndex ( int  index  ) 

CharStream org.antlr.runtime.Token.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.

Implemented in org.antlr.runtime.ClassicToken, org.antlr.runtime.CommonToken, and org.antlr.runtime.debug.RemoteDebugEventSocketListener.ProxyToken.

void org.antlr.runtime.Token.setInputStream ( CharStream  input  ) 


Member Data Documentation

Definition at line 31 of file Token.java.

final int org.antlr.runtime.Token.DOWN = 2 [static]

imaginary tree navigation type; traverse "get child" link

Definition at line 34 of file Token.java.

final int org.antlr.runtime.Token.UP = 3 [static]

imaginary tree navigation type; finish with a child list

Definition at line 36 of file Token.java.

Definition at line 38 of file Token.java.

Definition at line 40 of file Token.java.

Definition at line 42 of file Token.java.

Definition at line 44 of file Token.java.

Definition at line 45 of file Token.java.

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.

Definition at line 50 of file Token.java.

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.

Definition at line 56 of file Token.java.

final int org.antlr.runtime.Token.HIDDEN_CHANNEL = 99 [static]

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

Definition at line 61 of file Token.java.


The documentation for this interface was generated from the following file:

Generated on Tue Jul 19 11:42:05 2011 for ANTLR API by  doxygen 1.5.5