/* Generated By:JJTree&JavaCC: Do not edit this line. Parser.java */
package org.nfunk.jep;

import org.nfunk.jep.function.*;

public class Parser/*@bgen(jjtree)*/implements ParserTreeConstants, ParserConstants {/*@bgen(jjtree)*/
  protected JJTParserState jjtree = new JJTParserState();private JEP     jep;
        private SymbolTable symTab;
        private OperatorSet opSet;
        private int initialTokenManagerState = DEFAULT;

        public Node parseStream(java.io.Reader stream, JEP jep_in)
                                                        throws ParseException {
                restart(stream,jep_in);
                // Parse the expression, and return the 
                enable_tracing();
                Node node = Start();
                if (node == null) throw new ParseException("No expression entered");
                return node.jjtGetChild(0);
        }

        /** 
	 * Restart the parse with the given stream.
	 * @since 2.3.0 beta 1
	 */
        public void restart(java.io.Reader stream, JEP jep_in)
        {
                ReInit(stream);
                this.token_source.SwitchTo(initialTokenManagerState);
                jep = jep_in;
                symTab = jep.getSymbolTable();
                opSet = jep.getOperatorSet();
        }
        /**
	 * Continue parsing without re-initilising stream.
	 * Allows renetrancy of parser so that strings like
	 * "x=1; y=2; z=3;" can be parsed.
	 * When a semi colon is encountered parsing finishes leaving the rest of the string unparsed.
	 * Parsing can be resumed from the current position by using this method.
	 * For example
	 * <pre>
	 * XJep j = new XJep();
	 * Parser parse = j.getParse();
	 * StringReader sr = new StringReader("x=1; y=2; z=3;");
	 * parse.restart(sr,j);
	 * Node node;
	 * try {
	 * while((node = j.continueParse())!=null) {
	 *    j.println(node);
	 * } }catch(ParseException e) {}
	 * </pre>
	 */
        public Node continueParse() throws ParseException
        {
                ASTStart node = Start();
                if (node==null) return null;
                return node.jjtGetChild(0);
        }

        private void addToErrorList(String errorStr) {
                jep.errorList.addElement(errorStr);
        }

        /**
	 * Sets the initial state that the token manager is in.
	 * Can be used to change how x.x is interpreted, either as a single
	 * identifier (DEFAULT) or as x <DOT> x (NO_DOT_IN_IDENTIFIERS)
	 * @param state the state to be in. Currently the only legal values are DEFAULT and NO_DOT_IN_IDENTIFIER
	 */
        public void setInitialTokenManagerState(int state)
        {
                initialTokenManagerState = state;
        }
        /**
	 * Translate all escape sequences to characters. Inspired by Rob Millar's
	 * unescape() method in rcm.util.Str fron the Web Sphinx project.
	 *
	 * @param inputStr String containing escape characters.
	 * @return String with all escape sequences replaced.
	 */
        private String replaceEscape(String inputStr) {
                int len = inputStr.length();
                int p = 0;
                int i;
                String metachars = "tnrbf\\\"'";
                String chars = "\t\n\r\b\f\\\"'";

                StringBuffer output = new StringBuffer();

                while ((i = inputStr.indexOf('\\', p)) != -1) {
                        output.append(inputStr.substring(p, i));

                        if (i+1 == len) break;

                        // find metacharacter
            char metac = inputStr.charAt(i+1);

            // find the index of the metac
            int k = metachars.indexOf(metac);
            if (k == -1) {
                // didn't find the metachar, leave sequence as found.
                // This code should be unreachable if the parser
                // is functioning properly because strings containing
                // unknown escape characters should not be accepted.
                output.append('\\');
                output.append(metac);
            } else {
                // its corresponding true char
                output.append(chars.charAt(k));
            }

                        // skip over both escape character & metacharacter
            p = i + 2;
                }

                // add the end of the input string to the output
        if (p < len)
            output.append(inputStr.substring(p));

        return output.toString();
        }

/***************************************************************
GRAMMAR START
***************************************************************/
  final public ASTStart Start() throws ParseException {
 /*@bgen(jjtree) Start */
  ASTStart jjtn000 = new ASTStart(JJTSTART);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      if (jj_2_1(1)) {
        Expression();
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case 0:
          jj_consume_token(0);
          break;
        case SEMI:
          jj_consume_token(SEMI);
          break;
        default:
          jj_la1[0] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
                                          jjtree.closeNodeScope(jjtn000, true);
                                          jjtc000 = false;
                                          {if (true) return jjtn000;}
      } else {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case 0:
        case SEMI:
          switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
          case 0:
            jj_consume_token(0);
            break;
          case SEMI:
            jj_consume_token(SEMI);
            break;
          default:
            jj_la1[1] = jj_gen;
            jj_consume_token(-1);
            throw new ParseException();
          }
          jjtree.closeNodeScope(jjtn000, true);
          jjtc000 = false;
                // njf - The next line is commented out in 2.3.0 since
                //       two "No expression entered" errors are reported
                //       in EvaluatorVisitor and Console (one from here
                //       the other from ParseStream() )
                //       Decided to just return null, and handle the error
                //       in ParseStream.
                // addToErrorList("No expression entered");
                {if (true) return null;}
          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);
          }
    }
    throw new Error("Missing return statement in function");
  }

// Expresions can be like
// x=3
// x=y=3 parsed as x=(y=3)
  final public void Expression() throws ParseException {
    if (jj_2_2(2147483647)) {
      AssignExpression();
    } else if (jj_2_3(1)) {
      RightExpression();
    } else {
      jj_consume_token(-1);
      throw new ParseException();
    }
  }

  final public void AssignExpression() throws ParseException {
          ASTFunNode jjtn001 = new ASTFunNode(JJTFUNNODE);
          boolean jjtc001 = true;
          jjtree.openNodeScope(jjtn001);
    try {
      LValue();
      jj_consume_token(ASSIGN);
      Expression();
                  jjtree.closeNodeScope(jjtn001,  2);
                  jjtc001 = false;
                        if (!jep.getAllowAssignment()) {if (true) throw new ParseException(
                "Syntax Error (assignment not enabled)");}

                        jjtn001.setOperator(opSet.getAssign());
    } catch (Throwable jjte001) {
          if (jjtc001) {
            jjtree.clearNodeScope(jjtn001);
            jjtc001 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte001 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte001;}
          }
          if (jjte001 instanceof ParseException) {
            {if (true) throw (ParseException)jjte001;}
          }
          {if (true) throw (Error)jjte001;}
    } finally {
          if (jjtc001) {
            jjtree.closeNodeScope(jjtn001,  2);
          }
    }
  }

  final public void RightExpression() throws ParseException {
    OrExpression();
  }

  final public void OrExpression() throws ParseException {
    AndExpression();
    label_1:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case OR:
        ;
        break;
      default:
        jj_la1[3] = jj_gen;
        break label_1;
      }
            ASTFunNode jjtn001 = new ASTFunNode(JJTFUNNODE);
            boolean jjtc001 = true;
            jjtree.openNodeScope(jjtn001);
      try {
        jj_consume_token(OR);
        AndExpression();
                  jjtree.closeNodeScope(jjtn001,  2);
                  jjtc001 = false;
                        jjtn001.setOperator(opSet.getOr());
      } catch (Throwable jjte001) {
            if (jjtc001) {
              jjtree.clearNodeScope(jjtn001);
              jjtc001 = false;
            } else {
              jjtree.popNode();
            }
            if (jjte001 instanceof RuntimeException) {
              {if (true) throw (RuntimeException)jjte001;}
            }
            if (jjte001 instanceof ParseException) {
              {if (true) throw (ParseException)jjte001;}
            }
            {if (true) throw (Error)jjte001;}
      } finally {
            if (jjtc001) {
              jjtree.closeNodeScope(jjtn001,  2);
            }
      }
    }
  }

  final public void AndExpression() throws ParseException {
    EqualExpression();
    label_2:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case AND:
        ;
        break;
      default:
        jj_la1[4] = jj_gen;
        break label_2;
      }
            ASTFunNode jjtn001 = new ASTFunNode(JJTFUNNODE);
            boolean jjtc001 = true;
            jjtree.openNodeScope(jjtn001);
      try {
        jj_consume_token(AND);
        EqualExpression();
                  jjtree.closeNodeScope(jjtn001,  2);
                  jjtc001 = false;
                        jjtn001.setOperator(opSet.getAnd());
      } catch (Throwable jjte001) {
            if (jjtc001) {
              jjtree.clearNodeScope(jjtn001);
              jjtc001 = false;
            } else {
              jjtree.popNode();
            }
            if (jjte001 instanceof RuntimeException) {
              {if (true) throw (RuntimeException)jjte001;}
            }
            if (jjte001 instanceof ParseException) {
              {if (true) throw (ParseException)jjte001;}
            }
            {if (true) throw (Error)jjte001;}
      } finally {
            if (jjtc001) {
              jjtree.closeNodeScope(jjtn001,  2);
            }
      }
    }
  }

  final public void EqualExpression() throws ParseException {
    RelationalExpression();
    label_3:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case EQ:
      case NE:
        ;
        break;
      default:
        jj_la1[5] = jj_gen;
        break label_3;
      }
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case NE:
            ASTFunNode jjtn001 = new ASTFunNode(JJTFUNNODE);
            boolean jjtc001 = true;
            jjtree.openNodeScope(jjtn001);
        try {
          jj_consume_token(NE);
          RelationalExpression();
              jjtree.closeNodeScope(jjtn001,  2);
              jjtc001 = false;
            jjtn001.setOperator(opSet.getNE());
        } catch (Throwable jjte001) {
            if (jjtc001) {
              jjtree.clearNodeScope(jjtn001);
              jjtc001 = false;
            } else {
              jjtree.popNode();
            }
            if (jjte001 instanceof RuntimeException) {
              {if (true) throw (RuntimeException)jjte001;}
            }
            if (jjte001 instanceof ParseException) {
              {if (true) throw (ParseException)jjte001;}
            }
            {if (true) throw (Error)jjte001;}
        } finally {
            if (jjtc001) {
              jjtree.closeNodeScope(jjtn001,  2);
            }
        }
        break;
      case EQ:
            ASTFunNode jjtn002 = new ASTFunNode(JJTFUNNODE);
            boolean jjtc002 = true;
            jjtree.openNodeScope(jjtn002);
        try {
          jj_consume_token(EQ);
          RelationalExpression();
              jjtree.closeNodeScope(jjtn002,  2);
              jjtc002 = false;
              jjtn002.setOperator(opSet.getEQ());
        } catch (Throwable jjte002) {
            if (jjtc002) {
              jjtree.clearNodeScope(jjtn002);
              jjtc002 = false;
            } else {
              jjtree.popNode();
            }
            if (jjte002 instanceof RuntimeException) {
              {if (true) throw (RuntimeException)jjte002;}
            }
            if (jjte002 instanceof ParseException) {
              {if (true) throw (ParseException)jjte002;}
            }
            {if (true) throw (Error)jjte002;}
        } finally {
            if (jjtc002) {
              jjtree.closeNodeScope(jjtn002,  2);
            }
        }
        break;
      default:
        jj_la1[6] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
  }

  final public void RelationalExpression() throws ParseException {
    AdditiveExpression();
    label_4:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case GT:
      case LT:
      case LE:
      case GE:
        ;
        break;
      default:
        jj_la1[7] = jj_gen;
        break label_4;
      }
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case LT:
      ASTFunNode jjtn001 = new ASTFunNode(JJTFUNNODE);
      boolean jjtc001 = true;
      jjtree.openNodeScope(jjtn001);
        try {
          jj_consume_token(LT);
          AdditiveExpression();
        jjtree.closeNodeScope(jjtn001,  2);
        jjtc001 = false;
            jjtn001.setOperator(opSet.getLT());
        } catch (Throwable jjte001) {
      if (jjtc001) {
        jjtree.clearNodeScope(jjtn001);
        jjtc001 = false;
      } else {
        jjtree.popNode();
      }
      if (jjte001 instanceof RuntimeException) {
        {if (true) throw (RuntimeException)jjte001;}
      }
      if (jjte001 instanceof ParseException) {
        {if (true) throw (ParseException)jjte001;}
      }
      {if (true) throw (Error)jjte001;}
        } finally {
      if (jjtc001) {
        jjtree.closeNodeScope(jjtn001,  2);
      }
        }
        break;
      case GT:
      ASTFunNode jjtn002 = new ASTFunNode(JJTFUNNODE);
      boolean jjtc002 = true;
      jjtree.openNodeScope(jjtn002);
        try {
          jj_consume_token(GT);
          AdditiveExpression();
        jjtree.closeNodeScope(jjtn002,  2);
        jjtc002 = false;
        jjtn002.setOperator(opSet.getGT());
        } catch (Throwable jjte002) {
      if (jjtc002) {
        jjtree.clearNodeScope(jjtn002);
        jjtc002 = false;
      } else {
        jjtree.popNode();
      }
      if (jjte002 instanceof RuntimeException) {
        {if (true) throw (RuntimeException)jjte002;}
      }
      if (jjte002 instanceof ParseException) {
        {if (true) throw (ParseException)jjte002;}
      }
      {if (true) throw (Error)jjte002;}
        } finally {
      if (jjtc002) {
        jjtree.closeNodeScope(jjtn002,  2);
      }
        }
        break;
      case LE:
      ASTFunNode jjtn003 = new ASTFunNode(JJTFUNNODE);
      boolean jjtc003 = true;
      jjtree.openNodeScope(jjtn003);
        try {
          jj_consume_token(LE);
          AdditiveExpression();
        jjtree.closeNodeScope(jjtn003,  2);
        jjtc003 = false;
            jjtn003.setOperator(opSet.getLE());
        } catch (Throwable jjte003) {
      if (jjtc003) {
        jjtree.clearNodeScope(jjtn003);
        jjtc003 = false;
      } else {
        jjtree.popNode();
      }
      if (jjte003 instanceof RuntimeException) {
        {if (true) throw (RuntimeException)jjte003;}
      }
      if (jjte003 instanceof ParseException) {
        {if (true) throw (ParseException)jjte003;}
      }
      {if (true) throw (Error)jjte003;}
        } finally {
      if (jjtc003) {
        jjtree.closeNodeScope(jjtn003,  2);
      }
        }
        break;
      case GE:
      ASTFunNode jjtn004 = new ASTFunNode(JJTFUNNODE);
      boolean jjtc004 = true;
      jjtree.openNodeScope(jjtn004);
        try {
          jj_consume_token(GE);
          AdditiveExpression();
        jjtree.closeNodeScope(jjtn004,  2);
        jjtc004 = false;
        jjtn004.setOperator(opSet.getGE());
        } catch (Throwable jjte004) {
      if (jjtc004) {
        jjtree.clearNodeScope(jjtn004);
        jjtc004 = false;
      } else {
        jjtree.popNode();
      }
      if (jjte004 instanceof RuntimeException) {
        {if (true) throw (RuntimeException)jjte004;}
      }
      if (jjte004 instanceof ParseException) {
        {if (true) throw (ParseException)jjte004;}
      }
      {if (true) throw (Error)jjte004;}
        } finally {
      if (jjtc004) {
        jjtree.closeNodeScope(jjtn004,  2);
      }
        }
        break;
      default:
        jj_la1[8] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
  }

  final public void AdditiveExpression() throws ParseException {
    MultiplicativeExpression();
    label_5:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case PLUS:
      case MINUS:
        ;
        break;
      default:
        jj_la1[9] = jj_gen;
        break label_5;
      }
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case PLUS:
      ASTFunNode jjtn001 = new ASTFunNode(JJTFUNNODE);
      boolean jjtc001 = true;
      jjtree.openNodeScope(jjtn001);
        try {
          jj_consume_token(PLUS);
          MultiplicativeExpression();
        jjtree.closeNodeScope(jjtn001,  2);
        jjtc001 = false;
        jjtn001.setOperator(opSet.getAdd());
        } catch (Throwable jjte001) {
      if (jjtc001) {
        jjtree.clearNodeScope(jjtn001);
        jjtc001 = false;
      } else {
        jjtree.popNode();
      }
      if (jjte001 instanceof RuntimeException) {
        {if (true) throw (RuntimeException)jjte001;}
      }
      if (jjte001 instanceof ParseException) {
        {if (true) throw (ParseException)jjte001;}
      }
      {if (true) throw (Error)jjte001;}
        } finally {
      if (jjtc001) {
        jjtree.closeNodeScope(jjtn001,  2);
      }
        }
        break;
      case MINUS:
      ASTFunNode jjtn002 = new ASTFunNode(JJTFUNNODE);
      boolean jjtc002 = true;
      jjtree.openNodeScope(jjtn002);
        try {
          jj_consume_token(MINUS);
          MultiplicativeExpression();
        jjtree.closeNodeScope(jjtn002,  2);
        jjtc002 = false;
        jjtn002.setOperator(opSet.getSubtract());
        } catch (Throwable jjte002) {
      if (jjtc002) {
        jjtree.clearNodeScope(jjtn002);
        jjtc002 = false;
      } else {
        jjtree.popNode();
      }
      if (jjte002 instanceof RuntimeException) {
        {if (true) throw (RuntimeException)jjte002;}
      }
      if (jjte002 instanceof ParseException) {
        {if (true) throw (ParseException)jjte002;}
      }
      {if (true) throw (Error)jjte002;}
        } finally {
      if (jjtc002) {
        jjtree.closeNodeScope(jjtn002,  2);
      }
        }
        break;
      default:
        jj_la1[10] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
  }

  final public void MultiplicativeExpression() throws ParseException {
    UnaryExpression();
    label_6:
    while (true) {
      if (jj_2_4(1)) {
        ;
      } else {
        break label_6;
      }
      if (jj_2_5(1)) {
      ASTFunNode jjtn001 = new ASTFunNode(JJTFUNNODE);
      boolean jjtc001 = true;
      jjtree.openNodeScope(jjtn001);
        try {
          PowerExpression();
        jjtree.closeNodeScope(jjtn001,  2);
        jjtc001 = false;
        if (!jep.implicitMul) {if (true) throw new ParseException(
                "Syntax Error (implicit multiplication not enabled)");}

        jjtn001.setOperator(opSet.getMultiply());
        } catch (Throwable jjte001) {
      if (jjtc001) {
        jjtree.clearNodeScope(jjtn001);
        jjtc001 = false;
      } else {
        jjtree.popNode();
      }
      if (jjte001 instanceof RuntimeException) {
        {if (true) throw (RuntimeException)jjte001;}
      }
      if (jjte001 instanceof ParseException) {
        {if (true) throw (ParseException)jjte001;}
      }
      {if (true) throw (Error)jjte001;}
        } finally {
      if (jjtc001) {
        jjtree.closeNodeScope(jjtn001,  2);
      }
        }
      } else {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case MUL:
      ASTFunNode jjtn002 = new ASTFunNode(JJTFUNNODE);
      boolean jjtc002 = true;
      jjtree.openNodeScope(jjtn002);
          try {
            jj_consume_token(MUL);
            UnaryExpression();
        jjtree.closeNodeScope(jjtn002,  2);
        jjtc002 = false;
        jjtn002.setOperator(opSet.getMultiply());
          } catch (Throwable jjte002) {
      if (jjtc002) {
        jjtree.clearNodeScope(jjtn002);
        jjtc002 = false;
      } else {
        jjtree.popNode();
      }
      if (jjte002 instanceof RuntimeException) {
        {if (true) throw (RuntimeException)jjte002;}
      }
      if (jjte002 instanceof ParseException) {
        {if (true) throw (ParseException)jjte002;}
      }
      {if (true) throw (Error)jjte002;}
          } finally {
      if (jjtc002) {
        jjtree.closeNodeScope(jjtn002,  2);
      }
          }
          break;
        case DOT:
      ASTFunNode jjtn003 = new ASTFunNode(JJTFUNNODE);
      boolean jjtc003 = true;
      jjtree.openNodeScope(jjtn003);
          try {
            jj_consume_token(DOT);
            UnaryExpression();
        jjtree.closeNodeScope(jjtn003,  2);
        jjtc003 = false;
        jjtn003.setOperator(opSet.getDot());
          } catch (Throwable jjte003) {
      if (jjtc003) {
        jjtree.clearNodeScope(jjtn003);
        jjtc003 = false;
      } else {
        jjtree.popNode();
      }
      if (jjte003 instanceof RuntimeException) {
        {if (true) throw (RuntimeException)jjte003;}
      }
      if (jjte003 instanceof ParseException) {
        {if (true) throw (ParseException)jjte003;}
      }
      {if (true) throw (Error)jjte003;}
          } finally {
      if (jjtc003) {
        jjtree.closeNodeScope(jjtn003,  2);
      }
          }
          break;
        case CROSS:
      ASTFunNode jjtn004 = new ASTFunNode(JJTFUNNODE);
      boolean jjtc004 = true;
      jjtree.openNodeScope(jjtn004);
          try {
            jj_consume_token(CROSS);
            UnaryExpression();
        jjtree.closeNodeScope(jjtn004,  2);
        jjtc004 = false;
        jjtn004.setOperator(opSet.getCross());
          } catch (Throwable jjte004) {
      if (jjtc004) {
        jjtree.clearNodeScope(jjtn004);
        jjtc004 = false;
      } else {
        jjtree.popNode();
      }
      if (jjte004 instanceof RuntimeException) {
        {if (true) throw (RuntimeException)jjte004;}
      }
      if (jjte004 instanceof ParseException) {
        {if (true) throw (ParseException)jjte004;}
      }
      {if (true) throw (Error)jjte004;}
          } finally {
      if (jjtc004) {
        jjtree.closeNodeScope(jjtn004,  2);
      }
          }
          break;
        case DIV:
      ASTFunNode jjtn005 = new ASTFunNode(JJTFUNNODE);
      boolean jjtc005 = true;
      jjtree.openNodeScope(jjtn005);
          try {
            jj_consume_token(DIV);
            UnaryExpression();
        jjtree.closeNodeScope(jjtn005,  2);
        jjtc005 = false;
        jjtn005.setOperator(opSet.getDivide());
          } catch (Throwable jjte005) {
      if (jjtc005) {
        jjtree.clearNodeScope(jjtn005);
        jjtc005 = false;
      } else {
        jjtree.popNode();
      }
      if (jjte005 instanceof RuntimeException) {
        {if (true) throw (RuntimeException)jjte005;}
      }
      if (jjte005 instanceof ParseException) {
        {if (true) throw (ParseException)jjte005;}
      }
      {if (true) throw (Error)jjte005;}
          } finally {
      if (jjtc005) {
        jjtree.closeNodeScope(jjtn005,  2);
      }
          }
          break;
        case MOD:
      ASTFunNode jjtn006 = new ASTFunNode(JJTFUNNODE);
      boolean jjtc006 = true;
      jjtree.openNodeScope(jjtn006);
          try {
            jj_consume_token(MOD);
            UnaryExpression();
        jjtree.closeNodeScope(jjtn006,  2);
        jjtc006 = false;
        jjtn006.setOperator(opSet.getMod());
          } catch (Throwable jjte006) {
      if (jjtc006) {
        jjtree.clearNodeScope(jjtn006);
        jjtc006 = false;
      } else {
        jjtree.popNode();
      }
      if (jjte006 instanceof RuntimeException) {
        {if (true) throw (RuntimeException)jjte006;}
      }
      if (jjte006 instanceof ParseException) {
        {if (true) throw (ParseException)jjte006;}
      }
      {if (true) throw (Error)jjte006;}
          } finally {
      if (jjtc006) {
        jjtree.closeNodeScope(jjtn006,  2);
      }
          }
          break;
        default:
          jj_la1[11] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
      }
    }
  }

  final public void UnaryExpression() throws ParseException {
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case PLUS:
      jj_consume_token(PLUS);
      UnaryExpression();
      break;
    case MINUS:
    ASTFunNode jjtn001 = new ASTFunNode(JJTFUNNODE);
    boolean jjtc001 = true;
    jjtree.openNodeScope(jjtn001);
      try {
        jj_consume_token(MINUS);
        UnaryExpression();
      jjtree.closeNodeScope(jjtn001,  1);
      jjtc001 = false;
          jjtn001.setOperator(opSet.getUMinus());
      } catch (Throwable jjte001) {
    if (jjtc001) {
      jjtree.clearNodeScope(jjtn001);
      jjtc001 = false;
    } else {
      jjtree.popNode();
    }
    if (jjte001 instanceof RuntimeException) {
      {if (true) throw (RuntimeException)jjte001;}
    }
    if (jjte001 instanceof ParseException) {
      {if (true) throw (ParseException)jjte001;}
    }
    {if (true) throw (Error)jjte001;}
      } finally {
    if (jjtc001) {
      jjtree.closeNodeScope(jjtn001,  1);
    }
      }
      break;
    case NOT:
    ASTFunNode jjtn002 = new ASTFunNode(JJTFUNNODE);
    boolean jjtc002 = true;
    jjtree.openNodeScope(jjtn002);
      try {
        jj_consume_token(NOT);
        UnaryExpression();
      jjtree.closeNodeScope(jjtn002,  1);
      jjtc002 = false;
          jjtn002.setOperator(opSet.getNot());
      } catch (Throwable jjte002) {
    if (jjtc002) {
      jjtree.clearNodeScope(jjtn002);
      jjtc002 = false;
    } else {
      jjtree.popNode();
    }
    if (jjte002 instanceof RuntimeException) {
      {if (true) throw (RuntimeException)jjte002;}
    }
    if (jjte002 instanceof ParseException) {
      {if (true) throw (ParseException)jjte002;}
    }
    {if (true) throw (Error)jjte002;}
      } finally {
    if (jjtc002) {
      jjtree.closeNodeScope(jjtn002,  1);
    }
      }
      break;
    default:
      jj_la1[12] = jj_gen;
      if (jj_2_6(1)) {
        PowerExpression();
      } else {
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
  }

  final public void PowerExpression() throws ParseException {
    UnaryExpressionNotPlusMinus();
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case POWER:
    ASTFunNode jjtn001 = new ASTFunNode(JJTFUNNODE);
    boolean jjtc001 = true;
    jjtree.openNodeScope(jjtn001);
      try {
        jj_consume_token(POWER);
        UnaryExpression();
      jjtree.closeNodeScope(jjtn001,  2);
      jjtc001 = false;
      jjtn001.setOperator(opSet.getPower());
      } catch (Throwable jjte001) {
    if (jjtc001) {
      jjtree.clearNodeScope(jjtn001);
      jjtc001 = false;
    } else {
      jjtree.popNode();
    }
    if (jjte001 instanceof RuntimeException) {
      {if (true) throw (RuntimeException)jjte001;}
    }
    if (jjte001 instanceof ParseException) {
      {if (true) throw (ParseException)jjte001;}
    }
    {if (true) throw (Error)jjte001;}
      } finally {
    if (jjtc001) {
      jjtree.closeNodeScope(jjtn001,  2);
    }
      }
      break;
    default:
      jj_la1[13] = jj_gen;
      ;
    }
  }

  final public void UnaryExpressionNotPlusMinus() throws ParseException {
        String identString = "";
        int type;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case INTEGER_LITERAL:
    case FLOATING_POINT_LITERAL:
    case STRING_LITERAL:
      AnyConstant();
      break;
    default:
      jj_la1[14] = jj_gen;
      if (jj_2_7(2147483647)) {
        ArrayAccess();
      } else if ((getToken(1).kind == INDENTIFIER1 || getToken(1).kind == INDENTIFIER2) &&
                                        jep.funTab.containsKey(getToken(1).image)) {
        Function();
      } else {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case INDENTIFIER1:
        case INDENTIFIER2:
          Variable();
          break;
        case LRND:
          jj_consume_token(LRND);
          Expression();
          jj_consume_token(RRND);
          break;
        case LSQ:
          ListExpression();
          break;
        default:
          jj_la1[15] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
      }
    }
  }

  final public void ListExpression() throws ParseException {
 /*@bgen(jjtree) FunNode */
        ASTFunNode jjtn000 = new ASTFunNode(JJTFUNNODE);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);jjtn000.setOperator(opSet.getList());
    try {
      jj_consume_token(LSQ);
      Expression();
      label_7:
      while (true) {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case COMMA:
          ;
          break;
        default:
          jj_la1[16] = jj_gen;
          break label_7;
        }
        jj_consume_token(COMMA);
        Expression();
      }
      jj_consume_token(RSQ);
    } 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);
          }
    }
  }

/*
void RangeExpression()  #FunNode:
{
	jjtThis.setOperator(opSet.getRange());
}
{
	<LSQ> Expression() ( <COLON> Expression() )+ <RSQ>
}
*/
  final public void LValue() throws ParseException {
    if (jj_2_8(2147483647)) {
      ArrayAccess();
    } else {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case INDENTIFIER1:
      case INDENTIFIER2:
        Variable();
        break;
      default:
        jj_la1[17] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
      }
    }
  }

  final public void ArrayAccess() throws ParseException {
    Variable();
    ListExpression();
          ASTFunNode jjtn001 = new ASTFunNode(JJTFUNNODE);
          boolean jjtc001 = true;
          jjtree.openNodeScope(jjtn001);
    try {
          jjtree.closeNodeScope(jjtn001,  2);
          jjtc001 = false;
     jjtn001.setOperator(opSet.getElement());
    } finally {
          if (jjtc001) {
            jjtree.closeNodeScope(jjtn001,  2);
          }
    }
  }

  final public void Variable() throws ParseException {
        String identString = "";
          ASTVarNode jjtn001 = new ASTVarNode(JJTVARNODE);
          boolean jjtc001 = true;
          jjtree.openNodeScope(jjtn001);
    try {
      identString = Identifier();
          jjtree.closeNodeScope(jjtn001, true);
          jjtc001 = false;
                if (symTab.containsKey(identString)) {
                        jjtn001.setVar(symTab.getVar(identString));
                } else {
                        if (jep.allowUndeclared) {
                                jjtn001.setVar(symTab.makeVarIfNeeded(identString));
                        } else {
                                addToErrorList("Unrecognized symbol \"" + identString +"\"");
                        }
                }
    } catch (Throwable jjte001) {
          if (jjtc001) {
            jjtree.clearNodeScope(jjtn001);
            jjtc001 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte001 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte001;}
          }
          if (jjte001 instanceof ParseException) {
            {if (true) throw (ParseException)jjte001;}
          }
          {if (true) throw (Error)jjte001;}
    } finally {
          if (jjtc001) {
            jjtree.closeNodeScope(jjtn001, true);
          }
    }
  }

  final public void Function() throws ParseException {
        int reqArguments = 0;
        String identString = "";
          ASTFunNode jjtn001 = new ASTFunNode(JJTFUNNODE);
          boolean jjtc001 = true;
          jjtree.openNodeScope(jjtn001);
    try {
      identString = Identifier();
                        if (jep.funTab.containsKey(identString)) {
                                //Set number of required arguments
                                reqArguments =
                                        jep.funTab.get(identString).getNumberOfParameters();
                                jjtn001.setFunction(identString,
                                        jep.funTab.get(identString));
                        } else {
                                addToErrorList("!!! Unrecognized function \"" + identString +"\"");
                        }
      jj_consume_token(LRND);
      ArgumentList(reqArguments, identString);
      jj_consume_token(RRND);
    } catch (Throwable jjte001) {
          if (jjtc001) {
            jjtree.clearNodeScope(jjtn001);
            jjtc001 = false;
          } else {
            jjtree.popNode();
          }
          if (jjte001 instanceof RuntimeException) {
            {if (true) throw (RuntimeException)jjte001;}
          }
          if (jjte001 instanceof ParseException) {
            {if (true) throw (ParseException)jjte001;}
          }
          {if (true) throw (Error)jjte001;}
    } finally {
          if (jjtc001) {
            jjtree.closeNodeScope(jjtn001, true);
          }
    }
  }

  final public void ArgumentList(int reqArguments, String functionName) throws ParseException {
        int count = 0;
        String errorStr = "";
    if (jj_2_9(1)) {
      Expression();
                       count++;
      label_8:
      while (true) {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case COMMA:
          ;
          break;
        default:
          jj_la1[18] = jj_gen;
          break label_8;
        }
        jj_consume_token(COMMA);
        Expression();
                               count++;
      }
    } else {
      ;
    }
        if(reqArguments == -1) {
                if(!jep.funTab.get(functionName).checkNumberOfParameters(count))
                {
                                errorStr = "Function \"" + functionName +"\" illegal number of arguments " + count;
                                addToErrorList(errorStr);
                        }
        }
        else if (reqArguments != count) {
                        errorStr = "Function \"" + functionName +"\" requires "
                                   + reqArguments + " parameter";
                        if (reqArguments!=1) errorStr += "s";
                        addToErrorList(errorStr);
                }
  }

  final public String Identifier() throws ParseException {
  Token t;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case INDENTIFIER1:
      t = jj_consume_token(INDENTIFIER1);
      break;
    case INDENTIFIER2:
      t = jj_consume_token(INDENTIFIER2);
      break;
    default:
      jj_la1[19] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                                                       {if (true) return t.image;}
    throw new Error("Missing return statement in function");
  }

  final public void AnyConstant() throws ParseException {
 /*@bgen(jjtree) Constant */
        ASTConstant jjtn000 = new ASTConstant(JJTCONSTANT);
        boolean jjtc000 = true;
        jjtree.openNodeScope(jjtn000);Token t;
        Object value;
    try {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case STRING_LITERAL:
        t = jj_consume_token(STRING_LITERAL);
                             jjtree.closeNodeScope(jjtn000, true);
                             jjtc000 = false;
                // strip away double quotes at end of string
                String temp = (t.image).substring(1,t.image.length()-1);

                // replace escape characters
                temp = replaceEscape(temp);

                jjtn000.setValue(temp);
        break;
      case INTEGER_LITERAL:
      case FLOATING_POINT_LITERAL:
        value = RealConstant();
                                 jjtree.closeNodeScope(jjtn000, true);
                                 jjtc000 = false;
                jjtn000.setValue(value);
//	}
//	|
//	value = Array() {
//		jjtThis.setValue(value);

        break;
      default:
        jj_la1[20] = 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);
          }
    }
  }

/*
Vector Array() :
{
	Object value;
	Vector result = new Vector();
}
{
	<LSQ>
	value = RealConstant()
	{
		result.addElement(value);
	}
	(
		<COMMA>
		value = RealConstant()
		{
			result.addElement(value);
		}
	)* 
	<RSQ>
	{
		return result;
	}
}
*/
  final public Object RealConstant() throws ParseException {
  Token t;
  Object value;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case INTEGER_LITERAL:
      t = jj_consume_token(INTEGER_LITERAL);
      break;
    case FLOATING_POINT_LITERAL:
      t = jj_consume_token(FLOATING_POINT_LITERAL);
      break;
    default:
      jj_la1[21] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
                try {
                        value = jep.getNumberFactory().createNumber(t.image);
                } catch (Exception e) {
                        value = null;
                        addToErrorList("Can't parse \"" + t.image + "\"");
                }

                {if (true) return value;}
    throw new Error("Missing return statement in function");
  }

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

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

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

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

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

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

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

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

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

  final private boolean jj_3R_26() {
    if (jj_3R_10()) return true;
    if (jj_scan_token(ASSIGN)) return true;
    if (jj_3R_9()) return true;
    return false;
  }

  final private boolean jj_3R_59() {
    if (jj_scan_token(GE)) return true;
    if (jj_3R_42()) return true;
    return false;
  }

  final private boolean jj_3R_41() {
    if (jj_3R_43()) return true;
    return false;
  }

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

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

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

  final private boolean jj_3R_9() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_19()) {
    jj_scanpos = xsp;
    if (jj_3_3()) return true;
    }
    return false;
  }

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

  final private boolean jj_3R_58() {
    if (jj_scan_token(LE)) return true;
    if (jj_3R_42()) return true;
    return false;
  }

  final private boolean jj_3R_50() {
    if (jj_scan_token(NOT)) return true;
    if (jj_3R_46()) return true;
    return false;
  }

  final private boolean jj_3R_40() {
    if (jj_scan_token(STRING_LITERAL)) return true;
    return false;
  }

  final private boolean jj_3R_37() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_40()) {
    jj_scanpos = xsp;
    if (jj_3R_41()) return true;
    }
    return false;
  }

  final private boolean jj_3R_57() {
    if (jj_scan_token(GT)) return true;
    if (jj_3R_42()) return true;
    return false;
  }

  final private boolean jj_3R_49() {
    if (jj_scan_token(MINUS)) return true;
    if (jj_3R_46()) return true;
    return false;
  }

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

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

  final private boolean jj_3R_48() {
    if (jj_scan_token(PLUS)) return true;
    if (jj_3R_46()) return true;
    return false;
  }

  final private boolean jj_3R_46() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_48()) {
    jj_scanpos = xsp;
    if (jj_3R_49()) {
    jj_scanpos = xsp;
    if (jj_3R_50()) {
    jj_scanpos = xsp;
    if (jj_3_6()) return true;
    }
    }
    }
    return false;
  }

  final private boolean jj_3R_18() {
    if (jj_3R_24()) return true;
    if (jj_3R_25()) return true;
    return false;
  }

  final private boolean jj_3R_56() {
    if (jj_scan_token(LT)) return true;
    if (jj_3R_42()) return true;
    return false;
  }

  final private boolean jj_3R_52() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_56()) {
    jj_scanpos = xsp;
    if (jj_3R_57()) {
    jj_scanpos = xsp;
    if (jj_3R_58()) {
    jj_scanpos = xsp;
    if (jj_3R_59()) return true;
    }
    }
    }
    return false;
  }

  final private boolean jj_3R_35() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_3R_9()) return true;
    return false;
  }

  final private boolean jj_3R_34() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_scan_token(12)) {
    jj_scanpos = xsp;
    if (jj_scan_token(15)) return true;
    }
    return false;
  }

  final private boolean jj_3R_39() {
    if (jj_3R_42()) return true;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_52()) { jj_scanpos = xsp; break; }
    }
    return false;
  }

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

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

  final private boolean jj_3_1() {
    if (jj_3R_9()) return true;
    return false;
  }

  final private boolean jj_3R_16() {
    if (jj_scan_token(MOD)) return true;
    if (jj_3R_46()) return true;
    return false;
  }

  final private boolean jj_3R_54() {
    if (jj_scan_token(EQ)) return true;
    if (jj_3R_39()) return true;
    return false;
  }

  final private boolean jj_3R_15() {
    if (jj_scan_token(DIV)) return true;
    if (jj_3R_46()) return true;
    return false;
  }

  final private boolean jj_3R_53() {
    if (jj_scan_token(NE)) return true;
    if (jj_3R_39()) return true;
    return false;
  }

  final private boolean jj_3R_51() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_53()) {
    jj_scanpos = xsp;
    if (jj_3R_54()) return true;
    }
    return false;
  }

  final private boolean jj_3R_14() {
    if (jj_scan_token(CROSS)) return true;
    if (jj_3R_46()) return true;
    return false;
  }

  final private boolean jj_3R_36() {
    if (jj_3R_39()) return true;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_51()) { jj_scanpos = xsp; break; }
    }
    return false;
  }

  final private boolean jj_3R_64() {
    if (jj_scan_token(COMMA)) return true;
    if (jj_3R_9()) return true;
    return false;
  }

  final private boolean jj_3R_25() {
    if (jj_scan_token(LSQ)) return true;
    if (jj_3R_9()) return true;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_35()) { jj_scanpos = xsp; break; }
    }
    if (jj_scan_token(RSQ)) return true;
    return false;
  }

  final private boolean jj_3R_13() {
    if (jj_scan_token(DOT)) return true;
    if (jj_3R_46()) return true;
    return false;
  }

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

  final private boolean jj_3R_12() {
    if (jj_scan_token(MUL)) return true;
    if (jj_3R_46()) return true;
    return false;
  }

  final private boolean jj_3R_47() {
    if (jj_scan_token(AND)) return true;
    if (jj_3R_36()) return true;
    return false;
  }

  final private boolean jj_3_9() {
    if (jj_3R_9()) return true;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_64()) { jj_scanpos = xsp; break; }
    }
    return false;
  }

  final private boolean jj_3R_63() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_9()) jj_scanpos = xsp;
    return false;
  }

  final private boolean jj_3R_43() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_scan_token(7)) {
    jj_scanpos = xsp;
    if (jj_scan_token(9)) return true;
    }
    return false;
  }

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

  final private boolean jj_3R_32() {
    if (jj_scan_token(LRND)) return true;
    if (jj_3R_9()) return true;
    if (jj_scan_token(RRND)) return true;
    return false;
  }

  final private boolean jj_3R_27() {
    if (jj_3R_36()) return true;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_47()) { jj_scanpos = xsp; break; }
    }
    return false;
  }

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

  final private boolean jj_3_4() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3_5()) {
    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()) return true;
    }
    }
    }
    }
    }
    return false;
  }

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

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

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

  final private boolean jj_3R_44() {
    if (jj_3R_46()) return true;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3_4()) { jj_scanpos = xsp; break; }
    }
    return false;
  }

  final private boolean jj_3R_23() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_28()) {
    jj_scanpos = xsp;
    if (jj_3R_29()) {
    jj_scanpos = xsp;
    lookingAhead = true;
    jj_semLA = (getToken(1).kind == INDENTIFIER1 || getToken(1).kind == INDENTIFIER2) &&
                                  jep.funTab.containsKey(getToken(1).image);
    lookingAhead = false;
    if (!jj_semLA || jj_3R_30()) {
    jj_scanpos = xsp;
    if (jj_3R_31()) {
    jj_scanpos = xsp;
    if (jj_3R_32()) {
    jj_scanpos = xsp;
    if (jj_3R_33()) return true;
    }
    }
    }
    }
    }
    return false;
  }

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

  final private boolean jj_3R_45() {
    if (jj_scan_token(OR)) return true;
    if (jj_3R_27()) return true;
    return false;
  }

  final private boolean jj_3R_22() {
    if (jj_3R_27()) return true;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_45()) { jj_scanpos = xsp; break; }
    }
    return false;
  }

  final private boolean jj_3R_61() {
    if (jj_scan_token(MINUS)) return true;
    if (jj_3R_44()) return true;
    return false;
  }

  final private boolean jj_3R_38() {
    if (jj_3R_34()) return true;
    if (jj_scan_token(LRND)) return true;
    if (jj_3R_63()) return true;
    if (jj_scan_token(RRND)) return true;
    return false;
  }

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

  final private boolean jj_3R_60() {
    if (jj_scan_token(PLUS)) return true;
    if (jj_3R_44()) return true;
    return false;
  }

  final private boolean jj_3R_55() {
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_60()) {
    jj_scanpos = xsp;
    if (jj_3R_61()) return true;
    }
    return false;
  }

  final private boolean jj_3R_42() {
    if (jj_3R_44()) return true;
    Token xsp;
    while (true) {
      xsp = jj_scanpos;
      if (jj_3R_55()) { jj_scanpos = xsp; break; }
    }
    return false;
  }

  final private boolean jj_3R_62() {
    if (jj_scan_token(POWER)) return true;
    if (jj_3R_46()) return true;
    return false;
  }

  final private boolean jj_3R_17() {
    if (jj_3R_23()) return true;
    Token xsp;
    xsp = jj_scanpos;
    if (jj_3R_62()) jj_scanpos = xsp;
    return false;
  }

  final private boolean jj_3_2() {
    if (jj_3R_10()) return true;
    if (jj_scan_token(ASSIGN)) return true;
    return false;
  }

  public ParserTokenManager token_source;
  JavaCharStream jj_input_stream;
  public Token token, jj_nt;
  private int jj_ntk;
  private Token jj_scanpos, jj_lastpos;
  private int jj_la;
  public boolean lookingAhead = false;
  private boolean jj_semLA;
  private int jj_gen;
  final private int[] jj_la1 = new int[22];
  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[] {0x80001,0x80001,0x80001,0x10000000,0x8000000,0x4800000,0x4800000,0x3600000,0x3600000,0x60000000,0x60000000,0x80000000,0x60000000,0x0,0xa80,0x9000,0x100000,0x9000,0x100000,0x9000,0xa80,0x280,};
   }
   private static void jj_la1_1() {
      jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x27,0x8,0x10,0x0,0x140,0x0,0x0,0x0,0x0,0x0,0x0,};
   }
  final private JJCalls[] jj_2_rtns = new JJCalls[9];
  private boolean jj_rescan = false;
  private int jj_gc = 0;

  public Parser(java.io.InputStream stream) {
    jj_input_stream = new JavaCharStream(stream, 1, 1);
    token_source = new ParserTokenManager(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 22; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

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

  public Parser(java.io.Reader stream) {
    jj_input_stream = new JavaCharStream(stream, 1, 1);
    token_source = new ParserTokenManager(jj_input_stream);
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 22; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

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

  public Parser(ParserTokenManager tm) {
    token_source = tm;
    token = new Token();
    jj_ntk = -1;
    jj_gen = 0;
    for (int i = 0; i < 22; i++) jj_la1[i] = -1;
    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  }

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

  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 { }
  final private LookaheadSuccess jj_ls = new LookaheadSuccess();
  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;
  }

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

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

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

  private java.util.Vector jj_expentries = new java.util.Vector();
  private int[] jj_expentry;
  private int jj_kind = -1;
  private int[] jj_lasttokens = new int[100];
  private int jj_endpos;

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

  public ParseException generateParseException() {
    jj_expentries.removeAllElements();
    boolean[] la1tokens = new boolean[43];
    for (int i = 0; i < 43; i++) {
      la1tokens[i] = false;
    }
    if (jj_kind >= 0) {
      la1tokens[jj_kind] = true;
      jj_kind = -1;
    }
    for (int i = 0; i < 22; 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 < 43; 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);
  }

  final public void enable_tracing() {
  }

  final public void disable_tracing() {
  }

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

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

}
