antlr3.ClassicToken Class Reference

Alternative token implementation. More...

Inheritance diagram for antlr3.ClassicToken:

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

Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def getText
 Get the text of the token.
def setText
 Set the text of the 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 toString

Public Attributes

 text
 type
 line
 charPositionInLine
 channel
 index

Static Private Attributes

 __str__ = toString
 __repr__ = toString


Detailed Description

Alternative token implementation.

A Token object like we'd use in ANTLR 2.x; has an actual string created and associated with this object. These objects are needed for imaginary tree nodes that have payload objects. We need to create a Token object that has a string; the tree node will point at this token. CommonToken has indexes into a char stream and hence cannot be used to introduce new strings.

Definition at line 830 of file antlr3.py.


Member Function Documentation

def antlr3.ClassicToken.__init__ (   self,
  type = None,
  text = None,
  channel = DEFAULT_CHANNEL,
  oldToken = None 
)

Definition at line 832 of file antlr3.py.

def antlr3.ClassicToken.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 852 of file antlr3.py.

def antlr3.ClassicToken.setText (   self,
  text 
)

Set the text of the token.

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

Reimplemented from antlr3.Token.

Definition at line 855 of file antlr3.py.

def antlr3.ClassicToken.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 859 of file antlr3.py.

def antlr3.ClassicToken.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 862 of file antlr3.py.

def antlr3.ClassicToken.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 866 of file antlr3.py.

def antlr3.ClassicToken.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 869 of file antlr3.py.

def antlr3.ClassicToken.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 873 of file antlr3.py.

def antlr3.ClassicToken.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 876 of file antlr3.py.

def antlr3.ClassicToken.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 880 of file antlr3.py.

def antlr3.ClassicToken.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 883 of file antlr3.py.

def antlr3.ClassicToken.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 887 of file antlr3.py.

def antlr3.ClassicToken.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 890 of file antlr3.py.

def antlr3.ClassicToken.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 894 of file antlr3.py.

def antlr3.ClassicToken.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 897 of file antlr3.py.

def antlr3.ClassicToken.toString (   self  ) 

Definition at line 901 of file antlr3.py.


Member Data Documentation

antlr3.ClassicToken.__str__ = toString [static, private]

Definition at line 919 of file antlr3.py.

antlr3.ClassicToken.__repr__ = toString [static, private]

Definition at line 920 of file antlr3.py.

Definition at line 836 of file antlr3.py.

Definition at line 837 of file antlr3.py.

Definition at line 838 of file antlr3.py.

Definition at line 839 of file antlr3.py.

Definition at line 840 of file antlr3.py.

Definition at line 847 of file antlr3.py.


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

Generated on Tue May 20 18:34:05 2008 for ANTLR Python API by  doxygen 1.5.5