de.upb.swt.mcie.parser.token
Class Token

java.lang.Object
  extended by de.upb.swt.mcie.parser.token.Token
Direct Known Subclasses:
BinOp, Brack, Const, End, Id, Inval, Prime, Sep, UnOp

public abstract class Token
extends java.lang.Object

Implementation the common structure of all tokens. In particular, it deals with the position of the token in the scanned text as well as the text parsed for identifying it.

Author:
Ekkart Kindler, kindler@upb.de

Field Summary
private  int column
          The column in the character sequence at which the token starts.
private  int line
          The line in the character sequence at which the token starts.
private  java.lang.CharSequence text
          The text corresponding to this token.
 
Constructor Summary
Token()
           
 
Method Summary
 void setReference(java.lang.CharSequence text, int line, int column)
          Defines the reference of this token to the character sequence at which this token was encountered.
 java.lang.String toString()
          Returns the string representation of this token.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

line

private int line
The line in the character sequence at which the token starts.


column

private int column
The column in the character sequence at which the token starts.


text

private java.lang.CharSequence text
The text corresponding to this token.

Constructor Detail

Token

public Token()
Method Detail

setReference

public void setReference(java.lang.CharSequence text,
                         int line,
                         int column)
Defines the reference of this token to the character sequence at which this token was encountered.

Parameters:
text - the textual representation of the token
line - the line
column - the column

toString

public java.lang.String toString()
Returns the string representation of this token. This includes the position as well as the text itself.

Overrides:
toString in class java.lang.Object
Returns:
the string representation of this token