com.veromodo.tempo.util
Class IToken

java.lang.Object
  extended by antlr.Token
      extended by antlr.CommonToken
          extended by com.veromodo.tempo.util.IToken
All Implemented Interfaces:
java.lang.Cloneable

public class IToken
extends antlr.CommonToken

Representation for tokens in the grammar. Identifies the location of each token by its file name, offset, line, and column numbers. Inherits the following methods and fields from antlr.CommonToken:

Version:
4.0
Author:
Stephen J. Garland
See Also:
CommonToken

Field Summary
 
Fields inherited from class antlr.Token
badToken, EOF_TYPE, INVALID_TYPE, MIN_USER_TYPE, NULL_TREE_LOOKAHEAD, SKIP
 
Constructor Summary
IToken()
          Constructs a dummy IToken.
IToken(int t, java.lang.String s)
          Constructs an IToken.
IToken(java.lang.String s)
          Constructs an IToken with a given string representation.
IToken(antlr.Token t)
          Constructs a new IToken equal to a given ANTLR Token.
 
Method Summary
 boolean equals(IToken t)
          Returns true if this has the same token type and text as another IToken.
 boolean equals(java.lang.Object obj)
          Returns true if its argument is an IToken with the same token type and text as this.
 Extent getExtent()
          Returns the extent of this IToken.
 java.lang.String getFilename()
           
 int getLength()
          Returns the length of this IToken.
 int getOffset()
          Returns the byte offset of this IToken.
 int hashCode()
          Returns the hash code for this IToken.
 void setFilename(java.lang.String fn)
           
 void setOffset(int o)
          Sets the byte offset of this IToken.
 java.lang.String toString()
          Returns the text of this IToken.
 
Methods inherited from class antlr.CommonToken
getColumn, getLine, getText, setColumn, setLine, setText
 
Methods inherited from class antlr.Token
getType, setType
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IToken

public IToken()
Constructs a dummy IToken. Used by the parser.

See Also:
TIOAParser#currentToken(), TIOAParser#nextToken()

IToken

public IToken(java.lang.String s)
Constructs an IToken with a given string representation. TODO Can this constructor be eliminated? It is only invoked twice.


IToken

public IToken(antlr.Token t)
Constructs a new IToken equal to a given ANTLR Token. Preserves the offset of the token, if it is an IToken already. Used by the parser.

See Also:
TIOAParser#tok(Token)

IToken

public IToken(int t,
              java.lang.String s)
Constructs an IToken. Used by the lexer.

Parameters:
t - The type of the token
s - The string represented by the token
See Also:
TIOALexer#makeToken(int)
Method Detail

setFilename

public void setFilename(java.lang.String fn)
Overrides:
setFilename in class antlr.Token

getFilename

public java.lang.String getFilename()
Overrides:
getFilename in class antlr.Token

getExtent

public Extent getExtent()
Returns the extent of this IToken.


getLength

public int getLength()
Returns the length of this IToken.


getOffset

public int getOffset()
Returns the byte offset of this IToken.

See Also:
setOffset(int)

setOffset

public void setOffset(int o)
Sets the byte offset of this IToken.


equals

public boolean equals(java.lang.Object obj)
Returns true if its argument is an IToken with the same token type and text as this.

Overrides:
equals in class java.lang.Object

equals

public boolean equals(IToken t)
Returns true if this has the same token type and text as another IToken. The result can be true even if one IToken has a different Extent than the other.


hashCode

public int hashCode()
Returns the hash code for this IToken.

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Returns the text of this IToken.

Overrides:
toString in class antlr.CommonToken