Class Token

java.lang.Object
com.teamten.tex.Token

public class Token extends Object
The commands we know about, and how to encode them as code points.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
    static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    fromCharacter(int ch)
    Return the pseudo-codepoint for the character command.
    static int
    Return the pseudo-codepoint for the keyword, or -1 if not found.
    static boolean
    isCommand(int ch)
    Whether the token is a command (\hbox or \+).
    static int
    toCharacter(int ch)
    Return the code point for the original command, or -1 if not a character command.
    static String
    toKeyword(int ch)
    Return the keyword for the character, or null if it doesn't map to a keyword.
    static String
    toString(int token)
    Convert to a user-friendly command, with backslash prefix if necessary.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • Token

      public Token()
  • Method Details

    • fromKeyword

      public static int fromKeyword(String keyword)
      Return the pseudo-codepoint for the keyword, or -1 if not found.
    • toKeyword

      public static String toKeyword(int ch)
      Return the keyword for the character, or null if it doesn't map to a keyword.
    • fromCharacter

      public static int fromCharacter(int ch)
      Return the pseudo-codepoint for the character command.
      Throws:
      IllegalArgumentException - if the character is too large to fit in the private use area.
    • toCharacter

      public static int toCharacter(int ch)
      Return the code point for the original command, or -1 if not a character command.
    • isCommand

      public static boolean isCommand(int ch)
      Whether the token is a command (\hbox or \+).
    • toString

      public static String toString(int token)
      Convert to a user-friendly command, with backslash prefix if necessary.