/* Generated By:JavaCC: Do not edit this line. MackASM.java */
package parser;
import java.util.*;
import editor.Mack;

public class MackASM implements MackASMConstants {
  public static Mack  mack = null;

  static final public void MackASMdoc(Mack  mackFile) throws ParseException {
                                                 mack = mackFile;
    label_1:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case IDENTIFIER:
        ;
        break;
      default:
        jj_la1[0] = jj_gen;
        break label_1;
      }
      ConstDef();
    }
    if (jj_2_1(2)) {
      BssSectionDef();
    } else {
      ;
    }
    if (jj_2_2(2)) {
      DataSectionDef();
    } else {
      ;
    }
    CodeSectionDef();
    jj_consume_token(0);
  }

  static final public void ConstDef() throws ParseException {
                                                 Token name; int  value;
    name = jj_consume_token(IDENTIFIER);
    jj_consume_token(CONST);
    value = Expr();
                                                  mack.defConst(name, value);
  }

  static final public int Expr() throws ParseException {
                                                  int  a; int  b;
    a = term();
    label_2:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 60:
      case 61:
        ;
        break;
      default:
        jj_la1[1] = jj_gen;
        break label_2;
      }
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 60:
        jj_consume_token(60);
        b = Expr();
                                                  a += b;
        break;
      case 61:
        jj_consume_token(61);
        b = Expr();
                                                  a -= b;
        break;
      default:
        jj_la1[2] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
                                                  {if (true) return a;}
    throw new Error("Missing return statement in function");
  }

  static final public int term() throws ParseException {
                                                  int  a; int  b;
    a = unary();
    label_3:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 62:
      case 63:
        ;
        break;
      default:
        jj_la1[3] = jj_gen;
        break label_3;
      }
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 62:
        jj_consume_token(62);
        b = term();
                                                  a *= b;
        break;
      case 63:
        jj_consume_token(63);
        b = term();
                                                  a /= b;
        break;
      default:
        jj_la1[4] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
                                                  {if (true) return a;}
    throw new Error("Missing return statement in function");
  }

  static final public int unary() throws ParseException {
                                                  int  a;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 61:
      jj_consume_token(61);
      a = element();
                                                  {if (true) return -a;}
      break;
    default:
      jj_la1[5] = jj_gen;
      if (jj_2_3(1)) {
        a = element();
                                                  {if (true) return a;}
      } else {
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
    throw new Error("Missing return statement in function");
  }

  static final public int element() throws ParseException {
                                                  Token  tok; int  a;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case INTEGER_LITERAL:
      tok = jj_consume_token(INTEGER_LITERAL);
                                                  {if (true) return mack.parseInt(tok);}
      break;
    default:
      jj_la1[6] = jj_gen;
      if (getToken(1).kind==IDENTIFIER  &&  getToken(2).kind!=COLON) {
        tok = jj_consume_token(IDENTIFIER);
                                                  {if (true) return mack.ref(tok);}
      } else {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case 64:
          jj_consume_token(64);
          a = Expr();
          jj_consume_token(65);
                                                  {if (true) return a;}
          break;
        default:
          jj_la1[7] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
      }
    }
    throw new Error("Missing return statement in function");
  }

  static final public void BssSectionDef() throws ParseException {
    jj_consume_token(START);
    jj_consume_token(BSS_SEC);
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case SECTION:
      jj_consume_token(SECTION);
      break;
    default:
      jj_la1[8] = jj_gen;
      ;
    }
    label_4:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case ARRAY:
      case DATA:
      case IDENTIFIER:
        ;
        break;
      default:
        jj_la1[9] = jj_gen;
        break label_4;
      }
      if (jj_2_4(2)) {
        BssDef();
      } else {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case IDENTIFIER:
          ConstDef();
          break;
        default:
          jj_la1[10] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
      }
    }
  }

  static final public void BssDef() throws ParseException {
                                                  Token  name=null; int  size=2; int  initValue; int  repeat=1;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case IDENTIFIER:
      name = jj_consume_token(IDENTIFIER);
      break;
    default:
      jj_la1[11] = jj_gen;
      ;
    }
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case DATA:
      jj_consume_token(DATA);
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case DOT_B:
      case DOT_L:
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case DOT_B:
          jj_consume_token(DOT_B);
                       size=1;
          break;
        case DOT_L:
          jj_consume_token(DOT_L);
                                           size=4;
          break;
        default:
          jj_la1[12] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
        break;
      default:
        jj_la1[13] = jj_gen;
        ;
      }
      break;
    case ARRAY:
      jj_consume_token(ARRAY);
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case DOT_B:
      case DOT_L:
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case DOT_B:
          jj_consume_token(DOT_B);
                       size=1;
          break;
        case DOT_L:
          jj_consume_token(DOT_L);
                                           size=4;
          break;
        default:
          jj_la1[14] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
        break;
      default:
        jj_la1[15] = jj_gen;
        ;
      }
      jj_consume_token(66);
      repeat = Expr();
      jj_consume_token(67);
      break;
    default:
      jj_la1[16] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                                                  mack.defBss(name, size, repeat);
  }

  static final public void DataSectionDef() throws ParseException {
    jj_consume_token(START);
    jj_consume_token(DATA_SEC);
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case SECTION:
      jj_consume_token(SECTION);
      break;
    default:
      jj_la1[17] = jj_gen;
      ;
    }
    label_5:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case STRING:
      case ARRAY:
      case DATA:
      case IDENTIFIER:
        ;
        break;
      default:
        jj_la1[18] = jj_gen;
        break label_5;
      }
      if (jj_2_5(2)) {
        DataDef();
      } else {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case IDENTIFIER:
          ConstDef();
          break;
        default:
          jj_la1[19] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
      }
    }
  }

  static final public void DataDef() throws ParseException {
                                                  Token  name=null; int  size=2; int  initValue; int  repeat=1; Token str;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case IDENTIFIER:
      name = jj_consume_token(IDENTIFIER);
      break;
    default:
      jj_la1[20] = jj_gen;
      ;
    }
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case DATA:
      jj_consume_token(DATA);
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case DOT_B:
      case DOT_L:
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case DOT_B:
          jj_consume_token(DOT_B);
                       size=1;
          break;
        case DOT_L:
          jj_consume_token(DOT_L);
                                           size=4;
          break;
        default:
          jj_la1[21] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
        break;
      default:
        jj_la1[22] = jj_gen;
        ;
      }
      initValue = Expr();
                                                                                                mack.defData(name, size, initValue, 1);
      break;
    case ARRAY:
      jj_consume_token(ARRAY);
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case DOT_B:
      case DOT_L:
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case DOT_B:
          jj_consume_token(DOT_B);
                       size=1;
          break;
        case DOT_L:
          jj_consume_token(DOT_L);
                                           size=4;
          break;
        default:
          jj_la1[23] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
        break;
      default:
        jj_la1[24] = jj_gen;
        ;
      }
      initValue = Expr();
      jj_consume_token(66);
      repeat = Expr();
      jj_consume_token(67);
                                                                                                mack.defData(name, size, initValue, repeat);
      break;
    case STRING:
      jj_consume_token(STRING);
      str = jj_consume_token(STRING_LITERAL);
                                                                                                mack.defString(name, str);
      break;
    default:
      jj_la1[25] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

  static final public void CodeSectionDef() throws ParseException {
    jj_consume_token(START);
    jj_consume_token(CODE_SEC);
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case SECTION:
      jj_consume_token(SECTION);
      break;
    default:
      jj_la1[26] = jj_gen;
      ;
    }
    label_6:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case SYSCALL:
      case ARSHIFT:
      case RETURN:
      case RSHIFT:
      case LSHIFT:
      case CLEAR:
      case STORE:
      case PUSH:
      case CALL:
      case LOAD:
      case POP:
      case DUP:
      case ADD:
      case SUB:
      case MUL:
      case DIV:
      case AND:
      case XOR:
      case NOT:
      case NEG:
      case OR:
      case B:
      case IDENTIFIER:
        ;
        break;
      default:
        jj_la1[27] = jj_gen;
        break label_6;
      }
      if (jj_2_6(2)) {
        CodeDef();
      } else {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case IDENTIFIER:
          ConstDef();
          break;
        default:
          jj_la1[28] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
      }
    }
  }

  static final public void CodeDef() throws ParseException {
                                                  Token  tok; int  value; int  sizeMask; mack.resetLoadSize();
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case IDENTIFIER:
      tok = jj_consume_token(IDENTIFIER);
      jj_consume_token(COLON);
                                                  mack.defLabel(tok);
      break;
    default:
      jj_la1[29] = jj_gen;
      ;
    }
    if (jj_2_7(2)) {
      jj_consume_token(PUSH);
      jj_consume_token(ARROW);
      tok = jj_consume_token(IDENTIFIER);
      value = LabelDistance();
                                                               mack.genPushLabel(tok,value);
    } else {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case PUSH:
        tok = jj_consume_token(PUSH);
        value = Expr();
                                                  mack.genPush(value);
        break;
      case POP:
        tok = jj_consume_token(POP);
                                                  mack.genOp(0xC0, tok, -1);
        break;
      case CLEAR:
        tok = jj_consume_token(CLEAR);
                                                  mack.genOp(0xC1, tok, -999);
        break;
      case DUP:
        tok = jj_consume_token(DUP);
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case DOT_NEG1:
          jj_consume_token(DOT_NEG1);
                             mack.genOp(0xC3, tok, +1);
          break;
        default:
          jj_la1[30] = jj_gen;
          Operands1();
                                                                        mack.genOp(0xC2, tok, +1);
        }
        break;
      case ADD:
        tok = jj_consume_token(ADD);
        Operands2();
                                                   mack.genOp(0xC4, tok, -1);
        break;
      case SUB:
        tok = jj_consume_token(SUB);
        Operands2();
                                                   mack.genOp(0xC5, tok, -1);
        break;
      case MUL:
        tok = jj_consume_token(MUL);
        Operands2();
                                                   mack.genOp(0xC6, tok, -1);
        break;
      case DIV:
        tok = jj_consume_token(DIV);
        Operands2();
                                                   mack.genOp(0xC7, tok, -1);
        break;
      case AND:
        tok = jj_consume_token(AND);
        Operands2();
                                                   mack.genOp(0xC8, tok, -1);
        break;
      case OR:
        tok = jj_consume_token(OR);
        Operands2();
                                                   mack.genOp(0xC9, tok, -1);
        break;
      case XOR:
        tok = jj_consume_token(XOR);
        Operands2();
                                                   mack.genOp(0xCA, tok, -1);
        break;
      case ARSHIFT:
        tok = jj_consume_token(ARSHIFT);
        Operands2();
                                                   mack.genOp(0xCB, tok, -1);
        break;
      case RSHIFT:
        tok = jj_consume_token(RSHIFT);
        Operands2();
                                                   mack.genOp(0xCC, tok, -1);
        break;
      case LSHIFT:
        tok = jj_consume_token(LSHIFT);
        Operands2();
                                                   mack.genOp(0xCD, tok, -1);
        break;
      case NOT:
        tok = jj_consume_token(NOT);
        Operands1();
                                                   mack.genOp(0xCE, tok, 0);
        break;
      case NEG:
        tok = jj_consume_token(NEG);
        Operands1();
                                                   mack.genOp(0xCF, tok, 0);
        break;
      case B:
        tok = jj_consume_token(B);
        CondBranch(0xD0, tok);
        break;
      case RETURN:
        tok = jj_consume_token(RETURN);
                                                  mack.genOp(0xD7, tok, -1);
        break;
      case SYSCALL:
        tok = jj_consume_token(SYSCALL);
        Operands();
                                                  mack.genOp(0xD8, tok, -999);
        break;
      case CALL:
        tok = jj_consume_token(CALL);
        CondBranch(0xD8, tok);
        break;
      case LOAD:
        tok = jj_consume_token(LOAD);
        sizeMask = MemCompleters();
                                                  mack.genOp(0xE0 | sizeMask, tok, 0);
        break;
      case STORE:
        tok = jj_consume_token(STORE);
        sizeMask = MemCompleters();
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case 68:
          jj_consume_token(68);
          value = Expr();
                                                               mack.genPush(value);
          break;
        default:
          jj_la1[31] = jj_gen;
          ;
        }
                                                 mack.genOp(0xF0 | sizeMask, tok, -2);
        break;
      default:
        jj_la1[32] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
  }

  static final public void CondBranch(int  opCode, Token  tok) throws ParseException {
                                                  int  value; int  condCode=7; Token  labTok=null; int  howFar=0;
    if (jj_2_8(1)) {
      if (getToken(1).kind==DOT_DNZ  &&  token.kind==B) {
        jj_consume_token(DOT_DNZ);
        value = Expr();
                                                  mack.genPush(value); condCode=0;
      } else {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case DOT_GT:
          jj_consume_token(DOT_GT);
          Operands2();
                                                  condCode=1;
          break;
        case DOT_EQ:
          jj_consume_token(DOT_EQ);
          Operands2();
                                                  condCode=2;
          break;
        case DOT_GE:
          jj_consume_token(DOT_GE);
          Operands2();
                                                  condCode=3;
          break;
        case DOT_LT:
          jj_consume_token(DOT_LT);
          Operands2();
                                                  condCode=4;
          break;
        case DOT_NE:
          jj_consume_token(DOT_NE);
          Operands2();
                                                  condCode=5;
          break;
        case DOT_LE:
          jj_consume_token(DOT_LE);
          Operands2();
                                                  condCode=6;
          break;
        default:
          jj_la1[33] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
      }
    } else {
      ;
    }
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case ARROW:
      jj_consume_token(ARROW);
      labTok = jj_consume_token(IDENTIFIER);
      howFar = LabelDistance();
      break;
    default:
      jj_la1[34] = jj_gen;
      ;
    }
                                                  mack.genBranch(opCode | condCode, tok, labTok, howFar);
  }

// Each ".far" after the label means another byte is needed to push the label.
  static final public int LabelDistance() throws ParseException {
                                                      int  howFar=0;
    label_7:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case DOT_FAR:
        ;
        break;
      default:
        jj_la1[35] = jj_gen;
        break label_7;
      }
      jj_consume_token(DOT_FAR);
                                                  howFar++;
    }
                                                  {if (true) return howFar;}
    throw new Error("Missing return statement in function");
  }

// MemCompleters() is used to LOAD and STORE stuff.  These instructions does not use Operands()
// because we do not want the variables to auto load. We just want their address pushed.
  static final public int MemCompleters() throws ParseException {
                        int  value; int  mem=0; int  size=2;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case DOT_P:
      jj_consume_token(DOT_P);
            mem=0x04;
      break;
    default:
      jj_la1[36] = jj_gen;
      ;
    }
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case DOT_B:
    case DOT_L:
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case DOT_B:
        jj_consume_token(DOT_B);
            size=0x01;
        break;
      case DOT_L:
        jj_consume_token(DOT_L);
                                   size=0x03;
        break;
      default:
        jj_la1[37] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
      break;
    default:
      jj_la1[38] = jj_gen;
      ;
    }
    if (jj_2_9(2147483647)) {
      value = Expr();
                                                  mack.genPush(value);
    } else {
      ;
    }
                                                  {if (true) return mem | size;}
    throw new Error("Missing return statement in function");
  }

// Any number of operands.
  static final public void Operands() throws ParseException {
    if (jj_2_10(1)) {
      Operand();
      label_8:
      while (true) {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case 68:
          ;
          break;
        default:
          jj_la1[39] = jj_gen;
          break label_8;
        }
        jj_consume_token(68);
        Operand();
      }
    } else {
      ;
    }
  }

// 0, 1, 2 or 3 operands.
  static final public void Operands3() throws ParseException {
    if (jj_2_11(1)) {
      Operand();
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 68:
        jj_consume_token(68);
        Operand();
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case 68:
          jj_consume_token(68);
          Operand();
          break;
        default:
          jj_la1[40] = jj_gen;
          ;
        }
        break;
      default:
        jj_la1[41] = jj_gen;
        ;
      }
    } else {
      ;
    }
  }

// 0, 1 or 2 operands.
  static final public void Operands2() throws ParseException {
    if (jj_2_12(1)) {
      Operand();
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 68:
        jj_consume_token(68);
        Operand();
        break;
      default:
        jj_la1[42] = jj_gen;
        ;
      }
    } else {
      ;
    }
  }

// 0 or 1 operand.
  static final public void Operands1() throws ParseException {
    if (jj_2_13(1)) {
      Operand();
    } else {
      ;
    }
  }

// When an Expression sees a variable, it sets a global called "loadSize".
// If loadSize is set, this assumes you want to do a load, else it just pushes the value.
  static final public void Operand() throws ParseException {
                                                  int value; mack.resetLoadSize();
    value = Expr();
                                                                          mack.genPushOrLoad(value);
  }

  static private boolean jj_2_1(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_1(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(0, xla); }
  }

  static private boolean jj_2_2(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_2(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(1, xla); }
  }

  static private boolean jj_2_3(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_3(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(2, xla); }
  }

  static private boolean jj_2_4(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_4(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(3, xla); }
  }

  static private boolean jj_2_5(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_5(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(4, xla); }
  }

  static private boolean jj_2_6(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_6(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(5, xla); }
  }

  static private boolean jj_2_7(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_7(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(6, xla); }
  }

  static private boolean jj_2_8(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_8(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(7, xla); }
  }

  static private boolean jj_2_9(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_9(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(8, xla); }
  }

  static private boolean jj_2_10(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_10(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(9, xla); }
  }

  static private boolean jj_2_11(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_11(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(10, xla); }
  }

  static private boolean jj_2_12(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_12(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(11, xla); }
  }

  static private boolean jj_2_13(int xla) {
    jj_la = xla; jj_lastpos = jj_scanpos = token;
    try { return !jj_3_13(); }
    catch(LookaheadSuccess ls) { return true; }
    finally { jj_save(12, xla); }
  }

  static private boolean jj_3R_76() {
    if (jj_scan_token(DOT_L)) return true;
    return false;
  }

  static private boolean jj_3_6() {
    if (jj_3R_14()) return true;
    return false;
  }

  static private boolean jj_3R_79() {
    if (jj_scan_token(DOT_B)) return true;
    return false;
  }

  static private boolean jj_3R_60() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_79()) {
    jj_scanpos = xsp;
    if (jj_3R_80()) return true;
    }
    return false;
  }

  static private boolean jj_3R_74() {
    if (jj_scan_token(DOT_L)) return true;
    return false;
  }

  static private boolean jj_3R_77() {
    if (jj_scan_token(DOT_B)) return true;
    return false;
  }

  static private boolean jj_3R_59() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_77()) {
    jj_scanpos = xsp;
    if (jj_3R_78()) return true;
    }
    return false;
  }

  static private boolean jj_3R_31() {
    if (jj_scan_token(STRING)) return true;
    if (jj_scan_token(STRING_LITERAL)) return true;
    return false;
  }

  static private boolean jj_3R_30() {
    if (jj_scan_token(ARRAY)) return true;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_60()) jj_scanpos = xsp;
    if (jj_3R_22()) return true;
    return false;
  }

  static private boolean jj_3R_29() {
    if (jj_scan_token(DATA)) return true;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_59()) jj_scanpos = xsp;
    if (jj_3R_22()) return true;
    return false;
  }

  static private boolean jj_3R_13() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_scan_token(57)) jj_scanpos = xsp;
    xsp = jj_scanpos;
    if (jj_3R_29()) {
    jj_scanpos = xsp;
    if (jj_3R_30()) {
    jj_scanpos = xsp;
    if (jj_3R_31()) return true;
    }
    }
    return false;
  }

  static private boolean jj_3R_75() {
    if (jj_scan_token(DOT_B)) return true;
    return false;
  }

  static private boolean jj_3R_58() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_75()) {
    jj_scanpos = xsp;
    if (jj_3R_76()) return true;
    }
    return false;
  }

  static private boolean jj_3R_73() {
    if (jj_scan_token(DOT_B)) return true;
    return false;
  }

  static private boolean jj_3_5() {
    if (jj_3R_13()) return true;
    return false;
  }

  static private boolean jj_3R_57() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_73()) {
    jj_scanpos = xsp;
    if (jj_3R_74()) return true;
    }
    return false;
  }

  static private boolean jj_3R_10() {
    if (jj_scan_token(START)) return true;
    if (jj_scan_token(DATA_SEC)) return true;
    return false;
  }

  static private boolean jj_3R_28() {
    if (jj_scan_token(ARRAY)) return true;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_58()) jj_scanpos = xsp;
    if (jj_scan_token(66)) return true;
    return false;
  }

  static private boolean jj_3R_27() {
    if (jj_scan_token(DATA)) return true;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_57()) jj_scanpos = xsp;
    return false;
  }

  static private boolean jj_3R_12() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_scan_token(57)) jj_scanpos = xsp;
    xsp = jj_scanpos;
    if (jj_3R_27()) {
    jj_scanpos = xsp;
    if (jj_3R_28()) return true;
    }
    return false;
  }

  static private boolean jj_3_4() {
    if (jj_3R_12()) return true;
    return false;
  }

  static private boolean jj_3R_9() {
    if (jj_scan_token(START)) return true;
    if (jj_scan_token(BSS_SEC)) return true;
    return false;
  }

  static private boolean jj_3R_26() {
    if (jj_scan_token(64)) return true;
    if (jj_3R_22()) return true;
    if (jj_scan_token(65)) return true;
    return false;
  }

  static private boolean jj_3R_25() {
    if (jj_scan_token(IDENTIFIER)) return true;
    return false;
  }

  static private boolean jj_3R_24() {
    if (jj_scan_token(INTEGER_LITERAL)) return true;
    return false;
  }

  static private boolean jj_3R_11() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_24()) {
    jj_scanpos = xsp;
    jj_lookingAhead = true;
    jj_semLA = getToken(1).kind==IDENTIFIER  &&  getToken(2).kind!=COLON;
    jj_lookingAhead = false;
    if (!jj_semLA || jj_3R_25()) {
    jj_scanpos = xsp;
    if (jj_3R_26()) return true;
    }
    }
    return false;
  }

  static private boolean jj_3R_23() {
    if (jj_3R_22()) return true;
    return false;
  }

  static private boolean jj_3_3() {
    if (jj_3R_11()) return true;
    return false;
  }

  static private boolean jj_3R_85() {
    if (jj_scan_token(61)) return true;
    if (jj_3R_11()) return true;
    return false;
  }

  static private boolean jj_3R_69() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_85()) {
    jj_scanpos = xsp;
    if (jj_3_3()) return true;
    }
    return false;
  }

  static private boolean jj_3_13() {
    if (jj_3R_23()) return true;
    return false;
  }

  static private boolean jj_3R_87() {
    if (jj_scan_token(63)) return true;
    if (jj_3R_55()) return true;
    return false;
  }

  static private boolean jj_3R_64() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_13()) jj_scanpos = xsp;
    return false;
  }

  static private boolean jj_3R_86() {
    if (jj_scan_token(62)) return true;
    if (jj_3R_55()) return true;
    return false;
  }

  static private boolean jj_3R_70() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_86()) {
    jj_scanpos = xsp;
    if (jj_3R_87()) return true;
    }
    return false;
  }

  static private boolean jj_3R_55() {
    if (jj_3R_69()) return true;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_70()) { jj_scanpos = xsp; break; }
    }
    return false;
  }

  static private boolean jj_3_12() {
    if (jj_3R_23()) return true;
    return false;
  }

  static private boolean jj_3R_89() {
    if (jj_scan_token(DOT_L)) return true;
    return false;
  }

  static private boolean jj_3R_63() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_12()) jj_scanpos = xsp;
    return false;
  }

  static private boolean jj_3R_72() {
    if (jj_scan_token(61)) return true;
    if (jj_3R_22()) return true;
    return false;
  }

  static private boolean jj_3_11() {
    if (jj_3R_23()) return true;
    return false;
  }

  static private boolean jj_3R_71() {
    if (jj_scan_token(60)) return true;
    if (jj_3R_22()) return true;
    return false;
  }

  static private boolean jj_3R_56() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_71()) {
    jj_scanpos = xsp;
    if (jj_3R_72()) return true;
    }
    return false;
  }

  static private boolean jj_3R_22() {
    if (jj_3R_55()) return true;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_56()) { jj_scanpos = xsp; break; }
    }
    return false;
  }

  static private boolean jj_3_10() {
    if (jj_3R_23()) return true;
    return false;
  }

  static private boolean jj_3_9() {
    if (jj_3R_22()) return true;
    return false;
  }

  static private boolean jj_3R_66() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_10()) jj_scanpos = xsp;
    return false;
  }

  static private boolean jj_3_2() {
    if (jj_3R_10()) return true;
    return false;
  }

  static private boolean jj_3_1() {
    if (jj_3R_9()) return true;
    return false;
  }

  static private boolean jj_3R_84() {
    if (jj_3R_22()) return true;
    return false;
  }

  static private boolean jj_3R_88() {
    if (jj_scan_token(DOT_B)) return true;
    return false;
  }

  static private boolean jj_3R_83() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_88()) {
    jj_scanpos = xsp;
    if (jj_3R_89()) return true;
    }
    return false;
  }

  static private boolean jj_3R_82() {
    if (jj_scan_token(DOT_P)) return true;
    return false;
  }

  static private boolean jj_3R_67() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_82()) jj_scanpos = xsp;
    xsp = jj_scanpos;
    if (jj_3R_83()) jj_scanpos = xsp;
    xsp = jj_scanpos;
    if (jj_3R_84()) jj_scanpos = xsp;
    return false;
  }

  static private boolean jj_3R_68() {
    if (jj_scan_token(68)) return true;
    return false;
  }

  static private boolean jj_3R_81() {
    if (jj_scan_token(ARROW)) return true;
    return false;
  }

  static private boolean jj_3R_21() {
    if (jj_scan_token(DOT_LE)) return true;
    return false;
  }

  static private boolean jj_3R_20() {
    if (jj_scan_token(DOT_NE)) return true;
    return false;
  }

  static private boolean jj_3R_62() {
    if (jj_3R_64()) return true;
    return false;
  }

  static private boolean jj_3R_19() {
    if (jj_scan_token(DOT_LT)) return true;
    return false;
  }

  static private boolean jj_3R_18() {
    if (jj_scan_token(DOT_GE)) return true;
    return false;
  }

  static private boolean jj_3R_17() {
    if (jj_scan_token(DOT_EQ)) return true;
    return false;
  }

  static private boolean jj_3R_16() {
    if (jj_scan_token(DOT_GT)) return true;
    return false;
  }

  static private boolean jj_3R_15() {
    if (jj_scan_token(DOT_DNZ)) return true;
    return false;
  }

  static private boolean jj_3_8() {
    Token xsp;
    xsp = jj_scanpos;
    jj_lookingAhead = true;
    jj_semLA = getToken(1).kind==DOT_DNZ  &&  token.kind==B;
    jj_lookingAhead = false;
    if (!jj_semLA || jj_3R_15()) {
    jj_scanpos = xsp;
    if (jj_3R_16()) {
    jj_scanpos = xsp;
    if (jj_3R_17()) {
    jj_scanpos = xsp;
    if (jj_3R_18()) {
    jj_scanpos = xsp;
    if (jj_3R_19()) {
    jj_scanpos = xsp;
    if (jj_3R_20()) {
    jj_scanpos = xsp;
    if (jj_3R_21()) return true;
    }
    }
    }
    }
    }
    }
    return false;
  }

  static private boolean jj_3R_65() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_8()) jj_scanpos = xsp;
    xsp = jj_scanpos;
    if (jj_3R_81()) jj_scanpos = xsp;
    return false;
  }

  static private boolean jj_3R_54() {
    if (jj_scan_token(STORE)) return true;
    if (jj_3R_67()) return true;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_68()) jj_scanpos = xsp;
    return false;
  }

  static private boolean jj_3R_53() {
    if (jj_scan_token(LOAD)) return true;
    if (jj_3R_67()) return true;
    return false;
  }

  static private boolean jj_3R_52() {
    if (jj_scan_token(CALL)) return true;
    if (jj_3R_65()) return true;
    return false;
  }

  static private boolean jj_3R_51() {
    if (jj_scan_token(SYSCALL)) return true;
    if (jj_3R_66()) return true;
    return false;
  }

  static private boolean jj_3R_50() {
    if (jj_scan_token(RETURN)) return true;
    return false;
  }

  static private boolean jj_3R_49() {
    if (jj_scan_token(B)) return true;
    if (jj_3R_65()) return true;
    return false;
  }

  static private boolean jj_3R_48() {
    if (jj_scan_token(NEG)) return true;
    if (jj_3R_64()) return true;
    return false;
  }

  static private boolean jj_3R_47() {
    if (jj_scan_token(NOT)) return true;
    if (jj_3R_64()) return true;
    return false;
  }

  static private boolean jj_3R_46() {
    if (jj_scan_token(LSHIFT)) return true;
    if (jj_3R_63()) return true;
    return false;
  }

  static private boolean jj_3R_45() {
    if (jj_scan_token(RSHIFT)) return true;
    if (jj_3R_63()) return true;
    return false;
  }

  static private boolean jj_3R_44() {
    if (jj_scan_token(ARSHIFT)) return true;
    if (jj_3R_63()) return true;
    return false;
  }

  static private boolean jj_3R_43() {
    if (jj_scan_token(XOR)) return true;
    if (jj_3R_63()) return true;
    return false;
  }

  static private boolean jj_3R_61() {
    if (jj_scan_token(DOT_NEG1)) return true;
    return false;
  }

  static private boolean jj_3R_42() {
    if (jj_scan_token(OR)) return true;
    if (jj_3R_63()) return true;
    return false;
  }

  static private boolean jj_3R_41() {
    if (jj_scan_token(AND)) return true;
    if (jj_3R_63()) return true;
    return false;
  }

  static private boolean jj_3R_40() {
    if (jj_scan_token(DIV)) return true;
    if (jj_3R_63()) return true;
    return false;
  }

  static private boolean jj_3R_39() {
    if (jj_scan_token(MUL)) return true;
    if (jj_3R_63()) return true;
    return false;
  }

  static private boolean jj_3R_38() {
    if (jj_scan_token(SUB)) return true;
    if (jj_3R_63()) return true;
    return false;
  }

  static private boolean jj_3R_80() {
    if (jj_scan_token(DOT_L)) return true;
    return false;
  }

  static private boolean jj_3R_37() {
    if (jj_scan_token(ADD)) return true;
    if (jj_3R_63()) return true;
    return false;
  }

  static private boolean jj_3R_78() {
    if (jj_scan_token(DOT_L)) return true;
    return false;
  }

  static private boolean jj_3R_36() {
    if (jj_scan_token(DUP)) return true;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_61()) {
    jj_scanpos = xsp;
    if (jj_3R_62()) return true;
    }
    return false;
  }

  static private boolean jj_3R_35() {
    if (jj_scan_token(CLEAR)) return true;
    return false;
  }

  static private boolean jj_3R_34() {
    if (jj_scan_token(POP)) return true;
    return false;
  }

  static private boolean jj_3R_33() {
    if (jj_scan_token(PUSH)) return true;
    if (jj_3R_22()) return true;
    return false;
  }

  static private boolean jj_3_7() {
    if (jj_scan_token(PUSH)) return true;
    if (jj_scan_token(ARROW)) return true;
    return false;
  }

  static private boolean jj_3R_32() {
    if (jj_scan_token(IDENTIFIER)) return true;
    if (jj_scan_token(COLON)) return true;
    return false;
  }

  static private boolean jj_3R_14() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_32()) jj_scanpos = xsp;
    xsp = jj_scanpos;
    if (jj_3_7()) {
    jj_scanpos = xsp;
    if (jj_3R_33()) {
    jj_scanpos = xsp;
    if (jj_3R_34()) {
    jj_scanpos = xsp;
    if (jj_3R_35()) {
    jj_scanpos = xsp;
    if (jj_3R_36()) {
    jj_scanpos = xsp;
    if (jj_3R_37()) {
    jj_scanpos = xsp;
    if (jj_3R_38()) {
    jj_scanpos = xsp;
    if (jj_3R_39()) {
    jj_scanpos = xsp;
    if (jj_3R_40()) {
    jj_scanpos = xsp;
    if (jj_3R_41()) {
    jj_scanpos = xsp;
    if (jj_3R_42()) {
    jj_scanpos = xsp;
    if (jj_3R_43()) {
    jj_scanpos = xsp;
    if (jj_3R_44()) {
    jj_scanpos = xsp;
    if (jj_3R_45()) {
    jj_scanpos = xsp;
    if (jj_3R_46()) {
    jj_scanpos = xsp;
    if (jj_3R_47()) {
    jj_scanpos = xsp;
    if (jj_3R_48()) {
    jj_scanpos = xsp;
    if (jj_3R_49()) {
    jj_scanpos = xsp;
    if (jj_3R_50()) {
    jj_scanpos = xsp;
    if (jj_3R_51()) {
    jj_scanpos = xsp;
    if (jj_3R_52()) {
    jj_scanpos = xsp;
    if (jj_3R_53()) {
    jj_scanpos = xsp;
    if (jj_3R_54()) return true;
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    }
    return false;
  }

  static private boolean jj_initialized_once = false;
  /** Generated Token Manager. */
  static public MackASMTokenManager token_source;
  static SimpleCharStream jj_input_stream;
  /** Current token. */
  static public Token token;
  /** Next token. */
  static public Token jj_nt;
  static private int jj_ntk;
  static private Token jj_scanpos, jj_lastpos;
  static private int jj_la;
  /** Whether we are looking ahead. */
  static private boolean jj_lookingAhead = false;
  static private boolean jj_semLA;
  static private int jj_gen;
  static final private int[] jj_la1 = new int[43];
  static private int[] jj_la1_0;
  static private int[] jj_la1_1;
  static private int[] jj_la1_2;
  static {
      jj_la1_init_0();
      jj_la1_init_1();
      jj_la1_init_2();
   }
   private static void jj_la1_init_0() {
      jj_la1_0 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x80,0x0,0x2000,0x4400000,0x0,0x0,0x0,0x0,0x0,0x0,0x4400000,0x2000,0x4420000,0x0,0x0,0x0,0x0,0x0,0x0,0x4420000,0x2000,0x7095d000,0x0,0x0,0x0,0x0,0x7095d000,0x0,0x0,0x1000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
   }
   private static void jj_la1_init_1() {
      jj_la1_1 = new int[] {0x2000000,0x30000000,0x30000000,0xc0000000,0xc0000000,0x20000000,0x0,0x0,0x0,0x2000000,0x2000000,0x2000000,0x300000,0x300000,0x300000,0x300000,0x0,0x0,0x2000000,0x2000000,0x2000000,0x300000,0x300000,0x300000,0x300000,0x0,0x0,0x2c007fe,0x2000000,0x2000000,0x800,0x0,0xc007fe,0x3f000,0x40000,0x0,0x80000,0x300000,0x300000,0x0,0x0,0x0,0x0,};
   }
   private static void jj_la1_init_2() {
      jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x10,0x10,0x10,0x10,};
   }
  static final private JJCalls[] jj_2_rtns = new JJCalls[13];
  static private boolean jj_rescan = false;
  static private int jj_gc = 0;

  /** Constructor with InputStream. */
  public MackASM(java.io.InputStream stream) {
     this(stream, null);
  }
  /** Constructor with InputStream and supplied encoding */
  public MackASM(java.io.InputStream stream, String encoding) {
    if (jj_initialized_once) {
      System.out.println("ERROR: Second call to constructor of static parser.  ");
      System.out.println("       You must either use ReInit() or set the JavaCC option STATIC to false");
      System.out.println("       during parser generation.");
      throw new Error();
    }
    jj_initialized_once = true;
    try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
    token_source = new MackASMTokenManager(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 43; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  /** Reinitialise. */
  static public void ReInit(java.io.InputStream stream) {
     ReInit(stream, null);
  }
  /** Reinitialise. */
  static 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 < 43; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  /** Constructor. */
  public MackASM(java.io.Reader stream) {
    if (jj_initialized_once) {
      System.out.println("ERROR: Second call to constructor of static parser. ");
      System.out.println("       You must either use ReInit() or set the JavaCC option STATIC to false");
      System.out.println("       during parser generation.");
      throw new Error();
    }
    jj_initialized_once = true;
    jj_input_stream = new SimpleCharStream(stream, 1, 1);
    token_source = new MackASMTokenManager(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 43; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  /** Reinitialise. */
  static 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 < 43; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  /** Constructor with generated Token Manager. */
  public MackASM(MackASMTokenManager tm) {
    if (jj_initialized_once) {
      System.out.println("ERROR: Second call to constructor of static parser. ");
      System.out.println("       You must either use ReInit() or set the JavaCC option STATIC to false");
      System.out.println("       during parser generation.");
      throw new Error();
    }
    jj_initialized_once = true;
    token_source = tm;
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 43; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  /** Reinitialise. */
  public void ReInit(MackASMTokenManager tm) {
    token_source = tm;
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 43; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  static 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++;
      if (++jj_gc > 100) {
        jj_gc = 0;
        for (int i = 0; i < jj_2_rtns.length; i++) {
          JJCalls c = jj_2_rtns[i];
          while (c != null) {
            if (c.gen < jj_gen) c.first = null;
            c = c.next;
          }
        }
      }
      return token;
    }
    token = oldToken;
    jj_kind = kind;
    throw generateParseException();
  }

  static private final class LookaheadSuccess extends java.lang.Error { }
  static final private LookaheadSuccess jj_ls = new LookaheadSuccess();
  static private boolean jj_scan_token(int kind) {
    if (jj_scanpos == jj_lastpos) {
      jj_la--;
      if (jj_scanpos.next == null) {
        jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
      } else {
        jj_lastpos = jj_scanpos = jj_scanpos.next;
      }
    } else {
      jj_scanpos = jj_scanpos.next;
    }
    if (jj_rescan) {
      int i = 0; Token tok = token;
      while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
      if (tok != null) jj_add_error_token(kind, i);
    }
    if (jj_scanpos.kind != kind) return true;
    if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
    return false;
  }


/** Get the next Token. */
  static 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. */
  static final public Token getToken(int index) {
    Token t = jj_lookingAhead ? jj_scanpos : token;
    for (int i = 0; i < index; i++) {
      if (t.next != null) t = t.next;
      else t = t.next = token_source.getNextToken();
    }
    return t;
  }

  static 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);
  }

  static private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
  static private int[] jj_expentry;
  static private int jj_kind = -1;
  static private int[] jj_lasttokens = new int[100];
  static private int jj_endpos;

  static private void jj_add_error_token(int kind, int pos) {
    if (pos >= 100) return;
    if (pos == jj_endpos + 1) {
      jj_lasttokens[jj_endpos++] = kind;
    } else if (jj_endpos != 0) {
      jj_expentry = new int[jj_endpos];
      for (int i = 0; i < jj_endpos; i++) {
        jj_expentry[i] = jj_lasttokens[i];
      }
      jj_entries_loop: for (java.util.Iterator<?> it = jj_expentries.iterator(); it.hasNext();) {
        int[] oldentry = (int[])(it.next());
        if (oldentry.length == jj_expentry.length) {
          for (int i = 0; i < jj_expentry.length; i++) {
            if (oldentry[i] != jj_expentry[i]) {
              continue jj_entries_loop;
            }
          }
          jj_expentries.add(jj_expentry);
          break jj_entries_loop;
        }
      }
      if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
    }
  }

  /** Generate ParseException. */
  static public ParseException generateParseException() {
    jj_expentries.clear();
    boolean[] la1tokens = new boolean[69];
    if (jj_kind >= 0) {
      la1tokens[jj_kind] = true;
      jj_kind = -1;
    }
    for (int i = 0; i < 43; 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;
          }
          if ((jj_la1_2[i] & (1<<j)) != 0) {
            la1tokens[64+j] = true;
          }
        }
      }
    }
    for (int i = 0; i < 69; i++) {
      if (la1tokens[i]) {
        jj_expentry = new int[1];
        jj_expentry[0] = i;
        jj_expentries.add(jj_expentry);
      }
    }
    jj_endpos = 0;
    jj_rescan_token();
    jj_add_error_token(0, 0);
    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. */
  static final public void enable_tracing() {
  }

  /** Disable tracing. */
  static final public void disable_tracing() {
  }

  static private void jj_rescan_token() {
    jj_rescan = true;
    for (int i = 0; i < 13; i++) {
    try {
      JJCalls p = jj_2_rtns[i];
      do {
        if (p.gen > jj_gen) {
          jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
          switch (i) {
            case 0: jj_3_1(); break;
            case 1: jj_3_2(); break;
            case 2: jj_3_3(); break;
            case 3: jj_3_4(); break;
            case 4: jj_3_5(); break;
            case 5: jj_3_6(); break;
            case 6: jj_3_7(); break;
            case 7: jj_3_8(); break;
            case 8: jj_3_9(); break;
            case 9: jj_3_10(); break;
            case 10: jj_3_11(); break;
            case 11: jj_3_12(); break;
            case 12: jj_3_13(); break;
          }
        }
        p = p.next;
      } while (p != null);
      } catch(LookaheadSuccess ls) { }
    }
    jj_rescan = false;
  }

  static private void jj_save(int index, int xla) {
    JJCalls p = jj_2_rtns[index];
    while (p.gen > jj_gen) {
      if (p.next == null) { p = p.next = new JJCalls(); break; }
      p = p.next;
    }
    p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
  }

  static final class JJCalls {
    int gen;
    Token first;
    int arg;
    JJCalls next;
  }

}
