Error processing request Token

de.dante.extex.scanner.type.token
Interface Token

All Known Subinterfaces:
CodeToken
All Known Implementing Classes:
AbstractToken, ActiveCharacterToken, ControlSequenceToken, CrToken, LeftBraceToken, LetterToken, MacroParamToken, MathShiftToken, OtherToken, RightBraceToken, SpaceToken, SubMarkToken, SupMarkToken, TabMarkToken

public interface Token

This is the interface for a token. A token is a pair of catcode and value. In most cases the value is a single character. Nevertheless it is also possible to store a complete string in the value – e.g. for control sequence tokens.

Tokens are immutable. Thus no setters for the attributes are provided.

Version:
$Revision: 1.6 $
Author:
Gerd Neugebauer, Michael Niedermair

Method Summary
 boolean equals(Catcode cc, char c)
          Compare the current token with a pair of catcode and character value.
 boolean equals(Catcode cc, java.lang.String s)
          Compare the current token with a pair of catcode and String value.
 boolean equals(char c)
          Compare the current token with a character value.
 boolean equals(java.lang.Object t)
          Compare the current token to another token.
 Catcode getCatcode()
          Getter for the catcode.
 UnicodeChar getChar()
          Getter for the value.
 boolean isa(Catcode cc)
          Check if the current token has a specified catcode.
 void toString(java.lang.StringBuffer sb)
          Print the token into a StringBuffer.
 java.lang.String toText()
          This method returns the textual representation for the Token.
 java.lang.String toText(UnicodeChar esc)
          Return the printable representation of this token as it can be read back in.
 java.lang.Object visit(TokenVisitor visitor, java.lang.Object arg1)
          Invoke the appropriate visit method for the current class.
 

Method Detail

equals

public boolean equals(Catcode cc,
                      char c)
Compare the current token with a pair of catcode and character value. This pair constitutes a virtual token. They are the same if the catcode and the value are the same.

Parameters:
cc - the catcode
c - the value
Returns:
true iff the tokens are equal

equals

public boolean equals(Catcode cc,
                      java.lang.String s)
Compare the current token with a pair of catcode and String value. This pair constitutes a virtual token. They are the same if the catcode and the value are the same.

Parameters:
cc - the catcode
s - the value
Returns:
true iff the tokens are equal

equals

public boolean equals(char c)
Compare the current token with a character value. They are the same if the values are the same.

Parameters:
c - the value
Returns:
true iff the tokens are equal

equals

public boolean equals(java.lang.Object t)
Compare the current token to another token. They are the same if the catcode and the value are the same.

Parameters:
t - the token to compare to
Returns:
true iff the tokens are equal

getCatcode

public Catcode getCatcode()
Getter for the catcode.

Returns:
the catcode

getChar

public UnicodeChar getChar()
Getter for the value.

Returns:
the value

isa

public boolean isa(Catcode cc)
Check if the current token has a specified catcode.

Parameters:
cc - the catcode to compare against
Returns:
true iff the catcodes coincide

toString

public void toString(java.lang.StringBuffer sb)
Print the token into a StringBuffer.

Parameters:
sb - the target string buffer

toText

public java.lang.String toText()
This method returns the textual representation for the Token. This textual representation might not contain the full information but can be used as an abbreviated form to be shown to the end user. A representation with more complete information can be received with the method toString().

Returns:
the textual representation

toText

public java.lang.String toText(UnicodeChar esc)
Return the printable representation of this token as it can be read back in.

Parameters:
esc - the escape character
Returns:
the printable representation

visit

public java.lang.Object visit(TokenVisitor visitor,
                              java.lang.Object arg1)
                       throws java.lang.Exception
Invoke the appropriate visit method for the current class.

Parameters:
visitor - the calling visitor
arg1 - the first argument to pass
Returns:
the result object
Throws:
java.lang.Exception - in case of an error