private Node VisitUnaryOperands(MetaCodeParser.ExpressionContext expression, IToken @operator) { if (new object[] { expression, @operator }.Any(value => value == null)) return null; var expr = expression.Accept(this) as ExpressionNode; var op = @operator.Text; return ExpressionFactory.UnaryOperand(expr, op); }
private Node VisitBinaryOperands(MetaCodeParser.ExpressionContext left, MetaCodeParser.ExpressionContext right, IToken @operator) { if (new object[] { left, right, @operator }.Any(obj => obj == null)) return null; var leftExpression = left.Accept(this) as ExpressionNode; var rightExpression = right.Accept(this) as ExpressionNode; var operatorText = @operator.Text; return ExpressionFactory.BinaryOperand(leftExpression, rightExpression, operatorText); }