/* Generated By:JJTree&JavaCC: Do not edit this line. drawphase3.java */
class drawphase3/*@bgen(jjtree)*/implements drawphase3TreeConstants, drawphase3Constants {/*@bgen(jjtree)*/
  protected static JJTdrawphase3State jjtree = new JJTdrawphase3State();public static void main(String args[]) {

     drawphase3 t = new drawphase3(System.in);
     try {
       ASTStart n = t.Start();
       n.getSVG();
     } catch (Exception e) {
       System.out.println("Error.");
       System.out.println(e.getMessage());
       e.printStackTrace();
     }


   }

  static final public ASTStart Start() throws ParseException {
                          /*@bgen(jjtree) Start */
  ASTStart jjtn000 = new ASTStart(JJTSTART);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      Picture();
     jjtree.closeNodeScope(jjtn000, true);
     jjtc000 = false;
    {if (true) return jjtn000;}
    } catch (Throwable jjte000) {
     if (jjtc000) {
       jjtree.clearNodeScope(jjtn000);
       jjtc000 = false;
     } else {
       jjtree.popNode();
     }
     if (jjte000 instanceof RuntimeException) {
       {if (true) throw (RuntimeException)jjte000;}
     }
     if (jjte000 instanceof ParseException) {
       {if (true) throw (ParseException)jjte000;}
     }
     {if (true) throw (Error)jjte000;}
    } finally {
     if (jjtc000) {
       jjtree.closeNodeScope(jjtn000, true);
     }
    }
    throw new Error("Missing return statement in function");
  }

  static final public void Picture() throws ParseException {
                          /*@bgen(jjtree) picture */
  ASTpicture jjtn000 = new ASTpicture(JJTPICTURE);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      jj_consume_token(PICTURE);
      jj_consume_token(28);
      Parameter();
      Parameter();
      jj_consume_token(29);
      if (jj_2_1(2)) {
        jj_consume_token(30);
        label_1:
        while (true) {
          State();
          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
          case OFFSET:
          case COLOUR:
          case SQUARE:
          case LINE:
          case RECTANGLE:
          case POLYGON:
          case TRIANGLE:
          case ELLIPSE:
          case CIRCLE:
          case TEXT:
          case BRUSH:
          case SCALE:
          case REPEAT:
          case 30:
            ;
            break;
          default:
            jj_la1[0] = jj_gen;
            break label_1;
          }
        }
        jj_consume_token(31);
      } else {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case OFFSET:
        case COLOUR:
        case SQUARE:
        case LINE:
        case RECTANGLE:
        case POLYGON:
        case TRIANGLE:
        case ELLIPSE:
        case CIRCLE:
        case TEXT:
        case BRUSH:
        case SCALE:
        case REPEAT:
        case 30:
          label_2:
          while (true) {
            State();
            switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
            case OFFSET:
            case COLOUR:
            case SQUARE:
            case LINE:
            case RECTANGLE:
            case POLYGON:
            case TRIANGLE:
            case ELLIPSE:
            case CIRCLE:
            case TEXT:
            case BRUSH:
            case SCALE:
            case REPEAT:
            case 30:
              ;
              break;
            default:
              jj_la1[1] = jj_gen;
              break label_2;
            }
          }
          break;
        default:
          jj_la1[2] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
      }
    } catch (Throwable jjte000) {
     if (jjtc000) {
       jjtree.clearNodeScope(jjtn000);
       jjtc000 = false;
     } else {
       jjtree.popNode();
     }
     if (jjte000 instanceof RuntimeException) {
       {if (true) throw (RuntimeException)jjte000;}
     }
     if (jjte000 instanceof ParseException) {
       {if (true) throw (ParseException)jjte000;}
     }
     {if (true) throw (Error)jjte000;}
    } finally {
     if (jjtc000) {
       jjtree.closeNodeScope(jjtn000, true);
     }
    }
  }

  static final public void State() throws ParseException {
                      /*@bgen(jjtree) state */
  ASTstate jjtn000 = new ASTstate(JJTSTATE);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      label_3:
      while (true) {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case OFFSET:
        case COLOUR:
        case BRUSH:
        case SCALE:
        case REPEAT:
          ;
          break;
        default:
          jj_la1[3] = jj_gen;
          break label_3;
        }
        Operator();
      }
      Element();
    } catch (Throwable jjte000) {
     if (jjtc000) {
       jjtree.clearNodeScope(jjtn000);
       jjtc000 = false;
     } else {
       jjtree.popNode();
     }
     if (jjte000 instanceof RuntimeException) {
       {if (true) throw (RuntimeException)jjte000;}
     }
     if (jjte000 instanceof ParseException) {
       {if (true) throw (ParseException)jjte000;}
     }
     {if (true) throw (Error)jjte000;}
    } finally {
     if (jjtc000) {
       jjtree.closeNodeScope(jjtn000, true);
     }
    }
  }

  static final public void Element() throws ParseException {
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case 30:
      Block();
      break;
    case SQUARE:
      Square();
      break;
    case LINE:
      Line();
      break;
    case RECTANGLE:
      Rectangle();
      break;
    case POLYGON:
      Polygon();
      break;
    case TRIANGLE:
      Triangle();
      break;
    case CIRCLE:
      Circle();
      break;
    case ELLIPSE:
      Ellipse();
      break;
    case TEXT:
      Text();
      break;
    default:
      jj_la1[4] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

  static final public void Operator() throws ParseException {
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case COLOUR:
      Colour();
      break;
    case BRUSH:
      LineWidth();
      break;
    case OFFSET:
      Translation();
      break;
    case SCALE:
      Scaling();
      break;
    case REPEAT:
      Stamping();
      break;
    default:
      jj_la1[5] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

  static final public void Block() throws ParseException {
                       /*@bgen(jjtree) block */
  ASTblock jjtn000 = new ASTblock(JJTBLOCK);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      jj_consume_token(30);
      label_4:
      while (true) {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case OFFSET:
        case COLOUR:
        case SQUARE:
        case LINE:
        case RECTANGLE:
        case POLYGON:
        case TRIANGLE:
        case ELLIPSE:
        case CIRCLE:
        case TEXT:
        case BRUSH:
        case SCALE:
        case REPEAT:
        case 30:
          ;
          break;
        default:
          jj_la1[6] = jj_gen;
          break label_4;
        }
        State();
      }
      jj_consume_token(31);
    } catch (Throwable jjte000) {
    if (jjtc000) {
      jjtree.clearNodeScope(jjtn000);
      jjtc000 = false;
    } else {
      jjtree.popNode();
    }
    if (jjte000 instanceof RuntimeException) {
      {if (true) throw (RuntimeException)jjte000;}
    }
    if (jjte000 instanceof ParseException) {
      {if (true) throw (ParseException)jjte000;}
    }
    {if (true) throw (Error)jjte000;}
    } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
    }
  }

  static final public void Square() throws ParseException {
                         /*@bgen(jjtree) square */
  ASTsquare jjtn000 = new ASTsquare(JJTSQUARE);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      jj_consume_token(SQUARE);
      jj_consume_token(28);
      Parameter();
      Parameter();
      Parameter();
      jj_consume_token(29);
    } catch (Throwable jjte000) {
    if (jjtc000) {
      jjtree.clearNodeScope(jjtn000);
      jjtc000 = false;
    } else {
      jjtree.popNode();
    }
    if (jjte000 instanceof RuntimeException) {
      {if (true) throw (RuntimeException)jjte000;}
    }
    if (jjte000 instanceof ParseException) {
      {if (true) throw (ParseException)jjte000;}
    }
    {if (true) throw (Error)jjte000;}
    } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
    }
  }

  static final public void Line() throws ParseException {
                    /*@bgen(jjtree) line */
  ASTline jjtn000 = new ASTline(JJTLINE);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      jj_consume_token(LINE);
      jj_consume_token(28);
      Parameter();
      Parameter();
      Parameter();
      Parameter();
      jj_consume_token(29);
    } catch (Throwable jjte000) {
    if (jjtc000) {
      jjtree.clearNodeScope(jjtn000);
      jjtc000 = false;
    } else {
      jjtree.popNode();
    }
    if (jjte000 instanceof RuntimeException) {
      {if (true) throw (RuntimeException)jjte000;}
    }
    if (jjte000 instanceof ParseException) {
      {if (true) throw (ParseException)jjte000;}
    }
    {if (true) throw (Error)jjte000;}
    } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
    }
  }

  static final public void Rectangle() throws ParseException {
                              /*@bgen(jjtree) rectangle */
  ASTrectangle jjtn000 = new ASTrectangle(JJTRECTANGLE);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      jj_consume_token(RECTANGLE);
      jj_consume_token(28);
      Parameter();
      Parameter();
      Parameter();
      Parameter();
      jj_consume_token(29);
    } catch (Throwable jjte000) {
    if (jjtc000) {
      jjtree.clearNodeScope(jjtn000);
      jjtc000 = false;
    } else {
      jjtree.popNode();
    }
    if (jjte000 instanceof RuntimeException) {
      {if (true) throw (RuntimeException)jjte000;}
    }
    if (jjte000 instanceof ParseException) {
      {if (true) throw (ParseException)jjte000;}
    }
    {if (true) throw (Error)jjte000;}
    } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
    }
  }

  static final public void Polygon() throws ParseException {
                            /*@bgen(jjtree) polygon */
  ASTpolygon jjtn000 = new ASTpolygon(JJTPOLYGON);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      jj_consume_token(POLYGON);
      jj_consume_token(28);
      label_5:
      while (true) {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case INTEGER_LITERAL:
        case NEGATIVE:
          ;
          break;
        default:
          jj_la1[7] = jj_gen;
          break label_5;
        }
        Parameter();
        Parameter();
      }
      jj_consume_token(29);
    } catch (Throwable jjte000) {
    if (jjtc000) {
      jjtree.clearNodeScope(jjtn000);
      jjtc000 = false;
    } else {
      jjtree.popNode();
    }
    if (jjte000 instanceof RuntimeException) {
      {if (true) throw (RuntimeException)jjte000;}
    }
    if (jjte000 instanceof ParseException) {
      {if (true) throw (ParseException)jjte000;}
    }
    {if (true) throw (Error)jjte000;}
    } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
    }
  }

  static final public void Triangle() throws ParseException {
                            /*@bgen(jjtree) triangle */
  ASTtriangle jjtn000 = new ASTtriangle(JJTTRIANGLE);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      jj_consume_token(TRIANGLE);
      jj_consume_token(28);
      Parameter();
      Parameter();
      Parameter();
      Parameter();
      Parameter();
      Parameter();
      jj_consume_token(29);
    } catch (Throwable jjte000) {
    if (jjtc000) {
      jjtree.clearNodeScope(jjtn000);
      jjtc000 = false;
    } else {
      jjtree.popNode();
    }
    if (jjte000 instanceof RuntimeException) {
      {if (true) throw (RuntimeException)jjte000;}
    }
    if (jjte000 instanceof ParseException) {
      {if (true) throw (ParseException)jjte000;}
    }
    {if (true) throw (Error)jjte000;}
    } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
    }
  }

  static final public void Ellipse() throws ParseException {
                          /*@bgen(jjtree) ellipse */
  ASTellipse jjtn000 = new ASTellipse(JJTELLIPSE);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      jj_consume_token(ELLIPSE);
      jj_consume_token(28);
      Parameter();
      Parameter();
      Parameter();
      Parameter();
      jj_consume_token(29);
    } catch (Throwable jjte000) {
    if (jjtc000) {
      jjtree.clearNodeScope(jjtn000);
      jjtc000 = false;
    } else {
      jjtree.popNode();
    }
    if (jjte000 instanceof RuntimeException) {
      {if (true) throw (RuntimeException)jjte000;}
    }
    if (jjte000 instanceof ParseException) {
      {if (true) throw (ParseException)jjte000;}
    }
    {if (true) throw (Error)jjte000;}
    } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
    }
  }

  static final public void Circle() throws ParseException {
                         /*@bgen(jjtree) circle */
  ASTcircle jjtn000 = new ASTcircle(JJTCIRCLE);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      jj_consume_token(CIRCLE);
      jj_consume_token(28);
      Parameter();
      Parameter();
      Parameter();
      jj_consume_token(29);
    } catch (Throwable jjte000) {
    if (jjtc000) {
      jjtree.clearNodeScope(jjtn000);
      jjtc000 = false;
    } else {
      jjtree.popNode();
    }
    if (jjte000 instanceof RuntimeException) {
      {if (true) throw (RuntimeException)jjte000;}
    }
    if (jjte000 instanceof ParseException) {
      {if (true) throw (ParseException)jjte000;}
    }
    {if (true) throw (Error)jjte000;}
    } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
    }
  }

  static final public void Text() throws ParseException {
                     /*@bgen(jjtree) text */
                     ASTtext jjtn000 = new ASTtext(JJTTEXT);
                     boolean jjtc000 = true;
                     jjtree.openNodeScope(jjtn000);Token t;
    try {
      jj_consume_token(TEXT);
      jj_consume_token(28);
      Parameter();
      Parameter();
      Parameter();
      jj_consume_token(32);
      t = jj_consume_token(STRING_LITERAL);
      jj_consume_token(32);
      jj_consume_token(29);
     jjtree.closeNodeScope(jjtn000, true);
     jjtc000 = false;
       jjtn000.str = t.image.toString();
    } catch (Throwable jjte000) {
    if (jjtc000) {
      jjtree.clearNodeScope(jjtn000);
      jjtc000 = false;
    } else {
      jjtree.popNode();
    }
    if (jjte000 instanceof RuntimeException) {
      {if (true) throw (RuntimeException)jjte000;}
    }
    if (jjte000 instanceof ParseException) {
      {if (true) throw (ParseException)jjte000;}
    }
    {if (true) throw (Error)jjte000;}
    } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
    }
  }

  static final public void Colour() throws ParseException {
                        /*@bgen(jjtree) colour */
                        ASTcolour jjtn000 = new ASTcolour(JJTCOLOUR);
                        boolean jjtc000 = true;
                        jjtree.openNodeScope(jjtn000);Token t;
    try {
      jj_consume_token(COLOUR);
      jj_consume_token(28);
      t = jj_consume_token(ACOLOUR);
      jj_consume_token(29);
     jjtree.closeNodeScope(jjtn000, true);
     jjtc000 = false;
       jjtn000.col = t.image.toString();
    } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
    }
  }

  static final public void LineWidth() throws ParseException {
                              /*@bgen(jjtree) lineWidth */
  ASTlineWidth jjtn000 = new ASTlineWidth(JJTLINEWIDTH);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      jj_consume_token(BRUSH);
      jj_consume_token(28);
      Parameter();
      jj_consume_token(29);
    } catch (Throwable jjte000) {
    if (jjtc000) {
      jjtree.clearNodeScope(jjtn000);
      jjtc000 = false;
    } else {
      jjtree.popNode();
    }
    if (jjte000 instanceof RuntimeException) {
      {if (true) throw (RuntimeException)jjte000;}
    }
    if (jjte000 instanceof ParseException) {
      {if (true) throw (ParseException)jjte000;}
    }
    {if (true) throw (Error)jjte000;}
    } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
    }
  }

  static final public void Translation() throws ParseException {
                                  /*@bgen(jjtree) translation */
  ASTtranslation jjtn000 = new ASTtranslation(JJTTRANSLATION);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      jj_consume_token(OFFSET);
      jj_consume_token(28);
      Parameter();
      Parameter();
      jj_consume_token(29);
    } catch (Throwable jjte000) {
    if (jjtc000) {
      jjtree.clearNodeScope(jjtn000);
      jjtc000 = false;
    } else {
      jjtree.popNode();
    }
    if (jjte000 instanceof RuntimeException) {
      {if (true) throw (RuntimeException)jjte000;}
    }
    if (jjte000 instanceof ParseException) {
      {if (true) throw (ParseException)jjte000;}
    }
    {if (true) throw (Error)jjte000;}
    } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
    }
  }

  static final public void Scaling() throws ParseException {
                          /*@bgen(jjtree) scaling */
  ASTscaling jjtn000 = new ASTscaling(JJTSCALING);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      jj_consume_token(SCALE);
      jj_consume_token(28);
      Parameter();
      Parameter();
      jj_consume_token(29);
    } catch (Throwable jjte000) {
    if (jjtc000) {
      jjtree.clearNodeScope(jjtn000);
      jjtc000 = false;
    } else {
      jjtree.popNode();
    }
    if (jjte000 instanceof RuntimeException) {
      {if (true) throw (RuntimeException)jjte000;}
    }
    if (jjte000 instanceof ParseException) {
      {if (true) throw (ParseException)jjte000;}
    }
    {if (true) throw (Error)jjte000;}
    } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
    }
  }

  static final public void Stamping() throws ParseException {
                            /*@bgen(jjtree) stamping */
  ASTstamping jjtn000 = new ASTstamping(JJTSTAMPING);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      jj_consume_token(REPEAT);
      jj_consume_token(28);
      Parameter();
      Parameter();
      Parameter();
      jj_consume_token(29);
    } catch (Throwable jjte000) {
    if (jjtc000) {
      jjtree.clearNodeScope(jjtn000);
      jjtc000 = false;
    } else {
      jjtree.popNode();
    }
    if (jjte000 instanceof RuntimeException) {
      {if (true) throw (RuntimeException)jjte000;}
    }
    if (jjte000 instanceof ParseException) {
      {if (true) throw (ParseException)jjte000;}
    }
    {if (true) throw (Error)jjte000;}
    } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
    }
  }

  static final public void Parameter() throws ParseException {
                              /*@bgen(jjtree) parameter */
                               ASTparameter jjtn000 = new ASTparameter(JJTPARAMETER);
                               boolean jjtc000 = true;
                               jjtree.openNodeScope(jjtn000);Token s=null,t;
    try {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case NEGATIVE:
        s = jj_consume_token(NEGATIVE);
        break;
      default:
        jj_la1[8] = jj_gen;
        ;
      }
      t = jj_consume_token(INTEGER_LITERAL);
     jjtree.closeNodeScope(jjtn000, true);
     jjtc000 = false;
       jjtn000.val = Integer.parseInt(t.image);
       if(s!=null)
       {
          jjtn000.val = 0-jjtn000.val;
       }
    } finally {
      if (jjtc000) {
        jjtree.closeNodeScope(jjtn000, true);
      }
    }
  }

  static final 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 final private boolean jj_3R_33() {
    if (jj_scan_token(TEXT)) return true;
    return false;
  }

  static final private boolean jj_3R_24() {
    if (jj_3R_38()) return true;
    return false;
  }

  static final private boolean jj_3R_31() {
    if (jj_scan_token(CIRCLE)) return true;
    return false;
  }

  static final private boolean jj_3R_19() {
    if (jj_3R_33()) return true;
    return false;
  }

  static final private boolean jj_3R_18() {
    if (jj_3R_32()) return true;
    return false;
  }

  static final private boolean jj_3R_17() {
    if (jj_3R_31()) return true;
    return false;
  }

  static final private boolean jj_3R_32() {
    if (jj_scan_token(ELLIPSE)) return true;
    return false;
  }

  static final private boolean jj_3R_23() {
    if (jj_3R_37()) return true;
    return false;
  }

  static final private boolean jj_3R_16() {
    if (jj_3R_30()) return true;
    return false;
  }

  static final private boolean jj_3R_15() {
    if (jj_3R_29()) return true;
    return false;
  }

  static final private boolean jj_3R_14() {
    if (jj_3R_28()) return true;
    return false;
  }

  static final private boolean jj_3R_38() {
    if (jj_scan_token(REPEAT)) return true;
    return false;
  }

  static final private boolean jj_3R_30() {
    if (jj_scan_token(TRIANGLE)) return true;
    return false;
  }

  static final private boolean jj_3R_6() {
    if (jj_3R_7()) return true;
    return false;
  }

  static final private boolean jj_3R_13() {
    if (jj_3R_27()) return true;
    return false;
  }

  static final private boolean jj_3R_12() {
    if (jj_3R_26()) return true;
    return false;
  }

  static final private boolean jj_3R_37() {
    if (jj_scan_token(SCALE)) return true;
    return false;
  }

  static final private boolean jj_3R_29() {
    if (jj_scan_token(POLYGON)) return true;
    return false;
  }

  static final private boolean jj_3R_11() {
    if (jj_3R_25()) return true;
    return false;
  }

  static final private boolean jj_3R_9() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_11()) {
    jj_scanpos = xsp;
    if (jj_3R_12()) {
    jj_scanpos = xsp;
    if (jj_3R_13()) {
    jj_scanpos = xsp;
    if (jj_3R_14()) {
    jj_scanpos = xsp;
    if (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()) return true;
    }
    }
    }
    }
    }
    }
    }
    }
    return false;
  }

  static final private boolean jj_3R_22() {
    if (jj_3R_36()) return true;
    return false;
  }

  static final private boolean jj_3R_8() {
    if (jj_3R_10()) return true;
    return false;
  }

  static final private boolean jj_3R_7() {
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_8()) { jj_scanpos = xsp; break; }
    }
    if (jj_3R_9()) return true;
    return false;
  }

  static final private boolean jj_3R_36() {
    if (jj_scan_token(OFFSET)) return true;
    return false;
  }

  static final private boolean jj_3R_28() {
    if (jj_scan_token(RECTANGLE)) return true;
    return false;
  }

  static final private boolean jj_3R_35() {
    if (jj_scan_token(BRUSH)) return true;
    return false;
  }

  static final private boolean jj_3R_27() {
    if (jj_scan_token(LINE)) return true;
    return false;
  }

  static final private boolean jj_3_1() {
    if (jj_scan_token(30)) return true;
    Token xsp;
    if (jj_3R_6()) return true;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_6()) { jj_scanpos = xsp; break; }
    }
    return false;
  }

  static final private boolean jj_3R_26() {
    if (jj_scan_token(SQUARE)) return true;
    return false;
  }

  static final private boolean jj_3R_21() {
    if (jj_3R_35()) return true;
    return false;
  }

  static final private boolean jj_3R_34() {
    if (jj_scan_token(COLOUR)) return true;
    return false;
  }

  static final private boolean jj_3R_25() {
    if (jj_scan_token(30)) return true;
    return false;
  }

  static final private boolean jj_3R_10() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_20()) {
    jj_scanpos = xsp;
    if (jj_3R_21()) {
    jj_scanpos = xsp;
    if (jj_3R_22()) {
    jj_scanpos = xsp;
    if (jj_3R_23()) {
    jj_scanpos = xsp;
    if (jj_3R_24()) return true;
    }
    }
    }
    }
    return false;
  }

  static final private boolean jj_3R_20() {
    if (jj_3R_34()) return true;
    return false;
  }

  static private boolean jj_initialized_once = false;
  static public drawphase3TokenManager token_source;
  static SimpleCharStream jj_input_stream;
  static public Token token, jj_nt;
  static private int jj_ntk;
  static private Token jj_scanpos, jj_lastpos;
  static private int jj_la;
  static public boolean lookingAhead = false;
  static private boolean jj_semLA;
  static private int jj_gen;
  static final private int[] jj_la1 = new int[9];
  static private int[] jj_la1_0;
  static private int[] jj_la1_1;
  static {
      jj_la1_0();
      jj_la1_1();
   }
   private static void jj_la1_0() {
      jj_la1_0 = new int[] {0x47ffc000,0x47ffc000,0x47ffc000,0x700c000,0x40ff0000,0x700c000,0x47ffc000,0x80,0x0,};
   }
   private static void jj_la1_1() {
      jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x4,};
   }
  static final private JJCalls[] jj_2_rtns = new JJCalls[1];
  static private boolean jj_rescan = false;
  static private int jj_gc = 0;

  public drawphase3(java.io.InputStream stream) {
    if (jj_initialized_once) {
      System.out.println("ERROR: Second call to constructor of static parser.  You must");
      System.out.println("       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 drawphase3TokenManager(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 9; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  static public void ReInit(java.io.InputStream stream) {
    jj_input_stream.ReInit(stream, 1, 1);
    token_source.ReInit(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jjtree.reset();
    jj_gen = 0;
    for (int i = 0; i < 9; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  public drawphase3(java.io.Reader stream) {
    if (jj_initialized_once) {
      System.out.println("ERROR: Second call to constructor of static parser.  You must");
      System.out.println("       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 drawphase3TokenManager(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 9; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  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;
    jjtree.reset();
    jj_gen = 0;
    for (int i = 0; i < 9; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  public drawphase3(drawphase3TokenManager tm) {
    if (jj_initialized_once) {
      System.out.println("ERROR: Second call to constructor of static parser.  You must");
      System.out.println("       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 < 9; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  public void ReInit(drawphase3TokenManager tm) {
    token_source = tm;
    token = new Token();
    jj_ntk = -1;
    jjtree.reset();
    jj_gen = 0;
    for (int i = 0; i < 9; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

  static final 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 final 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;
  }

  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;
  }

  static final public Token getToken(int index) {
    Token t = 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 final 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.Vector jj_expentries = new java.util.Vector();
  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];
      }
      boolean exists = false;
      for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements();) {
        int[] oldentry = (int[])(e.nextElement());
        if (oldentry.length == jj_expentry.length) {
          exists = true;
          for (int i = 0; i < jj_expentry.length; i++) {
            if (oldentry[i] != jj_expentry[i]) {
              exists = false;
              break;
            }
          }
          if (exists) break;
        }
      }
      if (!exists) jj_expentries.addElement(jj_expentry);
      if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
    }
  }

  static public ParseException generateParseException() {
    jj_expentries.removeAllElements();
    boolean[] la1tokens = new boolean[35];
    for (int i = 0; i < 35; i++) {
      la1tokens[i] = false;
    }
    if (jj_kind >= 0) {
      la1tokens[jj_kind] = true;
      jj_kind = -1;
    }
    for (int i = 0; i < 9; 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 < 35; i++) {
      if (la1tokens[i]) {
        jj_expentry = new int[1];
        jj_expentry[0] = i;
        jj_expentries.addElement(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] = (int[])jj_expentries.elementAt(i);
    }
    return new ParseException(token, exptokseq, tokenImage);
  }

  static final public void enable_tracing() {
  }

  static final public void disable_tracing() {
  }

  static final private void jj_rescan_token() {
    jj_rescan = true;
    for (int i = 0; i < 1; i++) {
      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;
          }
        }
        p = p.next;
      } while (p != null);
    }
    jj_rescan = false;
  }

  static final 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;
  }

  }
