The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
DoStatement.cs
Go to the documentation of this file.
1 // -------------------------------------------------------------------------- //
3 // Project rROTOR //
4 // -------------------------------------------------------------------------- //
5 // File: DoStatement.cs //
6 // Author: Cristina Gonzalez Muņoz - cristi.gm@gmail.com //
7 // Description: //
8 // Encapsulates a Do statement of our programming language. //
9 // Inheritance: Statement. //
10 // Implements Composite pattern [Composite]. //
11 // Implements Visitor pattern [Concrete Element]. //
12 // -------------------------------------------------------------------------- //
13 // Create date: 05-12-2006 //
14 // Modification date: 25-04-2007 //
16 
17 using System;
18 using System.Collections.Generic;
19 using System.Text;
20 
21 using Tools;
22 using ErrorManagement;
23 
24 namespace AST
25 {
34  public class DoStatement : Statement
35  {
36  #region Fields
37 
41  private Expression condition;
42 
46  private Statement doStatement;
47 
51  private List<MoveStatement> initDo;
52 
56  private List<ThetaStatement> beforeBody;
57 
58  #endregion
59 
60  #region Properties
61 
65  public Expression Condition
66  {
67  get { return condition; }
68  set { condition = value; }
69  }
70 
74  public Statement Statements
75  {
76  get { return doStatement; }
77  }
78 
82  public List<MoveStatement> InitDo
83  {
84  get { return this.initDo; }
85  set { this.initDo = value; }
86  }
87 
91  public List<ThetaStatement> BeforeBody
92  {
93  get { return this.beforeBody; }
94  set { this.beforeBody = value; }
95  }
96 
97  #endregion
98 
99  #region Constructor
100 
109  public DoStatement(Statement statements, Expression cond, Location location) : base(location) {
110  this.condition = cond;
111  this.doStatement = statements;
112  this.beforeBody = new List<ThetaStatement>();
113  this.initDo = new List<MoveStatement>();
114  }
115 
116  #endregion
117 
118  #region Accept()
119 
126  public override Object Accept(Visitor v, Object o)
127  {
128  return v.Visit(this, o);
129  }
130 
131  #endregion
132  }
133 }
Statement Statements
Gets the block executed when the condition is true.
Definition: DoStatement.cs:75
Abstract class encapsulate a programming language expression.
Definition: Expression.cs:37
List< ThetaStatement > BeforeBody
Gets or sets the statements before do body.
Definition: DoStatement.cs:92
Encapsulates a Do statement of our programming language.
Definition: DoStatement.cs:34
List< MoveStatement > InitDo
Gets or sets the statements to use at the init of the do loop.
Definition: DoStatement.cs:83
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
Abstract class represents a programming language statement.
Definition: Statement.cs:30
DoStatement(Statement statements, Expression cond, Location location)
Constructor of DoStatement
Definition: DoStatement.cs:109
Expression Condition
Gets the condition expression of Do Statement.
Definition: DoStatement.cs:66
Location location
Location: Encapsulates in one object the line, column and filename
Definition: AstNode.cs:39
override Object Accept(Visitor v, Object o)
Accept method of a concrete visitor.
Definition: DoStatement.cs:126