/NRefactory/ICSharpCode.NRefactory.VB/Ast/Expressions/BinaryOperatorExpression.cs

http://github.com/icsharpcode/ILSpy · C# · 110 lines · 64 code · 15 blank · 31 comment · 0 complexity · 443a48d1c754c6c5a26484c414bde829 MD5 · raw file

  1. // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
  2. // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
  3. using System;
  4. using System.Collections.Generic;
  5. namespace ICSharpCode.NRefactory.VB.Ast
  6. {
  7. public class BinaryOperatorExpression : Expression
  8. {
  9. public readonly static Role<Expression> LeftExpressionRole = new Role<Expression>("Left");
  10. public readonly static Role<VBTokenNode> OperatorRole = new Role<VBTokenNode>("Operator");
  11. public readonly static Role<Expression> RightExpressionRole = new Role<Expression>("Right");
  12. public BinaryOperatorExpression(Expression left, BinaryOperatorType type, Expression right)
  13. {
  14. AddChild(left, LeftExpressionRole);
  15. AddChild(right, RightExpressionRole);
  16. Operator = type;
  17. }
  18. public Expression Left {
  19. get { return GetChildByRole(LeftExpressionRole); }
  20. set { SetChildByRole(LeftExpressionRole, value); }
  21. }
  22. public BinaryOperatorType Operator { get; set; }
  23. public Expression Right {
  24. get { return GetChildByRole(RightExpressionRole); }
  25. set { SetChildByRole(RightExpressionRole, value); }
  26. }
  27. protected internal override bool DoMatch(AstNode other, ICSharpCode.NRefactory.PatternMatching.Match match)
  28. {
  29. throw new NotImplementedException();
  30. }
  31. public override S AcceptVisitor<T, S>(IAstVisitor<T, S> visitor, T data)
  32. {
  33. return visitor.VisitBinaryOperatorExpression(this, data);
  34. }
  35. }
  36. public enum BinaryOperatorType
  37. {
  38. None,
  39. /// <summary>'&amp;' in C#, 'And' in VB.</summary>
  40. BitwiseAnd,
  41. /// <summary>'|' in C#, 'Or' in VB.</summary>
  42. BitwiseOr,
  43. /// <summary>'&amp;&amp;' in C#, 'AndAlso' in VB.</summary>
  44. LogicalAnd,
  45. /// <summary>'||' in C#, 'OrElse' in VB.</summary>
  46. LogicalOr,
  47. /// <summary>'^' in C#, 'Xor' in VB.</summary>
  48. ExclusiveOr,
  49. /// <summary>&gt;</summary>
  50. GreaterThan,
  51. /// <summary>&gt;=</summary>
  52. GreaterThanOrEqual,
  53. /// <summary>'==' in C#, '=' in VB.</summary>
  54. Equality,
  55. /// <summary>'!=' in C#, '&lt;&gt;' in VB.</summary>
  56. InEquality,
  57. /// <summary>&lt;</summary>
  58. LessThan,
  59. /// <summary>&lt;=</summary>
  60. LessThanOrEqual,
  61. /// <summary>+</summary>
  62. Add,
  63. /// <summary>-</summary>
  64. Subtract,
  65. /// <summary>*</summary>
  66. Multiply,
  67. /// <summary>/</summary>
  68. Divide,
  69. /// <summary>'%' in C#, 'Mod' in VB.</summary>
  70. Modulus,
  71. /// <summary>VB-only: \</summary>
  72. DivideInteger,
  73. /// <summary>VB-only: ^</summary>
  74. Power,
  75. /// <summary>VB-only: &amp;</summary>
  76. Concat,
  77. /// <summary>C#: &lt;&lt;</summary>
  78. ShiftLeft,
  79. /// <summary>C#: &gt;&gt;</summary>
  80. ShiftRight,
  81. /// <summary>VB-only: Is</summary>
  82. ReferenceEquality,
  83. /// <summary>VB-only: IsNot</summary>
  84. ReferenceInequality,
  85. /// <summary>VB-only: Like</summary>
  86. Like,
  87. /// <summary>
  88. /// C#: ??
  89. /// VB: IF(x, y)
  90. /// </summary>
  91. NullCoalescing,
  92. /// <summary>VB-only: !</summary>
  93. DictionaryAccess
  94. }
  95. }