public static TokenType ExecuteUnaryOperation(Operator op, TokenType param) { Type pType = param.GetType(); UnaryOperatorDef def = new UnaryOperatorDef(op, pType); if (unary_operators.ContainsKey(def)) { return(unary_operators[def].func(param)); } throw new ExprCoreException("인식할 수 없는 연산자입니다. " + op + "(" + pType.Name + ")"); }
public static TokenType ExecuteOperation(OperatorDef op, TokenType param1, TokenType param2) { if (op is UnaryOperatorDef) { UnaryOperatorDef def = op as UnaryOperatorDef; if (unary_operators.ContainsKey(def)) { return(unary_operators[def](param1)); } } else if (op is BinaryOperatorDef) { BinaryOperatorDef def = op as BinaryOperatorDef; if (binary_operators.ContainsKey(def)) { return(binary_operators[def](param1, param2)); } } throw new ProcessingException("인식할 수 없는 연산자입니다. [" + op + "]"); }