Package schrodinger :: Package application :: Package desmond :: Package antlr3 :: Module tokens :: Class CommonToken
[hide private]
[frames] | no frames]

Class CommonToken

object --+    
         |    
     Token --+
             |
            CommonToken

@brief 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.

Instance Methods [hide private]
 
__init__(self, type=None, channel=0, text=None, input=None, start=None, stop=None, oldToken=None)
x.__init__(...) initializes x; see help(type(x)) for signature
 
getText(self)
@brief Get the text of the token.
 
setText(self, text)
Override the text for this token.
 
getType(self)
@brief Get the type of the token.
 
setType(self, ttype)
@brief Get the type of the token.
 
getLine(self)
@brief Get the line number on which this token was matched
 
setLine(self, line)
@brief Set the line number on which this token was matched
 
getCharPositionInLine(self)
@brief Get the column of the tokens first character,
 
setCharPositionInLine(self, pos)
@brief Set the column of the tokens first character,
 
getChannel(self)
@brief Get the channel of the token
 
setChannel(self, channel)
@brief Set the channel of the token
 
getTokenIndex(self)
@brief Get the index in the input stream.
 
setTokenIndex(self, index)
@brief Set the index in the input stream.
 
getInputStream(self)
@brief From what character stream was this token created.
 
setInputStream(self, input)
@brief From what character stream was this token created.
 
__str__(self)
str(x)

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]
  text

Inherited from object: __class__

Method Details [hide private]

__init__(self, type=None, channel=0, text=None, input=None, start=None, stop=None, oldToken=None)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

getText(self)

 

@brief Get the text of the token.

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

Overrides: Token.getText
(inherited documentation)

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.

Overrides: Token.setText

getType(self)

 

@brief Get the type of the token.

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

Overrides: Token.getType
(inherited documentation)

setType(self, ttype)

 

@brief Get the type of the token.

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

Overrides: Token.setType
(inherited documentation)

getLine(self)

 

@brief 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.

Overrides: Token.getLine
(inherited documentation)

setLine(self, line)

 

@brief Set the line number on which this token was matched

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

Overrides: Token.setLine
(inherited documentation)

getCharPositionInLine(self)

 

@brief Get the column of the tokens first character,

Columns are numbered 0..n-1

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

Overrides: Token.getCharPositionInLine
(inherited documentation)

setCharPositionInLine(self, pos)

 

@brief Set the column of the tokens first character,

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

Overrides: Token.setCharPositionInLine
(inherited documentation)

getChannel(self)

 

@brief Get the channel of the token

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

Overrides: Token.getChannel
(inherited documentation)

setChannel(self, channel)

 

@brief Set the channel of the token

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

Overrides: Token.setChannel
(inherited documentation)

getTokenIndex(self)

 

@brief 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.

Overrides: Token.getTokenIndex
(inherited documentation)

setTokenIndex(self, index)

 

@brief Set the index in the input stream.

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

Overrides: Token.setTokenIndex
(inherited documentation)

getInputStream(self)

 

@brief 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.

Overrides: Token.getInputStream
(inherited documentation)

setInputStream(self, input)

 

@brief 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.

Overrides: Token.setInputStream
(inherited documentation)

__str__(self)
(Informal representation operator)

 

str(x)

Overrides: object.__str__
(inherited documentation)

Property Details [hide private]

text

Get Method:
getText(self) - @brief Get the text of the token.
Set Method:
setText(self, text) - Override the text for this token.