antlr3.CommonToken Class Reference

Basic token implementation. More...

Inheritance diagram for antlr3.CommonToken:

Inheritance graph
[legend]
Collaboration diagram for antlr3.CommonToken:

Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def getText
 Get the text of the token.
def setText
 Override the text for this token.
def getType
 Get the type of the token.
def setType
 Get the type of the token.
def getLine
 Get the line number on which this token was matched.
def setLine
 Set the line number on which this token was matched.
def getCharPositionInLine
 Get the column of the tokens first character,.
def setCharPositionInLine
 Set the column of the tokens first character,.
def getChannel
 Get the channel of the token.
def setChannel
 Set the channel of the token.
def getTokenIndex
 Get the index in the input stream.
def setTokenIndex
 Set the index in the input stream.
def getInputStream
 From what character stream was this token created.
def setInputStream
 From what character stream was this token created.
def __str__

Public Attributes

 type
 line
 charPositionInLine
 channel
 index
 input
 start
 stop

Static Public Attributes

tuple text = property(getText, setText)

Private Attributes

 _text


Detailed Description

Basic token implementation.

This implementation does not copy the text from the input stream upon creation, but keeps start/stop pointers into the stream to avoid unnecessary copy operations.

Definition at line 712 of file antlr3.py.


Member Function Documentation

def antlr3.CommonToken.__init__ (   self,
  type = None,
  channel = DEFAULT_CHANNEL,
  text = None,
  input = None,
  start = None,
  stop = None,
  oldToken = None 
)

Definition at line 714 of file antlr3.py.

def antlr3.CommonToken.getText (   self  ) 

Get the text of the token.

Using setter/getter methods is deprecated. Use o.text instead.

Reimplemented from antlr3.Token.

Definition at line 753 of file antlr3.py.

def antlr3.CommonToken.setText (   self,
  text 
)

Override the text for this token.

getText() will return this text rather than pulling from the buffer. Note that this does not mean that start/stop indexes are not valid. It means that that input was converted to a new string in the token object.

Reimplemented from antlr3.Token.

Definition at line 770 of file antlr3.py.

def antlr3.CommonToken.getType (   self  ) 

Get the type of the token.

Using setter/getter methods is deprecated. Use o.type instead.

Reimplemented from antlr3.Token.

Definition at line 776 of file antlr3.py.

def antlr3.CommonToken.setType (   self,
  ttype 
)

Get the type of the token.

Using setter/getter methods is deprecated. Use o.type instead.

Reimplemented from antlr3.Token.

Definition at line 779 of file antlr3.py.

def antlr3.CommonToken.getLine (   self  ) 

Get the line number on which this token was matched.

Lines are numbered 1..n

Using setter/getter methods is deprecated. Use o.line instead.

Reimplemented from antlr3.Token.

Definition at line 783 of file antlr3.py.

def antlr3.CommonToken.setLine (   self,
  line 
)

Set the line number on which this token was matched.

Using setter/getter methods is deprecated. Use o.line instead.

Reimplemented from antlr3.Token.

Definition at line 786 of file antlr3.py.

def antlr3.CommonToken.getCharPositionInLine (   self  ) 

Get the column of the tokens first character,.

Columns are numbered 0..n-1

Using setter/getter methods is deprecated. Use o.charPositionInLine instead.

Reimplemented from antlr3.Token.

Definition at line 790 of file antlr3.py.

def antlr3.CommonToken.setCharPositionInLine (   self,
  pos 
)

Set the column of the tokens first character,.

Using setter/getter methods is deprecated. Use o.charPositionInLine instead.

Reimplemented from antlr3.Token.

Definition at line 793 of file antlr3.py.

def antlr3.CommonToken.getChannel (   self  ) 

Get the channel of the token.

Using setter/getter methods is deprecated. Use o.channel instead.

Reimplemented from antlr3.Token.

Definition at line 797 of file antlr3.py.

def antlr3.CommonToken.setChannel (   self,
  channel 
)

Set the channel of the token.

Using setter/getter methods is deprecated. Use o.channel instead.

Reimplemented from antlr3.Token.

Definition at line 800 of file antlr3.py.

def antlr3.CommonToken.getTokenIndex (   self  ) 

Get the index in the input stream.

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.

Using setter/getter methods is deprecated. Use o.index instead.

Reimplemented from antlr3.Token.

Definition at line 804 of file antlr3.py.

def antlr3.CommonToken.setTokenIndex (   self,
  index 
)

Set the index in the input stream.

Using setter/getter methods is deprecated. Use o.index instead.

Reimplemented from antlr3.Token.

Definition at line 807 of file antlr3.py.

def antlr3.CommonToken.getInputStream (   self  ) 

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.

Reimplemented from antlr3.Token.

Definition at line 811 of file antlr3.py.

def antlr3.CommonToken.setInputStream (   self,
  input 
)

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.

Reimplemented from antlr3.Token.

Definition at line 814 of file antlr3.py.

def antlr3.CommonToken.__str__ (   self  ) 

Definition at line 818 of file antlr3.py.


Member Data Documentation

tuple antlr3.CommonToken.text = property(getText, setText) [static]

Definition at line 773 of file antlr3.py.

Definition at line 718 of file antlr3.py.

Definition at line 719 of file antlr3.py.

Definition at line 720 of file antlr3.py.

Definition at line 721 of file antlr3.py.

Definition at line 722 of file antlr3.py.

Definition at line 723 of file antlr3.py.

Definition at line 725 of file antlr3.py.

Definition at line 726 of file antlr3.py.

Definition at line 727 of file antlr3.py.


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

Generated on Mon Nov 29 17:24:26 2010 for ANTLR Python API by  doxygen 1.5.5