PageRenderTime 47ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

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