/**
 * A simple mechanism for turning symbols that are represented as
 * integers (for speed) back into strings.
 *
 * @author Samuel A. Rebelsky
 * @version 1.0 of October 2002
 */
public class PascalSymbolPrinter
  implements SymbolPrinter
{
  // +---------+-----------------------------------------------------------
  // | Fields |
  // +---------+

  private String[] symbolNames;


  // +---------+-----------------------------------------------------------
  // | Constructors |
  // +---------+

  public PascalSymbolPrinter() {
    int NUM_SYMBOLS = PascalSymbols.numSymbols();
    symbolNames = new String[NUM_SYMBOLS];
    for (int i = 0; i < NUM_SYMBOLS; i++) {
      symbolNames[i] = "????
  } // PascalSymbolPrinter(void)


  // +---------+-----------------------------------------------------------
  // | Methods |
  // +---------+

  /**
   * Convert a numeric symbol to a string.
   */
  public String toString(int symbol)
  {
    switch (symbol) {
      case PascalSymbols.EXPRESSION:		return "<expression>";
      case PascalSymbols.FACTOR			return "<factor>";
      case PascalSymbols.IDENTIFIER_LIST:	return "<identifier_list>";
      case PascalSymbols.LABEL: 		return "<label>";
      case PascalSymbols.MULTIPLYING_OPERATOR:	return "<multiplying_operator>";
      case PascalSymbols.TERM:			return "<term>";
      case PascalSymbols.TYPE_IDENTIFIER:	return "<type_identifier>";
      case PascalSymbols.VARIABLE: 		return "<variable>";
      default:					return "?????";
    } // switch
  } // toString(int)
} // class PascalSymbolPrinter

