The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
LogicalExpression.cs
Go to the documentation of this file.
1 // -------------------------------------------------------------------------- //
3 // Project rROTOR //
4 // -------------------------------------------------------------------------- //
5 // File: LogicalExpression.cs //
6 // Authors: Cristina Gonzalez Muņoz - cristi.gm@gmail.com //
7 // Francisco Ortin - francisco.ortin@gmail.com //
8 // Description: //
9 // Encapsulates a logical binary expression. //
10 // Inheritance: BinaryExpression. //
11 // Implements Composite pattern [Composite]. //
12 // Implements Visitor pattern [Concrete Element]. //
13 // -------------------------------------------------------------------------- //
14 // Create date: 05-12-2006 //
15 // Modification date: 06-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 LogicalOperator
28 
32  public enum LogicalOperator
33  {
37  Or,
38 
42  And,
43  }
44 
45  #endregion
46 
56  {
57  #region Fields
58 
62  private LogicalOperator op;
63 
64  #endregion
65 
66  #region Properties
67 
72  {
73  get { return op; }
74  }
75 
76  #endregion
77 
78  #region Constructor
79 
90  : base(operand1, operand2, location)
91  {
92  this.op = op;
93  }
94 
95  #endregion
96 
97  #region Accept()
98 
105  public override Object Accept(Visitor v, Object o)
106  {
107  return v.Visit(this, o);
108  }
109 
110  #endregion
111 
112  public override string ToString() {
113  return this.op.ToString();
114  }
115  }
116 }
Encapsulates a binary expression of our programming language.
Abstract class encapsulate a programming language expression.
Definition: Expression.cs:37
a && b
Encapsulates a logical binary expression.
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
a || b
LogicalExpression(Expression operand1, Expression operand2, LogicalOperator op, Location location)
Constructor of LogicalExpression
LogicalOperator
Logical binary operators
Location location
Location: Encapsulates in one object the line, column and filename
Definition: AstNode.cs:39
LogicalOperator Operator
Gets the operator of the binary expression
override string ToString()
override Object Accept(Visitor v, Object o)
Accept method of a concrete visitor.