public static Exp getInstance(Exp left, Exp right, char c) { Exp_Operator ope = Exp_Operator.PLUS; switch (c) { case '+': ope = Exp_Operator.PLUS; break; case '-': ope = Exp_Operator.MINU; break; case '*': ope = Exp_Operator.MULT; break; case '/': ope = Exp_Operator.DIVI; break; case '<': ope = Exp_Operator.LESS_THAN; break; case '>': ope = Exp_Operator.GREATER_THAN; break; default: LogWriter.WriteErrText("Unknown Two operator:" + c); break; } return(getInstance(left, right, ope)); }
public static Exp getInstance(Exp expression, Exp_Operator ope) { Exp_One ret = new Exp_One(); ret.expression = expression; ret.ope = ope; return(simplify(ret)); }
public static Exp getInstance(Exp left, Exp right, char c1, char c2) { Exp_Operator ope = Exp_Operator.NONE; switch (c1) { case '<': if (c2 == '=') { ope = Exp_Operator.LESS_EQUAL_THAN; } else { ope = Exp_Operator.LESS_THAN; } break; case '>': if (c2 == '=') { ope = Exp_Operator.GREATER_EQUAL_THAN; } else { ope = Exp_Operator.GREATER_THAN; } break; case '=': if (c2 == '=') { ope = Exp_Operator.IF_EQUAL; } else { LogWriter.WriteLogText("Lex Error: expect if equal"); } break; case '!': if (c2 == '=') { ope = Exp_Operator.NOT_EQUAL; } else { LogWriter.WriteLogText("Lex Error: expect if not equal"); } break; } return(getInstance(left, right, ope)); }
public static Exp getInstance(Exp left, Exp right, Exp_Operator ope) { Exp_Two ret = new Exp_Two(); if (ope != Exp_Operator.EQUAL && ope != Exp_Operator.MINU && ope != Exp_Operator.DIVI) { ret.left = simplify(left); ret.right = simplify(right); } else { ret.left = left; ret.right = right; } ret.ope = ope; return(simplify(ret)); }