The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
BitwiseExpression.cs
Go to the documentation of this file.
1 // -------------------------------------------------------------------------- //
3 // Project rROTOR //
4 // -------------------------------------------------------------------------- //
5 // File: BitwiseExpression.cs //
6 // Authors: Cristina Gonzalez Muņoz - cristi.gm@gmail.com //
7 // Francisco Ortin - francisco.ortin@gmail.com //
8 // Description: //
9 // Encapsulates a bitwise binary expression. //
10 // Inheritance: BinaryExpression. //
11 // Implements Composite pattern [Composite]. //
12 // Implements Visitor pattern [Concrete Element]. //
13 // -------------------------------------------------------------------------- //
14 // Create date: 25-04-2007 //
15 // Modification date: 25-04-2007 //
17 
18 using System;
19 using System.Collections.Generic;
20 using System.Text;
21 
22 using Tools;
23 using ErrorManagement;
24 
25 namespace AST
26 {
27  #region BitwiseOperator
28 
32  public enum BitwiseOperator
33  {
37  BitwiseOr = 1,
38 
42  BitwiseAnd = 2,
43 
47  BitwiseXOr = 3,
48 
52  ShiftLeft = 4,
53 
57  ShiftRight = 5,
58  }
59 
60  #endregion
61 
71  {
72  #region Fields
73 
77  private BitwiseOperator op;
78 
79  #endregion
80 
81  #region Properties
82 
87  {
88  get { return op; }
89  }
90 
91  #endregion
92 
93  #region Constructor
94 
105  : base(operand1, operand2, location)
106  {
107  this.op = op;
108  }
109 
110  #endregion
111 
112  #region Accept()
113 
120  public override Object Accept(Visitor v, Object o)
121  {
122  return v.Visit(this, o);
123  }
124 
125  #endregion
126 
127  #region ToString()
128 
129  public override string ToString()
130  {
131  return this.op.ToString();
132  }
133 
134  #endregion
135  }
136 }
Encapsulates a binary expression of our programming language.
Abstract class encapsulate a programming language expression.
Definition: Expression.cs:37
override string ToString()
Abstract class to define different visits over the abstract syntax tree.
Definition: Visitor.cs:29
This class encapsulates a location in a specific file. Implements an Inmutable pattern. So it can be used in any context, that is his internal fields never change.
Definition: Location.cs:24
override Object Accept(Visitor v, Object o)
Accept method of a concrete visitor.
BitwiseExpression(Expression operand1, Expression operand2, BitwiseOperator op, Location location)
Constructor of BitwiseExpression
Encapsulates a bitwise binary expression.
a << b
a & b
Location location
Location: Encapsulates in one object the line, column and filename
Definition: AstNode.cs:39
BitwiseOperator Operator
Gets the operator of the binary expression
BitwiseOperator
Bitwise binary operators
a >> b