package org.nfunk.jep; import java.io.InputStream; import java.io.Reader; import java.util.Enumeration; import java.util.Vector; public class Parser implements ParserTreeConstants, ParserConstants { protected JJTParserState jjtree = new JJTParserState(); private JEP jep; private SymbolTable symTab; private OperatorSet opSet; private int initialTokenManagerState = 1; public ParserTokenManager token_source; JavaCharStream jj_input_stream; public Token token; public Token jj_nt; private int jj_ntk; private Token jj_scanpos; private Token jj_lastpos; private int jj_la; public boolean lookingAhead = false; private boolean jj_semLA; private int jj_gen; private final int[] jj_la1 = new int[22]; private static int[] jj_la1_0; private static int[] jj_la1_1; private final JJCalls[] jj_2_rtns = new JJCalls[8]; private boolean jj_rescan = false; private int jj_gc = 0; private final LookaheadSuccess jj_ls = new LookaheadSuccess(); private Vector jj_expentries = new Vector(); private int[] jj_expentry; private int jj_kind = -1; private int[] jj_lasttokens = new int[100]; private int jj_endpos; public Node parseStream(Reader paramReader, JEP paramJEP) throws ParseException { restart(paramReader, paramJEP); enable_tracing(); ASTStart aSTStart = Start(); if (aSTStart == null) throw new ParseException("No expression entered"); return aSTStart.jjtGetChild(0); } public void restart(Reader paramReader, JEP paramJEP) { ReInit(paramReader); this.token_source.SwitchTo(this.initialTokenManagerState); this.jep = paramJEP; this.symTab = this.jep.getSymbolTable(); this.opSet = this.jep.getOperatorSet(); } public Node continueParse() throws ParseException { ASTStart aSTStart = Start(); return (aSTStart == null) ? null : aSTStart.jjtGetChild(0); } private void addToErrorList(String paramString) { this.jep.errorList.addElement(paramString); } public void setInitialTokenManagerState(int paramInt) { this.initialTokenManagerState = paramInt; } private String replaceEscape(String paramString) { int i = paramString.length(); int j = 0; String str1 = "tnrbf\\\"'"; String str2 = "\t\n\r\b\f\\\"'"; StringBuffer stringBuffer = new StringBuffer(); int k; while ((k = paramString.indexOf('\\', j)) != -1) { stringBuffer.append(paramString.substring(j, k)); if (k + 1 == i) break; char c = paramString.charAt(k + 1); int m = str1.indexOf(c); if (m == -1) { stringBuffer.append('\\'); stringBuffer.append(c); } else { stringBuffer.append(str2.charAt(m)); } j = k + 2; } if (j < i) stringBuffer.append(paramString.substring(j)); return stringBuffer.toString(); } public final ASTStart Start() throws ParseException { ASTStart aSTStart = new ASTStart(0); boolean bool = true; this.jjtree.openNodeScope(aSTStart); try { if (jj_2_1(1)) { Expression(); switch ((this.jj_ntk == -1) ? jj_ntk() : this.jj_ntk) { case 0: jj_consume_token(0); break; case 19: jj_consume_token(19); break; default: this.jj_la1[0] = this.jj_gen; jj_consume_token(-1); throw new ParseException(); } this.jjtree.closeNodeScope(aSTStart, true); bool = false; return aSTStart; } switch ((this.jj_ntk == -1) ? jj_ntk() : this.jj_ntk) { case 0: case 19: switch ((this.jj_ntk == -1) ? jj_ntk() : this.jj_ntk) { case 0: jj_consume_token(0); break; case 19: jj_consume_token(19); break; default: this.jj_la1[1] = this.jj_gen; jj_consume_token(-1); throw new ParseException(); } this.jjtree.closeNodeScope(aSTStart, true); bool = false; return null; } this.jj_la1[2] = this.jj_gen; jj_consume_token(-1); throw new ParseException(); } catch (Throwable throwable) { if (bool) { this.jjtree.clearNodeScope(aSTStart); bool = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool) this.jjtree.closeNodeScope(aSTStart, true); } } public final void Expression() throws ParseException { if (jj_2_2(3)) { AssignExpression(); } else if (jj_2_3(1)) { OrExpression(); } else { jj_consume_token(-1); throw new ParseException(); } } public final void AssignExpression() throws ParseException { ASTFunNode aSTFunNode = new ASTFunNode(2); boolean bool = true; this.jjtree.openNodeScope(aSTFunNode); try { Variable(); jj_consume_token(18); Expression(); this.jjtree.closeNodeScope(aSTFunNode, 2); bool = false; if (!this.jep.getAllowAssignment()) throw new ParseException("Syntax Error (assignment not enabled)"); aSTFunNode.setOperator(this.opSet.getAssign()); } catch (Throwable throwable) { if (bool) { this.jjtree.clearNodeScope(aSTFunNode); bool = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool) this.jjtree.closeNodeScope(aSTFunNode, 2); } } public final void OrExpression() throws ParseException { AndExpression(); while (true) { switch ((this.jj_ntk == -1) ? jj_ntk() : this.jj_ntk) { case 28: break; default: this.jj_la1[3] = this.jj_gen; break; } ASTFunNode aSTFunNode = new ASTFunNode(2); boolean bool = true; this.jjtree.openNodeScope(aSTFunNode); try { jj_consume_token(28); AndExpression(); this.jjtree.closeNodeScope(aSTFunNode, 2); bool = false; aSTFunNode.setOperator(this.opSet.getOr()); } catch (Throwable throwable) { if (bool) { this.jjtree.clearNodeScope(aSTFunNode); bool = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool) this.jjtree.closeNodeScope(aSTFunNode, 2); } } } public final void AndExpression() throws ParseException { EqualExpression(); while (true) { switch ((this.jj_ntk == -1) ? jj_ntk() : this.jj_ntk) { case 27: break; default: this.jj_la1[4] = this.jj_gen; break; } ASTFunNode aSTFunNode = new ASTFunNode(2); boolean bool = true; this.jjtree.openNodeScope(aSTFunNode); try { jj_consume_token(27); EqualExpression(); this.jjtree.closeNodeScope(aSTFunNode, 2); bool = false; aSTFunNode.setOperator(this.opSet.getAnd()); } catch (Throwable throwable) { if (bool) { this.jjtree.clearNodeScope(aSTFunNode); bool = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool) this.jjtree.closeNodeScope(aSTFunNode, 2); } } } public final void EqualExpression() throws ParseException { RelationalExpression(); while (true) { ASTFunNode aSTFunNode1; boolean bool1; ASTFunNode aSTFunNode2; boolean bool2; switch ((this.jj_ntk == -1) ? jj_ntk() : this.jj_ntk) { case 23: case 26: break; default: this.jj_la1[5] = this.jj_gen; break; } switch ((this.jj_ntk == -1) ? jj_ntk() : this.jj_ntk) { case 26: aSTFunNode1 = new ASTFunNode(2); bool1 = true; this.jjtree.openNodeScope(aSTFunNode1); try { jj_consume_token(26); RelationalExpression(); this.jjtree.closeNodeScope(aSTFunNode1, 2); bool1 = false; aSTFunNode1.setOperator(this.opSet.getNE()); continue; } catch (Throwable throwable) { if (bool1) { this.jjtree.clearNodeScope(aSTFunNode1); bool1 = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool1) this.jjtree.closeNodeScope(aSTFunNode1, 2); } case 23: aSTFunNode2 = new ASTFunNode(2); bool2 = true; this.jjtree.openNodeScope(aSTFunNode2); try { jj_consume_token(23); RelationalExpression(); this.jjtree.closeNodeScope(aSTFunNode2, 2); bool2 = false; aSTFunNode2.setOperator(this.opSet.getEQ()); continue; } catch (Throwable throwable) { if (bool2) { this.jjtree.clearNodeScope(aSTFunNode2); bool2 = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool2) this.jjtree.closeNodeScope(aSTFunNode2, 2); } } this.jj_la1[6] = this.jj_gen; jj_consume_token(-1); throw new ParseException(); } } public final void RelationalExpression() throws ParseException { AdditiveExpression(); while (true) { ASTFunNode aSTFunNode1; boolean bool1; ASTFunNode aSTFunNode2; boolean bool2; ASTFunNode aSTFunNode3; boolean bool3; ASTFunNode aSTFunNode4; boolean bool4; switch ((this.jj_ntk == -1) ? jj_ntk() : this.jj_ntk) { case 21: case 22: case 24: case 25: break; default: this.jj_la1[7] = this.jj_gen; break; } switch ((this.jj_ntk == -1) ? jj_ntk() : this.jj_ntk) { case 22: aSTFunNode1 = new ASTFunNode(2); bool1 = true; this.jjtree.openNodeScope(aSTFunNode1); try { jj_consume_token(22); AdditiveExpression(); this.jjtree.closeNodeScope(aSTFunNode1, 2); bool1 = false; aSTFunNode1.setOperator(this.opSet.getLT()); continue; } catch (Throwable throwable) { if (bool1) { this.jjtree.clearNodeScope(aSTFunNode1); bool1 = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool1) this.jjtree.closeNodeScope(aSTFunNode1, 2); } case 21: aSTFunNode2 = new ASTFunNode(2); bool2 = true; this.jjtree.openNodeScope(aSTFunNode2); try { jj_consume_token(21); AdditiveExpression(); this.jjtree.closeNodeScope(aSTFunNode2, 2); bool2 = false; aSTFunNode2.setOperator(this.opSet.getGT()); continue; } catch (Throwable throwable) { if (bool2) { this.jjtree.clearNodeScope(aSTFunNode2); bool2 = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool2) this.jjtree.closeNodeScope(aSTFunNode2, 2); } case 24: aSTFunNode3 = new ASTFunNode(2); bool3 = true; this.jjtree.openNodeScope(aSTFunNode3); try { jj_consume_token(24); AdditiveExpression(); this.jjtree.closeNodeScope(aSTFunNode3, 2); bool3 = false; aSTFunNode3.setOperator(this.opSet.getLE()); continue; } catch (Throwable throwable) { if (bool3) { this.jjtree.clearNodeScope(aSTFunNode3); bool3 = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool3) this.jjtree.closeNodeScope(aSTFunNode3, 2); } case 25: aSTFunNode4 = new ASTFunNode(2); bool4 = true; this.jjtree.openNodeScope(aSTFunNode4); try { jj_consume_token(25); AdditiveExpression(); this.jjtree.closeNodeScope(aSTFunNode4, 2); bool4 = false; aSTFunNode4.setOperator(this.opSet.getGE()); continue; } catch (Throwable throwable) { if (bool4) { this.jjtree.clearNodeScope(aSTFunNode4); bool4 = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool4) this.jjtree.closeNodeScope(aSTFunNode4, 2); } } this.jj_la1[8] = this.jj_gen; jj_consume_token(-1); throw new ParseException(); } } public final void AdditiveExpression() throws ParseException { MultiplicativeExpression(); while (true) { ASTFunNode aSTFunNode1; boolean bool1; ASTFunNode aSTFunNode2; boolean bool2; switch ((this.jj_ntk == -1) ? jj_ntk() : this.jj_ntk) { case 29: case 30: break; default: this.jj_la1[9] = this.jj_gen; break; } switch ((this.jj_ntk == -1) ? jj_ntk() : this.jj_ntk) { case 29: aSTFunNode1 = new ASTFunNode(2); bool1 = true; this.jjtree.openNodeScope(aSTFunNode1); try { jj_consume_token(29); MultiplicativeExpression(); this.jjtree.closeNodeScope(aSTFunNode1, 2); bool1 = false; aSTFunNode1.setOperator(this.opSet.getAdd()); continue; } catch (Throwable throwable) { if (bool1) { this.jjtree.clearNodeScope(aSTFunNode1); bool1 = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool1) this.jjtree.closeNodeScope(aSTFunNode1, 2); } case 30: aSTFunNode2 = new ASTFunNode(2); bool2 = true; this.jjtree.openNodeScope(aSTFunNode2); try { jj_consume_token(30); MultiplicativeExpression(); this.jjtree.closeNodeScope(aSTFunNode2, 2); bool2 = false; aSTFunNode2.setOperator(this.opSet.getSubtract()); continue; } catch (Throwable throwable) { if (bool2) { this.jjtree.clearNodeScope(aSTFunNode2); bool2 = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool2) this.jjtree.closeNodeScope(aSTFunNode2, 2); } } this.jj_la1[10] = this.jj_gen; jj_consume_token(-1); throw new ParseException(); } } public final void MultiplicativeExpression() throws ParseException { UnaryExpression(); while (jj_2_4(1)) { ASTFunNode aSTFunNode1; boolean bool1; ASTFunNode aSTFunNode2; boolean bool2; ASTFunNode aSTFunNode3; boolean bool3; ASTFunNode aSTFunNode4; boolean bool4; ASTFunNode aSTFunNode5; boolean bool5; if (jj_2_5(1)) { ASTFunNode aSTFunNode = new ASTFunNode(2); boolean bool = true; this.jjtree.openNodeScope(aSTFunNode); try { PowerExpression(); this.jjtree.closeNodeScope(aSTFunNode, 2); bool = false; if (!this.jep.implicitMul) throw new ParseException("Syntax Error (implicit multiplication not enabled)"); aSTFunNode.setOperator(this.opSet.getMultiply()); continue; } catch (Throwable throwable) { if (bool) { this.jjtree.clearNodeScope(aSTFunNode); bool = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool) this.jjtree.closeNodeScope(aSTFunNode, 2); } } switch ((this.jj_ntk == -1) ? jj_ntk() : this.jj_ntk) { case 31: aSTFunNode1 = new ASTFunNode(2); bool1 = true; this.jjtree.openNodeScope(aSTFunNode1); try { jj_consume_token(31); UnaryExpression(); this.jjtree.closeNodeScope(aSTFunNode1, 2); bool1 = false; aSTFunNode1.setOperator(this.opSet.getMultiply()); continue; } catch (Throwable throwable) { if (bool1) { this.jjtree.clearNodeScope(aSTFunNode1); bool1 = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool1) this.jjtree.closeNodeScope(aSTFunNode1, 2); } case 32: aSTFunNode2 = new ASTFunNode(2); bool2 = true; this.jjtree.openNodeScope(aSTFunNode2); try { jj_consume_token(32); UnaryExpression(); this.jjtree.closeNodeScope(aSTFunNode2, 2); bool2 = false; aSTFunNode2.setOperator(this.opSet.getDot()); continue; } catch (Throwable throwable) { if (bool2) { this.jjtree.clearNodeScope(aSTFunNode2); bool2 = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool2) this.jjtree.closeNodeScope(aSTFunNode2, 2); } case 37: aSTFunNode3 = new ASTFunNode(2); bool3 = true; this.jjtree.openNodeScope(aSTFunNode3); try { jj_consume_token(37); UnaryExpression(); this.jjtree.closeNodeScope(aSTFunNode3, 2); bool3 = false; aSTFunNode3.setOperator(this.opSet.getCross()); continue; } catch (Throwable throwable) { if (bool3) { this.jjtree.clearNodeScope(aSTFunNode3); bool3 = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool3) this.jjtree.closeNodeScope(aSTFunNode3, 2); } case 33: aSTFunNode4 = new ASTFunNode(2); bool4 = true; this.jjtree.openNodeScope(aSTFunNode4); try { jj_consume_token(33); UnaryExpression(); this.jjtree.closeNodeScope(aSTFunNode4, 2); bool4 = false; aSTFunNode4.setOperator(this.opSet.getDivide()); continue; } catch (Throwable throwable) { if (bool4) { this.jjtree.clearNodeScope(aSTFunNode4); bool4 = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool4) this.jjtree.closeNodeScope(aSTFunNode4, 2); } case 34: aSTFunNode5 = new ASTFunNode(2); bool5 = true; this.jjtree.openNodeScope(aSTFunNode5); try { jj_consume_token(34); UnaryExpression(); this.jjtree.closeNodeScope(aSTFunNode5, 2); bool5 = false; aSTFunNode5.setOperator(this.opSet.getMod()); continue; } catch (Throwable throwable) { if (bool5) { this.jjtree.clearNodeScope(aSTFunNode5); bool5 = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool5) this.jjtree.closeNodeScope(aSTFunNode5, 2); } } this.jj_la1[11] = this.jj_gen; jj_consume_token(-1); throw new ParseException(); } } public final void UnaryExpression() throws ParseException { ASTFunNode aSTFunNode1; boolean bool1; ASTFunNode aSTFunNode2; boolean bool2; switch ((this.jj_ntk == -1) ? jj_ntk() : this.jj_ntk) { case 29: jj_consume_token(29); UnaryExpression(); return; case 30: aSTFunNode1 = new ASTFunNode(2); bool1 = true; this.jjtree.openNodeScope(aSTFunNode1); try { jj_consume_token(30); UnaryExpression(); this.jjtree.closeNodeScope(aSTFunNode1, 1); bool1 = false; aSTFunNode1.setOperator(this.opSet.getUMinus()); } catch (Throwable throwable) { if (bool1) { this.jjtree.clearNodeScope(aSTFunNode1); bool1 = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool1) this.jjtree.closeNodeScope(aSTFunNode1, 1); } return; case 35: aSTFunNode2 = new ASTFunNode(2); bool2 = true; this.jjtree.openNodeScope(aSTFunNode2); try { jj_consume_token(35); UnaryExpression(); this.jjtree.closeNodeScope(aSTFunNode2, 1); bool2 = false; aSTFunNode2.setOperator(this.opSet.getNot()); } catch (Throwable throwable) { if (bool2) { this.jjtree.clearNodeScope(aSTFunNode2); bool2 = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool2) this.jjtree.closeNodeScope(aSTFunNode2, 1); } return; } this.jj_la1[12] = this.jj_gen; if (jj_2_6(1)) { PowerExpression(); } else { jj_consume_token(-1); throw new ParseException(); } } public final void PowerExpression() throws ParseException { ASTFunNode aSTFunNode; boolean bool; UnaryExpressionNotPlusMinus(); switch ((this.jj_ntk == -1) ? jj_ntk() : this.jj_ntk) { case 36: aSTFunNode = new ASTFunNode(2); bool = true; this.jjtree.openNodeScope(aSTFunNode); try { jj_consume_token(36); UnaryExpression(); this.jjtree.closeNodeScope(aSTFunNode, 2); bool = false; aSTFunNode.setOperator(this.opSet.getPower()); } catch (Throwable throwable) { if (bool) { this.jjtree.clearNodeScope(aSTFunNode); bool = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool) this.jjtree.closeNodeScope(aSTFunNode, 2); } return; } this.jj_la1[13] = this.jj_gen; } public final void UnaryExpressionNotPlusMinus() throws ParseException { String str = ""; switch ((this.jj_ntk == -1) ? jj_ntk() : this.jj_ntk) { case 7: case 9: case 11: AnyConstant(); return; } this.jj_la1[15] = this.jj_gen; if (jj_2_7(1)) { if (((getToken(1)).kind == 12 || (getToken(1)).kind == 15) && this.jep.funTab.containsKey((getToken(1)).image)) { Function(); } else { switch ((this.jj_ntk == -1) ? jj_ntk() : this.jj_ntk) { case 12: case 15: Variable(); return; } this.jj_la1[14] = this.jj_gen; jj_consume_token(-1); throw new ParseException(); } } else { switch ((this.jj_ntk == -1) ? jj_ntk() : this.jj_ntk) { case 40: jj_consume_token(40); Expression(); jj_consume_token(41); return; case 38: ListExpression(); return; } this.jj_la1[16] = this.jj_gen; jj_consume_token(-1); throw new ParseException(); } } public final void ListExpression() throws ParseException { ASTFunNode aSTFunNode = new ASTFunNode(2); boolean bool = true; this.jjtree.openNodeScope(aSTFunNode); aSTFunNode.setOperator(this.opSet.getList()); try { jj_consume_token(38); Expression(); while (true) { switch ((this.jj_ntk == -1) ? jj_ntk() : this.jj_ntk) { case 20: break; default: this.jj_la1[17] = this.jj_gen; jj_consume_token(39); return; } jj_consume_token(20); Expression(); } } catch (Throwable throwable) { if (bool) { this.jjtree.clearNodeScope(aSTFunNode); bool = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool) this.jjtree.closeNodeScope(aSTFunNode, true); } } public final void Variable() throws ParseException { String str = ""; ASTVarNode aSTVarNode = new ASTVarNode(3); boolean bool = true; this.jjtree.openNodeScope(aSTVarNode); try { str = Identifier(); this.jjtree.closeNodeScope(aSTVarNode, true); bool = false; if (this.symTab.containsKey(str)) { aSTVarNode.setVar(this.symTab.getVar(str)); } else if (this.jep.allowUndeclared) { aSTVarNode.setVar(this.symTab.makeVarIfNeeded(str)); } else { addToErrorList("Unrecognized symbol \"" + str + "\""); } } catch (Throwable throwable) { if (bool) { this.jjtree.clearNodeScope(aSTVarNode); bool = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool) this.jjtree.closeNodeScope(aSTVarNode, true); } } public final void Function() throws ParseException { int i = 0; String str = ""; ASTFunNode aSTFunNode = new ASTFunNode(2); boolean bool = true; this.jjtree.openNodeScope(aSTFunNode); try { str = Identifier(); if (this.jep.funTab.containsKey(str)) { i = this.jep.funTab.get(str).getNumberOfParameters(); aSTFunNode.setFunction(str, this.jep.funTab.get(str)); } else { addToErrorList("!!! Unrecognized function \"" + str + "\""); } jj_consume_token(40); ArgumentList(i, str); jj_consume_token(41); } catch (Throwable throwable) { if (bool) { this.jjtree.clearNodeScope(aSTFunNode); bool = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool) this.jjtree.closeNodeScope(aSTFunNode, true); } } public final void ArgumentList(int paramInt, String paramString) throws ParseException { byte b = 0; String str = ""; if (jj_2_8(1)) { Expression(); b++; while (true) { switch ((this.jj_ntk == -1) ? jj_ntk() : this.jj_ntk) { case 20: break; default: this.jj_la1[18] = this.jj_gen; break; } jj_consume_token(20); Expression(); b++; } } if (paramInt != b && paramInt != -1) { str = "Function \"" + paramString + "\" requires " + paramInt + " parameter"; if (paramInt != 1) str = str + "s"; addToErrorList(str); } } public final String Identifier() throws ParseException { Token token; switch ((this.jj_ntk == -1) ? jj_ntk() : this.jj_ntk) { case 12: token = jj_consume_token(12); return token.image; case 15: token = jj_consume_token(15); return token.image; } this.jj_la1[19] = this.jj_gen; jj_consume_token(-1); throw new ParseException(); } public final void AnyConstant() throws ParseException { ASTConstant aSTConstant = new ASTConstant(4); boolean bool = true; this.jjtree.openNodeScope(aSTConstant); try { Token token; Object object; String str; switch ((this.jj_ntk == -1) ? jj_ntk() : this.jj_ntk) { case 11: token = jj_consume_token(11); this.jjtree.closeNodeScope(aSTConstant, true); bool = false; str = token.image.substring(1, token.image.length() - 1); str = replaceEscape(str); aSTConstant.setValue(str); break; case 7: case 9: object = RealConstant(); this.jjtree.closeNodeScope(aSTConstant, true); bool = false; aSTConstant.setValue(object); break; default: this.jj_la1[20] = this.jj_gen; jj_consume_token(-1); throw new ParseException(); } } catch (Throwable throwable) { if (bool) { this.jjtree.clearNodeScope(aSTConstant); bool = false; } else { this.jjtree.popNode(); } if (throwable instanceof RuntimeException) throw (RuntimeException)throwable; if (throwable instanceof ParseException) throw (ParseException)throwable; throw (Error)throwable; } finally { if (bool) this.jjtree.closeNodeScope(aSTConstant, true); } } public final Object RealConstant() throws ParseException { Token token; Object object; switch ((this.jj_ntk == -1) ? jj_ntk() : this.jj_ntk) { case 7: token = jj_consume_token(7); break; case 9: token = jj_consume_token(9); break; default: this.jj_la1[21] = this.jj_gen; jj_consume_token(-1); throw new ParseException(); } try { object = this.jep.getNumberFactory().createNumber(token.image); } catch (Exception exception) { object = null; addToErrorList("Can't parse \"" + token.image + "\""); } return object; } private final boolean jj_2_1(int paramInt) { this.jj_la = paramInt; this.jj_lastpos = this.jj_scanpos = this.token; try { return !jj_3_1(); } catch (LookaheadSuccess lookaheadSuccess) { return true; } finally { jj_save(0, paramInt); } } private final boolean jj_2_2(int paramInt) { this.jj_la = paramInt; this.jj_lastpos = this.jj_scanpos = this.token; try { return !jj_3_2(); } catch (LookaheadSuccess lookaheadSuccess) { return true; } finally { jj_save(1, paramInt); } } private final boolean jj_2_3(int paramInt) { this.jj_la = paramInt; this.jj_lastpos = this.jj_scanpos = this.token; try { return !jj_3_3(); } catch (LookaheadSuccess lookaheadSuccess) { return true; } finally { jj_save(2, paramInt); } } private final boolean jj_2_4(int paramInt) { this.jj_la = paramInt; this.jj_lastpos = this.jj_scanpos = this.token; try { return !jj_3_4(); } catch (LookaheadSuccess lookaheadSuccess) { return true; } finally { jj_save(3, paramInt); } } private final boolean jj_2_5(int paramInt) { this.jj_la = paramInt; this.jj_lastpos = this.jj_scanpos = this.token; try { return !jj_3_5(); } catch (LookaheadSuccess lookaheadSuccess) { return true; } finally { jj_save(4, paramInt); } } private final boolean jj_2_6(int paramInt) { this.jj_la = paramInt; this.jj_lastpos = this.jj_scanpos = this.token; try { return !jj_3_6(); } catch (LookaheadSuccess lookaheadSuccess) { return true; } finally { jj_save(5, paramInt); } } private final boolean jj_2_7(int paramInt) { this.jj_la = paramInt; this.jj_lastpos = this.jj_scanpos = this.token; try { return !jj_3_7(); } catch (LookaheadSuccess lookaheadSuccess) { return true; } finally { jj_save(6, paramInt); } } private final boolean jj_2_8(int paramInt) { this.jj_la = paramInt; this.jj_lastpos = this.jj_scanpos = this.token; try { return !jj_3_8(); } catch (LookaheadSuccess lookaheadSuccess) { return true; } finally { jj_save(7, paramInt); } } private final boolean jj_3R_10() { return jj_3R_20() ? true : (jj_scan_token(18) ? true : (jj_3R_9())); } private final boolean jj_3_8() { return jj_3R_9(); } private final boolean jj_3R_32() { return jj_3R_35(); } private final boolean jj_3R_17() { return jj_3R_22(); } private final boolean jj_3_3() { return jj_3R_11(); } private final boolean jj_3R_36() { Token token = this.jj_scanpos; if (jj_scan_token(7)) { this.jj_scanpos = token; if (jj_scan_token(9)) return true; } return false; } private final boolean jj_3R_9() { Token token = this.jj_scanpos; if (jj_3_2()) { this.jj_scanpos = token; if (jj_3_3()) return true; } return false; } private final boolean jj_3_2() { return jj_3R_10(); } private final boolean jj_3_6() { return jj_3R_17(); } private final boolean jj_3R_40() { return jj_scan_token(35); } private final boolean jj_3R_39() { return jj_scan_token(30); } private final boolean jj_3R_23() { return jj_3R_24(); } private final boolean jj_3R_38() { return jj_scan_token(29); } private final boolean jj_3R_37() { Token token = this.jj_scanpos; if (jj_3R_38()) { this.jj_scanpos = token; if (jj_3R_39()) { this.jj_scanpos = token; if (jj_3R_40()) { this.jj_scanpos = token; if (jj_3_6()) return true; } } } return false; } private final boolean jj_3_1() { return jj_3R_9(); } private final boolean jj_3R_29() { return jj_3R_32(); } private final boolean jj_3R_16() { return jj_scan_token(34); } private final boolean jj_3R_15() { return jj_scan_token(33); } private final boolean jj_3R_20() { return jj_3R_24(); } private final boolean jj_3R_14() { return jj_scan_token(37); } private final boolean jj_3R_25() { return jj_3R_29(); } private final boolean jj_3R_34() { return jj_3R_36(); } private final boolean jj_3R_13() { return jj_scan_token(32); } private final boolean jj_3R_31() { return jj_scan_token(38); } private final boolean jj_3R_12() { return jj_scan_token(31); } private final boolean jj_3R_19() { return jj_3R_20(); } private final boolean jj_3R_30() { Token token = this.jj_scanpos; if (jj_3R_33()) { this.jj_scanpos = token; if (jj_3R_34()) return true; } return false; } private final boolean jj_3R_33() { return jj_scan_token(11); } private final boolean jj_3R_28() { return jj_3R_31(); } private final boolean jj_3R_21() { return jj_3R_25(); } private final boolean jj_3R_27() { return jj_scan_token(40); } private final boolean jj_3_4() { Token token = this.jj_scanpos; if (jj_3_5()) { this.jj_scanpos = token; if (jj_3R_12()) { this.jj_scanpos = token; if (jj_3R_13()) { this.jj_scanpos = token; if (jj_3R_14()) { this.jj_scanpos = token; if (jj_3R_15()) { this.jj_scanpos = token; if (jj_3R_16()) return true; } } } } } return false; } private final boolean jj_3_5() { return jj_3R_17(); } private final boolean jj_3R_18() { return jj_3R_23(); } private final boolean jj_3R_24() { Token token = this.jj_scanpos; if (jj_scan_token(12)) { this.jj_scanpos = token; if (jj_scan_token(15)) return true; } return false; } private final boolean jj_3_7() { Token token = this.jj_scanpos; this.lookingAhead = true; this.jj_semLA = (((getToken(1)).kind == 12 || (getToken(1)).kind == 15) && this.jep.funTab.containsKey((getToken(1)).image)); this.lookingAhead = false; if (!this.jj_semLA || jj_3R_18()) { this.jj_scanpos = token; if (jj_3R_19()) return true; } return false; } private final boolean jj_3R_35() { return jj_3R_37(); } private final boolean jj_3R_22() { Token token = this.jj_scanpos; if (jj_3R_26()) { this.jj_scanpos = token; if (jj_3_7()) { this.jj_scanpos = token; if (jj_3R_27()) { this.jj_scanpos = token; if (jj_3R_28()) return true; } } } return false; } private final boolean jj_3R_26() { return jj_3R_30(); } private final boolean jj_3R_11() { return jj_3R_21(); } private static void jj_la1_0() { jj_la1_0 = new int[] { 524289, 524289, 524289, 268435456, 134217728, 75497472, 75497472, 56623104, 56623104, 1610612736, 1610612736, Integer.MIN_VALUE, 1610612736, 0, 36864, 2688, 0, 1048576, 1048576, 36864, 2688, 640 }; } private static void jj_la1_1() { jj_la1_1 = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 8, 16, 0, 0, 320, 0, 0, 0, 0, 0 }; } public Parser(InputStream paramInputStream) { this.jj_input_stream = new JavaCharStream(paramInputStream, 1, 1); this.token_source = new ParserTokenManager(this.jj_input_stream); this.token = new Token(); this.jj_ntk = -1; this.jj_gen = 0; byte b; for (b = 0; b < 22; b++) this.jj_la1[b] = -1; for (b = 0; b < this.jj_2_rtns.length; b++) this.jj_2_rtns[b] = new JJCalls(); } public void ReInit(InputStream paramInputStream) { this.jj_input_stream.ReInit(paramInputStream, 1, 1); this.token_source.ReInit(this.jj_input_stream); this.token = new Token(); this.jj_ntk = -1; this.jjtree.reset(); this.jj_gen = 0; byte b; for (b = 0; b < 22; b++) this.jj_la1[b] = -1; for (b = 0; b < this.jj_2_rtns.length; b++) this.jj_2_rtns[b] = new JJCalls(); } public Parser(Reader paramReader) { this.jj_input_stream = new JavaCharStream(paramReader, 1, 1); this.token_source = new ParserTokenManager(this.jj_input_stream); this.token = new Token(); this.jj_ntk = -1; this.jj_gen = 0; byte b; for (b = 0; b < 22; b++) this.jj_la1[b] = -1; for (b = 0; b < this.jj_2_rtns.length; b++) this.jj_2_rtns[b] = new JJCalls(); } public void ReInit(Reader paramReader) { this.jj_input_stream.ReInit(paramReader, 1, 1); this.token_source.ReInit(this.jj_input_stream); this.token = new Token(); this.jj_ntk = -1; this.jjtree.reset(); this.jj_gen = 0; byte b; for (b = 0; b < 22; b++) this.jj_la1[b] = -1; for (b = 0; b < this.jj_2_rtns.length; b++) this.jj_2_rtns[b] = new JJCalls(); } public Parser(ParserTokenManager paramParserTokenManager) { this.token_source = paramParserTokenManager; this.token = new Token(); this.jj_ntk = -1; this.jj_gen = 0; byte b; for (b = 0; b < 22; b++) this.jj_la1[b] = -1; for (b = 0; b < this.jj_2_rtns.length; b++) this.jj_2_rtns[b] = new JJCalls(); } public void ReInit(ParserTokenManager paramParserTokenManager) { this.token_source = paramParserTokenManager; this.token = new Token(); this.jj_ntk = -1; this.jjtree.reset(); this.jj_gen = 0; byte b; for (b = 0; b < 22; b++) this.jj_la1[b] = -1; for (b = 0; b < this.jj_2_rtns.length; b++) this.jj_2_rtns[b] = new JJCalls(); } private final Token jj_consume_token(int paramInt) throws ParseException { Token token; if ((token = this.token).next != null) { this.token = this.token.next; } else { this.token = this.token.next = this.token_source.getNextToken(); } this.jj_ntk = -1; if (this.token.kind == paramInt) { this.jj_gen++; if (++this.jj_gc > 100) { this.jj_gc = 0; for (byte b = 0; b < this.jj_2_rtns.length; b++) { for (JJCalls jJCalls = this.jj_2_rtns[b]; jJCalls != null; jJCalls = jJCalls.next) { if (jJCalls.gen < this.jj_gen) jJCalls.first = null; } } } return this.token; } this.token = token; this.jj_kind = paramInt; throw generateParseException(); } private final boolean jj_scan_token(int paramInt) { if (this.jj_scanpos == this.jj_lastpos) { this.jj_la--; if (this.jj_scanpos.next == null) { this.jj_lastpos = this.jj_scanpos = this.jj_scanpos.next = this.token_source.getNextToken(); } else { this.jj_lastpos = this.jj_scanpos = this.jj_scanpos.next; } } else { this.jj_scanpos = this.jj_scanpos.next; } if (this.jj_rescan) { byte b = 0; Token token; for (token = this.token; token != null && token != this.jj_scanpos; token = token.next) b++; if (token != null) jj_add_error_token(paramInt, b); } if (this.jj_scanpos.kind != paramInt) return true; if (this.jj_la == 0 && this.jj_scanpos == this.jj_lastpos) throw this.jj_ls; return false; } public final Token getNextToken() { if (this.token.next != null) { this.token = this.token.next; } else { this.token = this.token.next = this.token_source.getNextToken(); } this.jj_ntk = -1; this.jj_gen++; return this.token; } public final Token getToken(int paramInt) { Token token = this.lookingAhead ? this.jj_scanpos : this.token; for (byte b = 0; b < paramInt; b++) { if (token.next != null) { token = token.next; } else { token = token.next = this.token_source.getNextToken(); } } return token; } private final int jj_ntk() { return ((this.jj_nt = this.token.next) == null) ? (this.jj_ntk = (this.token.next = this.token_source.getNextToken()).kind) : (this.jj_ntk = this.jj_nt.kind); } private void jj_add_error_token(int paramInt1, int paramInt2) { if (paramInt2 >= 100) return; if (paramInt2 == this.jj_endpos + 1) { this.jj_lasttokens[this.jj_endpos++] = paramInt1; } else if (this.jj_endpos != 0) { this.jj_expentry = new int[this.jj_endpos]; byte b; for (b = 0; b < this.jj_endpos; b++) this.jj_expentry[b] = this.jj_lasttokens[b]; b = 0; Enumeration enumeration = this.jj_expentries.elements(); while (enumeration.hasMoreElements()) { int[] arrayOfInt = enumeration.nextElement(); if (arrayOfInt.length == this.jj_expentry.length) { b = 1; for (byte b1 = 0; b1 < this.jj_expentry.length; b1++) { if (arrayOfInt[b1] != this.jj_expentry[b1]) { b = 0; break; } } if (b != 0) break; } } if (b == 0) this.jj_expentries.addElement(this.jj_expentry); if (paramInt2 != 0) this.jj_lasttokens[(this.jj_endpos = paramInt2) - 1] = paramInt1; } } public ParseException generateParseException() { this.jj_expentries.removeAllElements(); boolean[] arrayOfBoolean = new boolean[42]; byte b1; for (b1 = 0; b1 < 42; b1++) arrayOfBoolean[b1] = false; if (this.jj_kind >= 0) { arrayOfBoolean[this.jj_kind] = true; this.jj_kind = -1; } for (b1 = 0; b1 < 22; b1++) { if (this.jj_la1[b1] == this.jj_gen) for (byte b = 0; b < 32; b++) { if ((jj_la1_0[b1] & 1 << b) != 0) arrayOfBoolean[b] = true; if ((jj_la1_1[b1] & 1 << b) != 0) arrayOfBoolean[32 + b] = true; } } for (b1 = 0; b1 < 42; b1++) { if (arrayOfBoolean[b1]) { this.jj_expentry = new int[1]; this.jj_expentry[0] = b1; this.jj_expentries.addElement(this.jj_expentry); } } this.jj_endpos = 0; jj_rescan_token(); jj_add_error_token(0, 0); int[][] arrayOfInt = new int[this.jj_expentries.size()][]; for (byte b2 = 0; b2 < this.jj_expentries.size(); b2++) arrayOfInt[b2] = this.jj_expentries.elementAt(b2); return new ParseException(this.token, arrayOfInt, ParserConstants.tokenImage); } public final void enable_tracing() {} public final void disable_tracing() {} private final void jj_rescan_token() { this.jj_rescan = true; byte b = 0; while (b < 8) { JJCalls jJCalls = this.jj_2_rtns[b]; while (true) { if (jJCalls.gen > this.jj_gen) { this.jj_la = jJCalls.arg; this.jj_lastpos = this.jj_scanpos = jJCalls.first; switch (b) { 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; } } jJCalls = jJCalls.next; if (jJCalls == null) b++; } } this.jj_rescan = false; } private final void jj_save(int paramInt1, int paramInt2) { JJCalls jJCalls; for (jJCalls = this.jj_2_rtns[paramInt1]; jJCalls.gen > this.jj_gen; jJCalls = jJCalls.next) { if (jJCalls.next == null) { jJCalls = jJCalls.next = new JJCalls(); break; } } jJCalls.gen = this.jj_gen + paramInt2 - this.jj_la; jJCalls.first = this.token; jJCalls.arg = paramInt2; } static { jj_la1_0(); jj_la1_1(); } static final class JJCalls { int gen; Token first; int arg; JJCalls next; } private static final class LookaheadSuccess extends Error { private LookaheadSuccess() {} } }