de.dante.extex.scanner.type
Class Catcode

java.lang.Object
  extended byde.dante.extex.scanner.type.Catcode
All Implemented Interfaces:
java.io.Serializable

public abstract class Catcode
extends java.lang.Object
implements java.io.Serializable

This class provides a type-save enumeration of the category codes for characters. This is accomplished by the use of several static classes which are derived from the common abstract super class Catcode.

This class contains some inner classes representing the various incarnations of a catcode. Externally only some static constants for category codes are accessible.

Version:
$Revision: 1.5 $
Author:
Gerd Neugebauer, Michael Niedermair
See Also:
Serialized Form

Field Summary
static Catcode ACTIVE
          The constant ACTIVE contains the unique object representing the active catcode.
static Catcode COMMENT
          The constant COMMENT contains the unique object representing the comment catcode.
static Catcode CR
          The constant CR contains the unique object representing the cr catcode.
static Catcode ESCAPE
          The constant ESCAPE contains the unique object representing the escape catcode used to initiate control sequences.
static Catcode IGNORE
          The constant IGNORE contains the unique object representing the ignore catcode.
static Catcode INVALID
          The constant INVALID contains the unique object representing the invalid catcode.
static Catcode LEFTBRACE
          The constant LEFTBRACE contains the unique object representing the left brace catcode.
static Catcode LETTER
          The constant LETTER contains the unique object representing the letter catcode.
static Catcode MACROPARAM
          The constant MACROPARAM contains the unique object representing the macro param catcode.
static Catcode MATHSHIFT
          The constant MATHSHIFT contains the unique object representing the math shift catcode.
static Catcode OTHER
          The constant OTHER contains the unique object representing the other catcode.
static Catcode RIGHTBRACE
          The constant RIGHTBRACE contains the unique object representing the right brace catcode.
static Catcode SPACE
          The constant SPACE contains the unique object representing the space catcode.
static Catcode SUBMARK
          The constant SUBMARK contains the unique object representing the sub mark catcode.
static Catcode SUPMARK
          The constant SUPMARK contains the unique object representing the super mark catcode.
static Catcode TABMARK
          The constant TABMARK contains the unique object representing the tab mark catcode.
 
Method Summary
static int getCatcodeMax()
          Getter for the maximal numerical catcode.
 int getCode()
          Get the numerical representation for the Catcode.
static int getCode(Catcode cc)
          Get the numerical representation for the Catcode.
abstract  java.lang.String getName()
          Getter for the name of the catcode.
static Catcode toCatcode(int theCode)
          Return a catcode for a given numerical value.
 java.lang.String toString()
          Get the string representation of the catcode.
abstract  java.lang.Object visit(CatcodeVisitor visitor, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
          Catcode support the visitor pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ACTIVE

public static final Catcode ACTIVE
The constant ACTIVE contains the unique object representing the active catcode.


COMMENT

public static final Catcode COMMENT
The constant COMMENT contains the unique object representing the comment catcode. A comment is started with this catcode and lasts to the end of the line.


CR

public static final Catcode CR
The constant CR contains the unique object representing the cr catcode.


ESCAPE

public static final Catcode ESCAPE
The constant ESCAPE contains the unique object representing the escape catcode used to initiate control sequences.


IGNORE

public static final Catcode IGNORE
The constant IGNORE contains the unique object representing the ignore catcode.


INVALID

public static final Catcode INVALID
The constant INVALID contains the unique object representing the invalid catcode.


LEFTBRACE

public static final Catcode LEFTBRACE
The constant LEFTBRACE contains the unique object representing the left brace catcode.


LETTER

public static final Catcode LETTER
The constant LETTER contains the unique object representing the letter catcode.


MACROPARAM

public static final Catcode MACROPARAM
The constant MACROPARAM contains the unique object representing the macro param catcode.


MATHSHIFT

public static final Catcode MATHSHIFT
The constant MATHSHIFT contains the unique object representing the math shift catcode.


OTHER

public static final Catcode OTHER
The constant OTHER contains the unique object representing the other catcode.


RIGHTBRACE

public static final Catcode RIGHTBRACE
The constant RIGHTBRACE contains the unique object representing the right brace catcode.


SPACE

public static final Catcode SPACE
The constant SPACE contains the unique object representing the space catcode.


SUBMARK

public static final Catcode SUBMARK
The constant SUBMARK contains the unique object representing the sub mark catcode.


SUPMARK

public static final Catcode SUPMARK
The constant SUPMARK contains the unique object representing the super mark catcode.


TABMARK

public static final Catcode TABMARK
The constant TABMARK contains the unique object representing the tab mark catcode.

Method Detail

getCatcodeMax

public static int getCatcodeMax()
Getter for the maximal numerical catcode.

Returns:
the maximal allowed category code

getCode

public static int getCode(Catcode cc)
Get the numerical representation for the Catcode.

Parameters:
cc - the catcode to map
Returns:
the catcode as integer

getCode

public int getCode()
Get the numerical representation for the Catcode.

Returns:
the catcode as integer

toCatcode

public static Catcode toCatcode(int theCode)
                         throws CatcodeException
Return a catcode for a given numerical value.

Parameters:
theCode - the numerical code.
Returns:
the catcode
Throws:
CatcodeException - in case that the catcode is not in the allowed range

getName

public abstract java.lang.String getName()
Getter for the name of the catcode.

Returns:
the name

toString

public java.lang.String toString()
Get the string representation of the catcode.

Returns:
the string representation

visit

public abstract java.lang.Object visit(CatcodeVisitor visitor,
                                       java.lang.Object arg1,
                                       java.lang.Object arg2,
                                       java.lang.Object arg3)
                                throws java.lang.Exception
Catcode support the visitor pattern. This method is the entry for visiting CATCODE.

Parameters:
visitor - the visitor
arg1 - the first argument to pass
arg2 - the second argument to pass
arg3 - the third argument to pass
Returns:
some return value form the visit
Throws:
java.lang.Exception - in case of an error