/* Generated By:JavaCC: Do not edit this line. TheParser.java */
package csp;

import edu.neu.ccs.demeterf.lib.*;
import edu.neu.ccs.demeterf.lib.*;
import edu.neu.ccs.demeterf.lib.*;
import edu.neu.ccs.demeterf.lib.*;
import scg.*;
import java.util.Iterator;
import edu.neu.ccs.demeterf.Fields;
import edu.neu.ccs.demeterf.lib.ident;
import edu.neu.ccs.demeterf.lib.verbatim;

  public class TheParser implements TheParserConstants {

   public static String unescape(String str){
      String retval = "";
      int index = 0;
      char ch, ch1;
      int ordinal = 0;
      while (index < str.length()) {
         if(str.charAt(index) != '\u005c\u005c') { retval += str.charAt(index++); continue; }
         ch = str.charAt(++index);
         if(ch == 'b') { retval += '\u005cb'; index++; continue; }
         if(ch == 't') { retval += '\u005ct'; index++; continue; }
         if(ch == 'n') { retval += '\u005cn'; index++; continue; }
         if(ch == 'f') { retval += '\u005cf'; index++; continue; }
         if(ch == 'r') { retval += '\u005cr'; index++; continue; }
         if(ch == '"') { retval += '\u005c"'; index++; continue; }
         if(ch == '\u005c'') { retval += '\u005c''; index++; continue; }
         if(ch == '\u005c\u005c') { retval += '\u005c\u005c'; index++; continue; }
         if(ch >= '0' && ch <= '7'){
            ordinal = ((int)ch) - ((int)'0'); index++;
            ch1 = str.charAt(index);
            if(ch1 >= '0' && ch1 <= '7'){
               ordinal = ordinal*8 + ((int)ch1) - ((int)'0'); index++;
               ch1 = str.charAt(index);
               if(ch <= '3' && ch1 >= '0' && ch1 <= '7'){
                  ordinal = ordinal*8 + ((int)ch1) - ((int)'0'); index++;
               }
            }
            retval += (char)ordinal;
            continue;
         }
         if(ch == 'u'){
            ordinal = 0;
            for(int i = 0; i < 4; i++){
               index++; ch = str.charAt(index);
               ordinal = ordinal*16+hexval(ch);
            }
            index++;
            retval += (char)ordinal;
            continue;
         }
      }
      return retval;
   }
   static int hexval(char c){
      int r = "0123456789ABCDEF".indexOf(Character.toUpperCase(c));
      if(r >= 0)return r;
      throw new RuntimeException(" ** Bad Escaped Character");
   }

  final public byte parse_byte() throws ParseException {
                    int i;
    i = parse_int();
                      {if (true) return (byte)i;}
    throw new Error("Missing return statement in function");
  }

  final public Byte parse_Byte() throws ParseException {
                    byte b;
    b = parse_byte();
                       {if (true) return b;}
    throw new Error("Missing return statement in function");
  }

  final public short parse_short() throws ParseException {
                      int i;
    i = parse_int();
                      {if (true) return (short)i;}
    throw new Error("Missing return statement in function");
  }

  final public Short parse_Short() throws ParseException {
                      short s;
    s = parse_short();
                        {if (true) return s;}
    throw new Error("Missing return statement in function");
  }

  final public int parse_int() throws ParseException {
                  Token t;
    t = jj_consume_token(INT);
      if(t.image.length() > 1 && Character.toLowerCase(t.image.charAt(1)) == 'x')
          {if (true) return Integer.parseInt(t.image.substring(2), 16);}
      {if (true) return Integer.parseInt(t.image);}
    throw new Error("Missing return statement in function");
  }

  final public Integer parse_Integer() throws ParseException {
                          int i;
    i = parse_int();
                      {if (true) return i;}
    throw new Error("Missing return statement in function");
  }

  final public long parse_long() throws ParseException {
                    Token t;
    t = jj_consume_token(INT);
      if(t.image.length() > 1 && Character.toLowerCase(t.image.charAt(1)) == 'x')
          {if (true) return Long.parseLong(t.image.substring(2), 16);}
    {if (true) return Long.parseLong(t.image);}
    throw new Error("Missing return statement in function");
  }

  final public Long parse_Long() throws ParseException {
                    long l;
    l = parse_long();
                       {if (true) return l;}
    throw new Error("Missing return statement in function");
  }

  final public double parse_double() throws ParseException {
                        Token t;
    t = jj_consume_token(DOUBLE);
      {if (true) return Double.parseDouble(t.image);}
    throw new Error("Missing return statement in function");
  }

  final public Double parse_Double() throws ParseException {
                        double d;
    d = parse_double();
                         {if (true) return d;}
    throw new Error("Missing return statement in function");
  }

  final public float parse_float() throws ParseException {
                      Token t;
    t = jj_consume_token(DOUBLE);
      {if (true) return Float.parseFloat(t.image);}
    throw new Error("Missing return statement in function");
  }

  final public Float parse_Float() throws ParseException {
                      float f;
    f = parse_float();
                        {if (true) return f;}
    throw new Error("Missing return statement in function");
  }

  final public String parse_String() throws ParseException {
                        Token t;
    t = jj_consume_token(STRING);
      {if (true) return unescape(t.image.substring(1,t.image.length()-1));}
    throw new Error("Missing return statement in function");
  }

  final public boolean parse_boolean() throws ParseException {
                          Token t;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case TRUE:
      t = jj_consume_token(TRUE);
                 {if (true) return true;}
      break;
    case FALSE:
      t = jj_consume_token(FALSE);
                  {if (true) return false;}
      break;
    default:
      jj_la1[0] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

  final public Boolean parse_Boolean() throws ParseException {
                          boolean b;
    b = parse_boolean();
                          {if (true) return b;}
    throw new Error("Missing return statement in function");
  }

  final public char parse_char() throws ParseException {
                    Token t;
    t = jj_consume_token(CHAR);
      {if (true) return unescape(t.image.substring(1,t.image.length()-1)).charAt(0);}
    throw new Error("Missing return statement in function");
  }

  final public Character parse_Character() throws ParseException {
                              char c;
    c = parse_char();
                       {if (true) return c;}
    throw new Error("Missing return statement in function");
  }

  final public ident parse_ident() throws ParseException {
                      Token t;
    t = jj_consume_token(IDENT);
      {if (true) return new ident(t.image);}
    throw new Error("Missing return statement in function");
  }

  final public verbatim parse_verbatim() throws ParseException {
                            Token t;
    t = jj_consume_token(TEXT);
      {if (true) return new verbatim(t.image.substring(2,t.image.length()-2));}
    throw new Error("Missing return statement in function");
  }

  final public CSPInstance parse_CSPInstance() throws ParseException {
     List<Var> vars;
     Cons<Clause> clauses;
    vars = parse_List$Var$();
    clauses = parse_Cons$Clause$();
      {if (true) return new CSPInstance(vars,clauses);}
    throw new Error("Missing return statement in function");
  }

  final public Clause parse_Clause() throws ParseException {
     int relnum;
     int weight;
     List<Var> vars;
    jj_consume_token(1);
    relnum = parse_int();
    jj_consume_token(2);
    weight = parse_int();
    jj_consume_token(3);
    vars = parse_List$Var$();
    jj_consume_token(4);
      {if (true) return new Clause(relnum,weight,vars);}
    throw new Error("Missing return statement in function");
  }

  final public CSPSolution parse_CSPSolution() throws ParseException {
     ListMap<Var,Boolean> assign;
    assign = parse_ListMap$Var$Boolean$();
      {if (true) return new CSPSolution(assign);}
    throw new Error("Missing return statement in function");
  }

  final public Var parse_Var() throws ParseException {
     ident id;
    id = parse_ident();
      {if (true) return new Var(id);}
    throw new Error("Missing return statement in function");
  }

  final public CSPInstanceSet parse_CSPInstanceSet() throws ParseException {
     ListSet<Integer> type;
    jj_consume_token(1);
    type = parse_ListSet$Integer$();
    jj_consume_token(4);
      {if (true) return new CSPInstanceSet(type);}
    throw new Error("Missing return statement in function");
  }

  final public CSPDomain parse_CSPDomain() throws ParseException {
      {if (true) return new CSPDomain();}
    throw new Error("Missing return statement in function");
  }

  final public CSPConfig parse_CSPConfig() throws ParseException {
     int maxRelNum;
     int maxVariables;
    jj_consume_token(5);
    jj_consume_token(6);
    maxRelNum = parse_int();
    jj_consume_token(7);
    maxVariables = parse_int();
    jj_consume_token(8);
      {if (true) return new CSPConfig(maxRelNum,maxVariables);}
    throw new Error("Missing return statement in function");
  }

  final public FullyQualifiedClassName parse_FullyQualifiedClassName() throws ParseException {
     ident name;
     DSLOI rest;
    name = parse_ident();
    rest = parse_DSLOI();
      {if (true) return new FullyQualifiedClassName(name,rest);}
    throw new Error("Missing return statement in function");
  }

  final public DSLOI parse_DSLOI() throws ParseException {
    DSLOI sup = null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 9:
      sup = parse_DSCOI();
                          {if (true) return sup;}
      break;
    default:
      jj_la1[1] = jj_gen;
      sup = parse_DSEOI();
                          {if (true) return sup;}
    }
    throw new Error("Missing return statement in function");
  }

  final public DSCOI parse_DSCOI() throws ParseException {
     ident first;
     DSLOI rest;
    jj_consume_token(9);
    first = parse_ident();
    rest = parse_DSLOI();
      {if (true) return new DSCOI(first,rest);}
    throw new Error("Missing return statement in function");
  }

  final public DSEOI parse_DSEOI() throws ParseException {
      {if (true) return new DSEOI();}
    throw new Error("Missing return statement in function");
  }

  final public DomainI parse_DomainI() throws ParseException {
    DomainI sup = null;
     {if (true) return sup;}
    throw new Error("Missing return statement in function");
  }

  final public InstanceI parse_InstanceI() throws ParseException {
    InstanceI sup = null;
     {if (true) return sup;}
    throw new Error("Missing return statement in function");
  }

  final public SolutionI parse_SolutionI() throws ParseException {
    SolutionI sup = null;
     {if (true) return sup;}
    throw new Error("Missing return statement in function");
  }

  final public InstanceSetI parse_InstanceSetI() throws ParseException {
    InstanceSetI sup = null;
     {if (true) return sup;}
    throw new Error("Missing return statement in function");
  }

  final public Claim parse_Claim() throws ParseException {
     RWrap<InstanceSetI> instanceSetWrapper;
     RWrap<ProtocolI> protocolWrapper;
     double quality;
     double confidence;
    instanceSetWrapper = parse_RWrap$InstanceSetI$();
    protocolWrapper = parse_RWrap$ProtocolI$();
    quality = parse_double();
    confidence = parse_double();
      {if (true) return new Claim(instanceSetWrapper,protocolWrapper,quality,confidence);}
    throw new Error("Missing return statement in function");
  }

  final public ProtocolI parse_ProtocolI() throws ParseException {
    ProtocolI sup = null;
     {if (true) return sup;}
    throw new Error("Missing return statement in function");
  }

  final public ProtocolSpec parse_ProtocolSpec() throws ParseException {
     List<Step> steps;
    steps = parse_List$Step$();
      {if (true) return new ProtocolSpec(steps);}
    throw new Error("Missing return statement in function");
  }

  final public Step parse_Step() throws ParseException {
     Action action;
     Role role;
    action = parse_Action();
    jj_consume_token(10);
    role = parse_Role();
      {if (true) return new Step(action,role);}
    throw new Error("Missing return statement in function");
  }

  final public Role parse_Role() throws ParseException {
    Role sup = null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 11:
      sup = parse_Alice();
                          {if (true) return sup;}
      break;
    case 12:
      sup = parse_Bob();
                        {if (true) return sup;}
      break;
    default:
      jj_la1[2] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

  final public Alice parse_Alice() throws ParseException {
    jj_consume_token(11);
      {if (true) return new Alice();}
    throw new Error("Missing return statement in function");
  }

  final public Bob parse_Bob() throws ParseException {
    jj_consume_token(12);
      {if (true) return new Bob();}
    throw new Error("Missing return statement in function");
  }

  final public Action parse_Action() throws ParseException {
    Action sup = null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 13:
      sup = parse_ProvideAction();
                                  {if (true) return sup;}
      break;
    case 14:
      sup = parse_SolveAction();
                                {if (true) return sup;}
      break;
    default:
      jj_la1[3] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

  final public ProvideAction parse_ProvideAction() throws ParseException {
    jj_consume_token(13);
      {if (true) return new ProvideAction();}
    throw new Error("Missing return statement in function");
  }

  final public SolveAction parse_SolveAction() throws ParseException {
     int stepNo;
    jj_consume_token(14);
    jj_consume_token(15);
    stepNo = parse_int();
      {if (true) return new SolveAction(stepNo);}
    throw new Error("Missing return statement in function");
  }

  final public Request parse_Request() throws ParseException {
     List<Claim> forbidden;
     List<Claim> claimsToOppose;
     List<ProtocolRequest> protocolRequests;
    jj_consume_token(16);
    forbidden = parse_List$Claim$();
    jj_consume_token(17);
    claimsToOppose = parse_List$Claim$();
    jj_consume_token(18);
    protocolRequests = parse_List$ProtocolRequest$();
      {if (true) return new Request(forbidden,claimsToOppose,protocolRequests);}
    throw new Error("Missing return statement in function");
  }

  final public ProtocolRequest parse_ProtocolRequest() throws ParseException {
    ProtocolRequest sup = null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 19:
      sup = parse_ProvideRequest();
                                   {if (true) return sup;}
      break;
    case 20:
      sup = parse_SolveRequest();
                                 {if (true) return sup;}
      break;
    default:
      jj_la1[4] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

  final public ProvideRequest parse_ProvideRequest() throws ParseException {
     Claim claimToBeProvided;
    jj_consume_token(19);
    claimToBeProvided = parse_Claim();
      {if (true) return new ProvideRequest(claimToBeProvided);}
    throw new Error("Missing return statement in function");
  }

  final public SolveRequest parse_SolveRequest() throws ParseException {
     RWrap<InstanceI> instanceWrapper;
     Option<Claim> claim;
    jj_consume_token(20);
    instanceWrapper = parse_RWrap$InstanceI$();
    claim = parse_Option$Claim$();
      {if (true) return new SolveRequest(instanceWrapper,claim);}
    throw new Error("Missing return statement in function");
  }

  final public Response parse_Response() throws ParseException {
     List<Claim> proposed;
     List<OpposeAction> oppositions;
     List<ProtocolResponse> protocolResponses;
    jj_consume_token(16);
    proposed = parse_List$Claim$();
    jj_consume_token(17);
    oppositions = parse_List$OpposeAction$();
    jj_consume_token(21);
    protocolResponses = parse_List$ProtocolResponse$();
      {if (true) return new Response(proposed,oppositions,protocolResponses);}
    throw new Error("Missing return statement in function");
  }

  final public OpposeAction parse_OpposeAction() throws ParseException {
    OpposeAction sup = null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 23:
      sup = parse_Strengthening();
                                  {if (true) return sup;}
      break;
    case 24:
      sup = parse_Refuting();
                             {if (true) return sup;}
      break;
    case 22:
      sup = parse_Agreement();
                              {if (true) return sup;}
      break;
    default:
      jj_la1[5] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

  final public Agreement parse_Agreement() throws ParseException {
    jj_consume_token(22);
      {if (true) return new Agreement();}
    throw new Error("Missing return statement in function");
  }

  final public Strengthening parse_Strengthening() throws ParseException {
     double newQuality;
    jj_consume_token(23);
    newQuality = parse_double();
      {if (true) return new Strengthening(newQuality);}
    throw new Error("Missing return statement in function");
  }

  final public Refuting parse_Refuting() throws ParseException {
    jj_consume_token(24);
      {if (true) return new Refuting();}
    throw new Error("Missing return statement in function");
  }

  final public ProtocolResponse parse_ProtocolResponse() throws ParseException {
    ProtocolResponse sup = null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 19:
      sup = parse_ProvideResponse();
                                    {if (true) return sup;}
      break;
    case 20:
      sup = parse_SolveResponse();
                                  {if (true) return sup;}
      break;
    default:
      jj_la1[6] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

  final public ProvideResponse parse_ProvideResponse() throws ParseException {
     RWrap<InstanceI> instanceWrapper;
    jj_consume_token(19);
    instanceWrapper = parse_RWrap$InstanceI$();
      {if (true) return new ProvideResponse(instanceWrapper);}
    throw new Error("Missing return statement in function");
  }

  final public SolveResponse parse_SolveResponse() throws ParseException {
     RWrap<SolutionI> solutionWrapper;
    jj_consume_token(20);
    solutionWrapper = parse_RWrap$SolutionI$();
      {if (true) return new SolveResponse(solutionWrapper);}
    throw new Error("Missing return statement in function");
  }

  final public SCGConfig parse_SCGConfig() throws ParseException {
     FullyQualifiedClassName domain;
     Cons<FullyQualifiedClassName> protocols;
     TournamentStyle tournamentStyle;
     int turnDuration;
     int maxNumAvatars;
     double minStrengthening;
     double initialReputation;
     double maxReputation;
     double reputationFactor;
     int minProposals;
     int maxProposals;
     int numRounds;
     boolean proposedClaimMustBeNew;
     double minConfidence;
    jj_consume_token(25);
    jj_consume_token(26);
    domain = parse_FullyQualifiedClassName();
    jj_consume_token(27);
    protocols = parse_Cons$FullyQualifiedClassName$();
    jj_consume_token(28);
    tournamentStyle = parse_TournamentStyle();
    jj_consume_token(29);
    turnDuration = parse_int();
    jj_consume_token(30);
    maxNumAvatars = parse_int();
    jj_consume_token(31);
    minStrengthening = parse_double();
    jj_consume_token(32);
    initialReputation = parse_double();
    jj_consume_token(33);
    maxReputation = parse_double();
    jj_consume_token(34);
    reputationFactor = parse_double();
    jj_consume_token(35);
    minProposals = parse_int();
    jj_consume_token(36);
    maxProposals = parse_int();
    jj_consume_token(37);
    numRounds = parse_int();
    jj_consume_token(38);
    proposedClaimMustBeNew = parse_boolean();
    jj_consume_token(39);
    minConfidence = parse_double();
    jj_consume_token(8);
      {if (true) return new SCGConfig(domain,protocols,tournamentStyle,turnDuration,maxNumAvatars,minStrengthening,initialReputation,maxReputation,reputationFactor,minProposals,maxProposals,numRounds,proposedClaimMustBeNew,minConfidence);}
    throw new Error("Missing return statement in function");
  }

  final public TournamentStyle parse_TournamentStyle() throws ParseException {
    TournamentStyle sup = null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 40:
      sup = parse_FullRoundRobin();
                                   {if (true) return sup;}
      break;
    case 42:
      sup = parse_KnockOut();
                             {if (true) return sup;}
      break;
    case 43:
      sup = parse_SwissStyleTournament();
                                         {if (true) return sup;}
      break;
    default:
      jj_la1[7] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

  final public FullRoundRobin parse_FullRoundRobin() throws ParseException {
    jj_consume_token(40);
    jj_consume_token(41);
      {if (true) return new FullRoundRobin();}
    throw new Error("Missing return statement in function");
  }

  final public KnockOut parse_KnockOut() throws ParseException {
    jj_consume_token(42);
      {if (true) return new KnockOut();}
    throw new Error("Missing return statement in function");
  }

  final public SwissStyleTournament parse_SwissStyleTournament() throws ParseException {
    jj_consume_token(43);
      {if (true) return new SwissStyleTournament();}
    throw new Error("Missing return statement in function");
  }

  final public DomainConfigI parse_DomainConfigI() throws ParseException {
    DomainConfigI sup = null;
     {if (true) return sup;}
    throw new Error("Missing return statement in function");
  }

  final public Config parse_Config() throws ParseException {
     SCGConfig scgCfg;
     RWrap<DomainConfigI> domainConfigWrapper;
    scgCfg = parse_SCGConfig();
    domainConfigWrapper = parse_RWrap$DomainConfigI$();
      {if (true) return new Config(scgCfg,domainConfigWrapper);}
    throw new Error("Missing return statement in function");
  }

  final public AvatarI parse_AvatarI() throws ParseException {
    AvatarI sup = null;
     {if (true) return sup;}
    throw new Error("Missing return statement in function");
  }

  final public RBColor parse_RBColor() throws ParseException {
    RBColor sup = null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 44:
      sup = parse_RED();
                        {if (true) return sup;}
      break;
    case 45:
      sup = parse_BLACK();
                          {if (true) return sup;}
      break;
    default:
      jj_la1[8] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    throw new Error("Missing return statement in function");
  }

  final public RED parse_RED() throws ParseException {
    jj_consume_token(44);
      {if (true) return new RED();}
    throw new Error("Missing return statement in function");
  }

  final public BLACK parse_BLACK() throws ParseException {
    jj_consume_token(45);
      {if (true) return new BLACK();}
    throw new Error("Missing return statement in function");
  }

  final public RWrap<DomainConfigI> parse_RWrap$DomainConfigI$() throws ParseException {
     FullyQualifiedClassName className;
     verbatim wrappee;
    className = parse_FullyQualifiedClassName();
    wrappee = parse_verbatim();
      {if (true) return new RWrap<DomainConfigI>(className,wrappee);}
    throw new Error("Missing return statement in function");
  }

  final public Cons<FullyQualifiedClassName> parse_Cons$FullyQualifiedClassName$() throws ParseException {
     FullyQualifiedClassName first;
     List<FullyQualifiedClassName> rest;
    first = parse_FullyQualifiedClassName();
    rest = parse_List$FullyQualifiedClassName$();
      {if (true) return new Cons<FullyQualifiedClassName>(first,rest);}
    throw new Error("Missing return statement in function");
  }

  final public List<FullyQualifiedClassName> parse_List$FullyQualifiedClassName$() throws ParseException {
    List<FullyQualifiedClassName> sup = null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case IDENT:
      sup = parse_Cons$FullyQualifiedClassName$();
                                                  {if (true) return sup;}
      break;
    default:
      jj_la1[9] = jj_gen;
      sup = parse_Empty$FullyQualifiedClassName$();
                                                   {if (true) return sup;}
    }
    throw new Error("Missing return statement in function");
  }

  final public Empty<FullyQualifiedClassName> parse_Empty$FullyQualifiedClassName$() throws ParseException {
      {if (true) return new Empty<FullyQualifiedClassName>();}
    throw new Error("Missing return statement in function");
  }

  final public RWrap<SolutionI> parse_RWrap$SolutionI$() throws ParseException {
     FullyQualifiedClassName className;
     verbatim wrappee;
    className = parse_FullyQualifiedClassName();
    wrappee = parse_verbatim();
      {if (true) return new RWrap<SolutionI>(className,wrappee);}
    throw new Error("Missing return statement in function");
  }

  final public RWrap<InstanceI> parse_RWrap$InstanceI$() throws ParseException {
     FullyQualifiedClassName className;
     verbatim wrappee;
    className = parse_FullyQualifiedClassName();
    wrappee = parse_verbatim();
      {if (true) return new RWrap<InstanceI>(className,wrappee);}
    throw new Error("Missing return statement in function");
  }

  final public List<ProtocolResponse> parse_List$ProtocolResponse$() throws ParseException {
    List<ProtocolResponse> sup = null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 19:
    case 20:
      sup = parse_Cons$ProtocolResponse$();
                                           {if (true) return sup;}
      break;
    default:
      jj_la1[10] = jj_gen;
      sup = parse_Empty$ProtocolResponse$();
                                            {if (true) return sup;}
    }
    throw new Error("Missing return statement in function");
  }

  final public Empty<ProtocolResponse> parse_Empty$ProtocolResponse$() throws ParseException {
      {if (true) return new Empty<ProtocolResponse>();}
    throw new Error("Missing return statement in function");
  }

  final public Cons<ProtocolResponse> parse_Cons$ProtocolResponse$() throws ParseException {
     ProtocolResponse first;
     List<ProtocolResponse> rest;
    first = parse_ProtocolResponse();
    rest = parse_List$ProtocolResponse$();
      {if (true) return new Cons<ProtocolResponse>(first,rest);}
    throw new Error("Missing return statement in function");
  }

  final public List<OpposeAction> parse_List$OpposeAction$() throws ParseException {
    List<OpposeAction> sup = null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 22:
    case 23:
    case 24:
      sup = parse_Cons$OpposeAction$();
                                       {if (true) return sup;}
      break;
    default:
      jj_la1[11] = jj_gen;
      sup = parse_Empty$OpposeAction$();
                                        {if (true) return sup;}
    }
    throw new Error("Missing return statement in function");
  }

  final public Empty<OpposeAction> parse_Empty$OpposeAction$() throws ParseException {
      {if (true) return new Empty<OpposeAction>();}
    throw new Error("Missing return statement in function");
  }

  final public Cons<OpposeAction> parse_Cons$OpposeAction$() throws ParseException {
     OpposeAction first;
     List<OpposeAction> rest;
    first = parse_OpposeAction();
    rest = parse_List$OpposeAction$();
      {if (true) return new Cons<OpposeAction>(first,rest);}
    throw new Error("Missing return statement in function");
  }

  final public List<Claim> parse_List$Claim$() throws ParseException {
    List<Claim> sup = null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case IDENT:
      sup = parse_Cons$Claim$();
                                {if (true) return sup;}
      break;
    default:
      jj_la1[12] = jj_gen;
      sup = parse_Empty$Claim$();
                                 {if (true) return sup;}
    }
    throw new Error("Missing return statement in function");
  }

  final public Empty<Claim> parse_Empty$Claim$() throws ParseException {
      {if (true) return new Empty<Claim>();}
    throw new Error("Missing return statement in function");
  }

  final public Cons<Claim> parse_Cons$Claim$() throws ParseException {
     Claim first;
     List<Claim> rest;
    first = parse_Claim();
    rest = parse_List$Claim$();
      {if (true) return new Cons<Claim>(first,rest);}
    throw new Error("Missing return statement in function");
  }

  final public Option<Claim> parse_Option$Claim$() throws ParseException {
    Option<Claim> sup = null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case IDENT:
      sup = parse_Some$Claim$();
                                {if (true) return sup;}
      break;
    default:
      jj_la1[13] = jj_gen;
      sup = parse_None$Claim$();
                                {if (true) return sup;}
    }
    throw new Error("Missing return statement in function");
  }

  final public None<Claim> parse_None$Claim$() throws ParseException {
      {if (true) return new None<Claim>();}
    throw new Error("Missing return statement in function");
  }

  final public Some<Claim> parse_Some$Claim$() throws ParseException {
     Claim just;
    just = parse_Claim();
      {if (true) return new Some<Claim>(just);}
    throw new Error("Missing return statement in function");
  }

  final public List<ProtocolRequest> parse_List$ProtocolRequest$() throws ParseException {
    List<ProtocolRequest> sup = null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 19:
    case 20:
      sup = parse_Cons$ProtocolRequest$();
                                          {if (true) return sup;}
      break;
    default:
      jj_la1[14] = jj_gen;
      sup = parse_Empty$ProtocolRequest$();
                                           {if (true) return sup;}
    }
    throw new Error("Missing return statement in function");
  }

  final public Empty<ProtocolRequest> parse_Empty$ProtocolRequest$() throws ParseException {
      {if (true) return new Empty<ProtocolRequest>();}
    throw new Error("Missing return statement in function");
  }

  final public Cons<ProtocolRequest> parse_Cons$ProtocolRequest$() throws ParseException {
     ProtocolRequest first;
     List<ProtocolRequest> rest;
    first = parse_ProtocolRequest();
    rest = parse_List$ProtocolRequest$();
      {if (true) return new Cons<ProtocolRequest>(first,rest);}
    throw new Error("Missing return statement in function");
  }

  final public List<Step> parse_List$Step$() throws ParseException {
    List<Step> sup = null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 13:
    case 14:
      sup = parse_Cons$Step$();
                               {if (true) return sup;}
      break;
    default:
      jj_la1[15] = jj_gen;
      sup = parse_Empty$Step$();
                                {if (true) return sup;}
    }
    throw new Error("Missing return statement in function");
  }

  final public Empty<Step> parse_Empty$Step$() throws ParseException {
      {if (true) return new Empty<Step>();}
    throw new Error("Missing return statement in function");
  }

  final public Cons<Step> parse_Cons$Step$() throws ParseException {
     Step first;
     List<Step> rest;
    first = parse_Step();
    rest = parse_List$Step$();
      {if (true) return new Cons<Step>(first,rest);}
    throw new Error("Missing return statement in function");
  }

  final public RWrap<ProtocolI> parse_RWrap$ProtocolI$() throws ParseException {
     FullyQualifiedClassName className;
     verbatim wrappee;
    className = parse_FullyQualifiedClassName();
    wrappee = parse_verbatim();
      {if (true) return new RWrap<ProtocolI>(className,wrappee);}
    throw new Error("Missing return statement in function");
  }

  final public RWrap<InstanceSetI> parse_RWrap$InstanceSetI$() throws ParseException {
     FullyQualifiedClassName className;
     verbatim wrappee;
    className = parse_FullyQualifiedClassName();
    wrappee = parse_verbatim();
      {if (true) return new RWrap<InstanceSetI>(className,wrappee);}
    throw new Error("Missing return statement in function");
  }

  final public ListSet<Integer> parse_ListSet$Integer$() throws ParseException {
     List<Wrap<Integer>> list;
    list = parse_List$Wrap$Integer$$();
      {if (true) return new ListSet<Integer>(list);}
    throw new Error("Missing return statement in function");
  }

  final public List<Wrap<Integer>> parse_List$Wrap$Integer$$() throws ParseException {
    List<Wrap<Integer>> sup = null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case INT:
      sup = parse_Cons$Wrap$Integer$$();
                                        {if (true) return sup;}
      break;
    default:
      jj_la1[16] = jj_gen;
      sup = parse_Empty$Wrap$Integer$$();
                                         {if (true) return sup;}
    }
    throw new Error("Missing return statement in function");
  }

  final public Empty<Wrap<Integer>> parse_Empty$Wrap$Integer$$() throws ParseException {
      {if (true) return new Empty<Wrap<Integer>>();}
    throw new Error("Missing return statement in function");
  }

  final public Wrap<Integer> parse_Wrap$Integer$() throws ParseException {
     Integer x;
    x = parse_Integer();
      {if (true) return new Wrap<Integer>(x);}
    throw new Error("Missing return statement in function");
  }

  final public Cons<Wrap<Integer>> parse_Cons$Wrap$Integer$$() throws ParseException {
     Wrap<Integer> first;
     List<Wrap<Integer>> rest;
    first = parse_Wrap$Integer$();
    rest = parse_List$Wrap$Integer$$();
      {if (true) return new Cons<Wrap<Integer>>(first,rest);}
    throw new Error("Missing return statement in function");
  }

  final public ListMap<Var,Boolean> parse_ListMap$Var$Boolean$() throws ParseException {
     List<Entry<Var,Boolean>> list;
    jj_consume_token(46);
    list = parse_List$Entry$Var$Boolean$$();
    jj_consume_token(8);
      {if (true) return new ListMap<Var,Boolean>(list);}
    throw new Error("Missing return statement in function");
  }

  final public List<Entry<Var, Boolean>> parse_List$Entry$Var$Boolean$$() throws ParseException {
    List<Entry<Var, Boolean>> sup = null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 1:
      sup = parse_Cons$Entry$Var$Boolean$$();
                                             {if (true) return sup;}
      break;
    default:
      jj_la1[17] = jj_gen;
      sup = parse_Empty$Entry$Var$Boolean$$();
                                              {if (true) return sup;}
    }
    throw new Error("Missing return statement in function");
  }

  final public Empty<Entry<Var, Boolean>> parse_Empty$Entry$Var$Boolean$$() throws ParseException {
      {if (true) return new Empty<Entry<Var, Boolean>>();}
    throw new Error("Missing return statement in function");
  }

  final public Entry<Var,Boolean> parse_Entry$Var$Boolean$() throws ParseException {
     Var key;
     Boolean val;
    jj_consume_token(1);
    key = parse_Var();
    jj_consume_token(47);
    val = parse_Boolean();
    jj_consume_token(4);
      {if (true) return new Entry<Var,Boolean>(key,val);}
    throw new Error("Missing return statement in function");
  }

  final public Cons<Entry<Var, Boolean>> parse_Cons$Entry$Var$Boolean$$() throws ParseException {
     Entry<Var,Boolean> first;
     List<Entry<Var,Boolean>> rest;
    first = parse_Entry$Var$Boolean$();
    rest = parse_List$Entry$Var$Boolean$$();
      {if (true) return new Cons<Entry<Var, Boolean>>(first,rest);}
    throw new Error("Missing return statement in function");
  }

  final public List<Var> parse_List$Var$() throws ParseException {
    List<Var> sup = null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case IDENT:
      sup = parse_Cons$Var$();
                              {if (true) return sup;}
      break;
    default:
      jj_la1[18] = jj_gen;
      sup = parse_Empty$Var$();
                               {if (true) return sup;}
    }
    throw new Error("Missing return statement in function");
  }

  final public Empty<Var> parse_Empty$Var$() throws ParseException {
      {if (true) return new Empty<Var>();}
    throw new Error("Missing return statement in function");
  }

  final public Cons<Var> parse_Cons$Var$() throws ParseException {
     Var first;
     List<Var> rest;
    first = parse_Var();
    rest = parse_List$Var$();
      {if (true) return new Cons<Var>(first,rest);}
    throw new Error("Missing return statement in function");
  }

  final public Cons<Clause> parse_Cons$Clause$() throws ParseException {
     Clause first;
     List<Clause> rest;
    first = parse_Clause();
    rest = parse_List$Clause$();
      {if (true) return new Cons<Clause>(first,rest);}
    throw new Error("Missing return statement in function");
  }

  final public List<Clause> parse_List$Clause$() throws ParseException {
    List<Clause> sup = null;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 1:
      sup = parse_Cons$Clause$();
                                 {if (true) return sup;}
      break;
    default:
      jj_la1[19] = jj_gen;
      sup = parse_Empty$Clause$();
                                  {if (true) return sup;}
    }
    throw new Error("Missing return statement in function");
  }

  final public Empty<Clause> parse_Empty$Clause$() throws ParseException {
      {if (true) return new Empty<Clause>();}
    throw new Error("Missing return statement in function");
  }

  /** Generated Token Manager. */
  public TheParserTokenManager token_source;
  SimpleCharStream jj_input_stream;
  /** Current token. */
  public Token token;
  /** Next token. */
  public Token jj_nt;
  private int jj_ntk;
  private int jj_gen;
  final private int[] jj_la1 = new int[20];
  static private int[] jj_la1_0;
  static private int[] jj_la1_1;
  static {
      jj_la1_init_0();
      jj_la1_init_1();
   }
   private static void jj_la1_init_0() {
      jj_la1_0 = new int[] {0x0,0x200,0x1800,0x6000,0x180000,0x1c00000,0x180000,0x0,0x0,0x0,0x180000,0x1c00000,0x0,0x0,0x180000,0x6000,0x0,0x2,0x0,0x2,};
   }
   private static void jj_la1_init_1() {
      jj_la1_1 = new int[] {0xc000000,0x0,0x0,0x0,0x0,0x0,0x0,0xd00,0x3000,0x80000000,0x0,0x0,0x80000000,0x80000000,0x0,0x0,0x10000,0x0,0x80000000,0x0,};
   }

  /** Constructor with InputStream. */
  public TheParser(java.io.InputStream stream) {
     this(stream, null);
  }
  /** Constructor with InputStream and supplied encoding */
  public TheParser(java.io.InputStream stream, String encoding) {
    try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
    token_source = new TheParserTokenManager(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 20; i++) jj_la1[i] = -1;
  }

  /** Reinitialise. */
  public void ReInit(java.io.InputStream stream) {
     ReInit(stream, null);
  }
  /** Reinitialise. */
  public void ReInit(java.io.InputStream stream, String encoding) {
    try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
    token_source.ReInit(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 20; i++) jj_la1[i] = -1;
  }

  /** Constructor. */
  public TheParser(java.io.Reader stream) {
    jj_input_stream = new SimpleCharStream(stream, 1, 1);
    token_source = new TheParserTokenManager(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 20; i++) jj_la1[i] = -1;
  }

  /** Reinitialise. */
  public void ReInit(java.io.Reader stream) {
    jj_input_stream.ReInit(stream, 1, 1);
    token_source.ReInit(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 20; i++) jj_la1[i] = -1;
  }

  /** Constructor with generated Token Manager. */
  public TheParser(TheParserTokenManager tm) {
    token_source = tm;
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 20; i++) jj_la1[i] = -1;
  }

  /** Reinitialise. */
  public void ReInit(TheParserTokenManager tm) {
    token_source = tm;
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 20; i++) jj_la1[i] = -1;
  }

  private Token jj_consume_token(int kind) throws ParseException {
    Token oldToken;
    if ((oldToken = token).next != null) token = token.next;
    else token = token.next = token_source.getNextToken();
    jj_ntk = -1;
    if (token.kind == kind) {
      jj_gen++;
      return token;
    }
    token = oldToken;
    jj_kind = kind;
    throw generateParseException();
  }


/** Get the next Token. */
  final public Token getNextToken() {
    if (token.next != null) token = token.next;
    else token = token.next = token_source.getNextToken();
    jj_ntk = -1;
    jj_gen++;
    return token;
  }

/** Get the specific Token. */
  final public Token getToken(int index) {
    Token t = token;
    for (int i = 0; i < index; i++) {
      if (t.next != null) t = t.next;
      else t = t.next = token_source.getNextToken();
    }
    return t;
  }

  private int jj_ntk() {
    if ((jj_nt=token.next) == null)
      return (jj_ntk = (token.next=token_source.getNextToken()).kind);
    else
      return (jj_ntk = jj_nt.kind);
  }

  private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
  private int[] jj_expentry;
  private int jj_kind = -1;

  /** Generate ParseException. */
  public ParseException generateParseException() {
    jj_expentries.clear();
    boolean[] la1tokens = new boolean[64];
    if (jj_kind >= 0) {
      la1tokens[jj_kind] = true;
      jj_kind = -1;
    }
    for (int i = 0; i < 20; i++) {
      if (jj_la1[i] == jj_gen) {
        for (int j = 0; j < 32; j++) {
          if ((jj_la1_0[i] & (1<<j)) != 0) {
            la1tokens[j] = true;
          }
          if ((jj_la1_1[i] & (1<<j)) != 0) {
            la1tokens[32+j] = true;
          }
        }
      }
    }
    for (int i = 0; i < 64; i++) {
      if (la1tokens[i]) {
        jj_expentry = new int[1];
        jj_expentry[0] = i;
        jj_expentries.add(jj_expentry);
      }
    }
    int[][] exptokseq = new int[jj_expentries.size()][];
    for (int i = 0; i < jj_expentries.size(); i++) {
      exptokseq[i] = jj_expentries.get(i);
    }
    return new ParseException(token, exptokseq, tokenImage);
  }

  /** Enable tracing. */
  final public void enable_tracing() {
  }

  /** Disable tracing. */
  final public void disable_tracing() {
  }

  }
