*Constants.java

PARSER_BEGIN(Test)

public class Test {
  public static void main(String args[]) throws ParseException {
    Test parser = new Test(System.in);
    parser.Input();
  }
}

PARSER_END(Test)

SKIP :
{
    <SPACE:  " " | "\t" | "\n" | "\r">
}

TOKEN :
{
    <A: "a"> |
    <B: "b">
}

void Input() :
{}
{
    ( <A> | <B> | "c" | "def" )+ <EOF>
}

で、TestConstants.java は、

/* Generated By:JavaCC: Do not edit this line. TestConstants.java */
public interface TestConstants {

  int EOF = 0;
  int SPACE = 1;
  int A = 2;
  int B = 3;

  int DEFAULT = 0;

  String[] tokenImage = {
    "<EOF>",
    "<SPACE>",
    "\"a\"",
    "\"b\"",
    "\"c\"",
    "\"def\"",
  };

}
PARSER_BEGIN(Test)

public class Test {
  public static void main(String args[]) throws ParseException {
    Test parser = new Test(System.in);
    parser.Input();
  }
}

PARSER_END(Test)

SKIP :
{
    " " | "\t" | "\n" | "\r"
}

TOKEN :
{
    <A: "a"> |
    <B: "b">
}

void Input() :
{}
{
    ( <A> | <B> | "c" | "def" )+
}

で、TestConstants.java は、

/* Generated By:JavaCC: Do not edit this line. TestConstants.java */
public interface TestConstants {

  int EOF = 0;
  int A = 5;
  int B = 6;

  int DEFAULT = 0;

  String[] tokenImage = {
    "<EOF>",
    "\" \"",
    "\"\\t\"",
    "\"\\n\"",
    "\"\\r\"",
    "\"a\"",
    "\"b\"",
    "\"c\"",
    "\"def\"",
  };

}