PageRenderTime 84ms CodeModel.GetById 40ms app.highlight 7ms RepoModel.GetById 33ms app.codeStats 1ms

/Microsoft.Scripting/Runtime/Operators.cs

https://bitbucket.org/stefanrusek/xronos
C# | 375 lines | 106 code | 11 blank | 258 comment | 0 complexity | 9bab7eb9c2c530f5866be5d6034be281 MD5 | raw file
  1/* ****************************************************************************
  2 *
  3 * Copyright (c) Microsoft Corporation. 
  4 *
  5 * This source code is subject to terms and conditions of the Microsoft Public License. A 
  6 * copy of the license can be found in the License.html file at the root of this distribution. If 
  7 * you cannot locate the  Microsoft Public License, please send an email to 
  8 * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 
  9 * by the terms of the Microsoft Public License.
 10 *
 11 * You must not remove this notice, or any other, from this software.
 12 *
 13 *
 14 * ***************************************************************************/
 15
 16#if CODEPLEX_40
 17using System;
 18#else
 19using System; using Microsoft;
 20#endif
 21
 22namespace Microsoft.Scripting.Runtime {
 23    /// <summary>
 24    /// Enum representing different types of operators.
 25    /// 
 26    /// Operators can be Unary, Binary, or Ternary.  An individual operator can have one or 
 27    /// more arity.  
 28    /// 
 29    /// Each operator is associated with a standard name.  If a method is named using the standard
 30    /// name and is marked with OperatorMethodAttribute then the method will automatically be
 31    /// detected as an operator.
 32    /// </summary>
 33    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1717:OnlyFlagsEnumsShouldHavePluralNames")] // TODO: fix
 34    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2217:DoNotMarkEnumsWithFlags")]
 35    public enum Operators {
 36        None,
 37        /// <summary>
 38        /// Binary operator.
 39        /// 
 40        /// Attempt to call the object.  Arguments are the object and the arguments for the call.  The
 41        /// arguments for the call can either be an object array (normal call) or a KwCallInfo class for
 42        /// performing a keyword based call.
 43        /// 
 44        /// The standard name for this operator is "Call".
 45        /// </summary>
 46        Call,                       
 47        /// <summary>
 48        /// Unary operator.
 49        /// 
 50        /// Returns a string which defines the object in code or a language specific format for
 51        /// objects which cannot be represented in code.  This operator generally is not used in
 52        /// a non-language specific scenario.
 53        /// </summary>
 54        CodeRepresentation,         
 55        /// <summary>
 56        /// Unary operator.
 57        /// 
 58        /// Gets the list of members that belong to the current object returned as an IList of string
 59        /// </summary>
 60        MemberNames,
 61        /// <summary>
 62        /// Unary operator.
 63        /// 
 64        /// Gets various documentation about the object returned as a string
 65        /// </summary>
 66        Documentation,
 67        /// <summary>
 68        /// Unary operator.
 69        /// 
 70        /// Gets information about the type of parameters, returned as a string.
 71        /// </summary>
 72        CallSignatures,
 73        /// <summary>
 74        /// Unary operator.
 75        /// 
 76        /// Checks whether the object is callable or not, returns true if it is.
 77        /// </summary>
 78        IsCallable,
 79
 80        #region Generated Table of Operators
 81
 82        // *** BEGIN GENERATED CODE ***
 83        // generated by function: gen_OperatorTable from: generate_ops.py
 84
 85        ///<summary>Operator for performing add</summary>
 86        Add,
 87        ///<summary>Operator for performing sub</summary>
 88        Subtract,
 89        ///<summary>Operator for performing pow</summary>
 90        Power,
 91        ///<summary>Operator for performing mul</summary>
 92        Multiply,
 93        ///<summary>Operator for performing floordiv</summary>
 94        FloorDivide,
 95        ///<summary>Operator for performing div</summary>
 96        Divide,
 97        ///<summary>Operator for performing truediv</summary>
 98        TrueDivide,
 99        ///<summary>Operator for performing mod</summary>
100        Mod,
101        ///<summary>Operator for performing lshift</summary>
102        LeftShift,
103        ///<summary>Operator for performing rshift</summary>
104        RightShift,
105        ///<summary>Operator for performing and</summary>
106        BitwiseAnd,
107        ///<summary>Operator for performing or</summary>
108        BitwiseOr,
109        ///<summary>Operator for performing xor</summary>
110        ExclusiveOr,
111        ///<summary>Operator for performing lt</summary>
112        LessThan,
113        ///<summary>Operator for performing gt</summary>
114        GreaterThan,
115        ///<summary>Operator for performing le</summary>
116        LessThanOrEqual,
117        ///<summary>Operator for performing ge</summary>
118        GreaterThanOrEqual,
119        ///<summary>Operator for performing eq</summary>
120        Equals,
121        ///<summary>Operator for performing ne</summary>
122        NotEquals,
123        ///<summary>Operator for performing lg</summary>
124        LessThanGreaterThan,
125        ///<summary>Operator for performing in-place add</summary>
126        InPlaceAdd,
127        ///<summary>Operator for performing in-place sub</summary>
128        InPlaceSubtract,
129        ///<summary>Operator for performing in-place pow</summary>
130        InPlacePower,
131        ///<summary>Operator for performing in-place mul</summary>
132        InPlaceMultiply,
133        ///<summary>Operator for performing in-place floordiv</summary>
134        InPlaceFloorDivide,
135        ///<summary>Operator for performing in-place div</summary>
136        InPlaceDivide,
137        ///<summary>Operator for performing in-place truediv</summary>
138        InPlaceTrueDivide,
139        ///<summary>Operator for performing in-place mod</summary>
140        InPlaceMod,
141        ///<summary>Operator for performing in-place lshift</summary>
142        InPlaceLeftShift,
143        ///<summary>Operator for performing in-place rshift</summary>
144        InPlaceRightShift,
145        ///<summary>Operator for performing in-place and</summary>
146        InPlaceBitwiseAnd,
147        ///<summary>Operator for performing in-place or</summary>
148        InPlaceBitwiseOr,
149        ///<summary>Operator for performing in-place xor</summary>
150        InPlaceExclusiveOr,
151        ///<summary>Operator for performing reverse add</summary>
152        ReverseAdd,
153        ///<summary>Operator for performing reverse sub</summary>
154        ReverseSubtract,
155        ///<summary>Operator for performing reverse pow</summary>
156        ReversePower,
157        ///<summary>Operator for performing reverse mul</summary>
158        ReverseMultiply,
159        ///<summary>Operator for performing reverse floordiv</summary>
160        ReverseFloorDivide,
161        ///<summary>Operator for performing reverse div</summary>
162        ReverseDivide,
163        ///<summary>Operator for performing reverse truediv</summary>
164        ReverseTrueDivide,
165        ///<summary>Operator for performing reverse mod</summary>
166        ReverseMod,
167        ///<summary>Operator for performing reverse lshift</summary>
168        ReverseLeftShift,
169        ///<summary>Operator for performing reverse rshift</summary>
170        ReverseRightShift,
171        ///<summary>Operator for performing reverse and</summary>
172        ReverseBitwiseAnd,
173        ///<summary>Operator for performing reverse or</summary>
174        ReverseBitwiseOr,
175        ///<summary>Operator for performing reverse xor</summary>
176        ReverseExclusiveOr,
177
178        // *** END GENERATED CODE ***
179
180        #endregion
181
182        /// <summary>
183        /// Binary operator.
184        /// 
185        /// Checks to see if the instance contains another object.  Returns true or false.
186        /// 
187        /// The standard name for this operator is "Contains".
188        /// </summary>
189        Contains,                   
190        /// <summary>
191        /// n-ary operator.
192        /// 
193        /// Gets the value at the specified index from the instance.
194        /// 
195        /// One or more indexes can be provided as individual arguments.
196        /// Obsolete: Use GetIndexAction instead
197        /// </summary>
198        GetItem,                    
199        /// <summary>
200        /// n-ary operator.
201        /// 
202        /// Sets the value at the specified index in the instance.
203        /// 
204        /// One or more indexes can be provided as individual arguments.  The last value provided is the value to be set.
205        /// Obsolete: Use SetIndexAction instead
206        /// </summary>
207        SetItem,                    
208        /// <summary>
209        /// n-ary operator.
210        /// 
211        /// Removes the item from the specified index in the instance.
212        /// 
213        /// One or more indexes can be provided as individual arguments.
214        /// Obsolete: Use DeleteIndexAction instead
215        /// </summary>
216        DeleteItem,
217        /// <summary>
218        /// Binary or Ternary operator.
219        /// 
220        /// Gets the specified range of elements (slice) from the instance.
221        /// 
222        /// The slice parameters may include the start index, the end index, and the step value.  The step value is optional.
223        /// 
224        /// A value of Type.Missing may be provided if no parameter was explicitly provided for a start, stop or step parameter.
225        /// </summary>
226        GetSlice,
227        /// <summary>
228        /// n-ary operator.
229        /// 
230        /// Sets the specified range of elements in the instance.
231        /// 
232        /// The slice parameters may include the start index, the end index, and the step value.  The step
233        /// value is optional.  The last parameter is the value to be assigned.
234        /// 
235        /// A value of Type.Missing may be provided if no parameter was explicitly provided for a start, stop or step parameter.
236        /// </summary>
237        SetSlice,
238        /// <summary>
239        /// n-ary operator.
240        /// 
241        /// Removes the specified range of elements from the instance.
242        /// 
243        /// The slice parameters may include the start index, the end index, and the step value.  The step value is
244        /// optional.
245        /// 
246        /// A value of Type.Missing may be provided if no parameter was explicitly provided for a start, stop or step parameter.
247        /// </summary>
248        DeleteSlice,
249        /// <summary>
250        /// Unary operator.
251        /// 
252        /// Returns the number of items stored in the object.
253        /// </summary>      
254        Length,                     
255        /// <summary>
256        /// Binary operator.
257        /// 
258        /// Compares two instances returning an integer indicating the relationship between them.  May
259        /// throw if the object types are uncomparable.
260        /// 
261        /// The standard name for this operator is "Compare".
262        /// </summary>
263        Compare,      
264        /// <summary>
265        /// Binary operator.
266        /// 
267        /// Returns both the dividend and quotioent of x / y.
268        /// </summary>
269        DivMod,                     
270        /// <summary>
271        /// Binary operator.
272        /// 
273        /// Returns both the dividend and quotient of y / x.
274        /// </summary>
275        ReverseDivMod,              
276        /// <summary>
277        /// Member lookup customization (called after type lookup).
278        /// 
279        /// Arguments are the instance to get the member from and a SymbolId which represents the member.
280        /// 
281        /// The return value is the member.
282        /// 
283        /// The standard name for this operator is "GetMember".
284        /// </summary>
285        GetMember,                  
286        /// <summary>
287        /// Member lookup customization for bound attributes
288        /// 
289        /// Arguments are the instance to get the member from and a SymbolId which represents the bound member.
290        /// 
291        /// The return value is the bound member.
292        /// 
293        /// /// The standard name for this operator is "GetBoundMember".
294        /// </summary>
295        GetBoundMember,            
296        /// <summary>
297        /// Member set customization.
298        /// 
299        /// Arguments are the instance, the SymbolId to get, and the new value for the member.
300        /// 
301        /// The return value is ignored.
302        /// 
303        /// The standard name for this operator is "SetMember".
304        /// </summary>
305        SetMember,   
306        /// <summary>
307        /// Member delete customization.
308        /// 
309        /// Arguments are the instance and the SymbolId for the member to delete.
310        /// 
311        /// The return value is ignored.
312        /// 
313        /// The standard name for this operator is "DeleteMember".
314        /// </summary>
315        DeleteMember,      
316        /// <summary>
317        /// Attribute customization operator.  Returns a list of names that should be displayed as
318        /// being part of the object.
319        /// 
320        /// Arguments are the instance to get the list of member names from.
321        /// 
322        /// Return value is IList&lt;SymbolId&gt;.
323        /// 
324        /// /// The standard name for this operator is "GetMemberNames".
325        /// </summary>
326        GetMemberNames,             
327        /// <summary>
328        /// Unary operator.
329        /// 
330        /// Get the absolute value of the instance.
331        /// </summary>
332        AbsoluteValue,
333        /// <summary>
334        /// Unary operator.
335        /// 
336        /// Gets the positive value of the instance.
337        /// </summary>
338        Positive,                   
339        /// <summary>
340        /// Unary operator.
341        /// 
342        /// Negates the instance and return the new value.
343        /// </summary>        
344        Negate,                     
345        /// <summary>
346        /// Unary operator.
347        /// 
348        /// Returns the ones complement of the instance.
349        /// </summary>
350        OnesComplement,             
351
352        RightShiftUnsigned,         //Operator for performing rshiftu
353        InPlaceRightShiftUnsigned,  //Operator for performing in-place rshiftu
354        ReverseRightShiftUnsigned,  //Operator for performing reverse rshiftu
355        RightShiftSigned,  
356        Not,                        // boolean negation
357        Increment,
358        Decrement,
359        Assign,
360        IsFalse,
361        IsTrue,
362        Or,
363        And,
364        IntegralDivide,
365        Concatenate,
366        Like,
367        Comma,
368
369        GetEnumerator,
370        Dispose,
371
372        IdMask = 0x7fffffff,
373        UserDefinedFlag = unchecked((int)0x80000000),
374    }
375}