The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
DoubleLiteralExpression.cs
Go to the documentation of this file.
1 // -------------------------------------------------------------------------- //
3 // Project rROTOR //
4 // -------------------------------------------------------------------------- //
5 // File: DoubleLiteralExpression.cs //
6 // Author: Cristina Gonzalez Muņoz - cristi.gm@gmail.com //
7 // Description: //
8 // Encapsulates a double literal expression. //
9 // Inheritance: Expression. //
10 // Implements Composite pattern [Leaf]. //
11 // Implements Visitor pattern [Concrete Element]. //
12 // -------------------------------------------------------------------------- //
13 // Create date: 05-12-2006 //
14 // Modification date: 11-06-2006 //
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 {
35  {
36  #region Fields
37 
41  private double doubleValue;
42 
43  #endregion
44 
45  #region Properties
46 
50  public double DoubleValue
51  {
52  get { return doubleValue; }
53  }
54 
58  public string ILValue
59  {
60  get
61  {
62  System.Globalization.NumberFormatInfo nfi = new System.Globalization.NumberFormatInfo();
63  nfi.NumberDecimalSeparator = ".";
64  return Convert.ToString(this.doubleValue, nfi);
65  }
66  }
67 
68  #endregion
69 
70  #region Constructor
71 
79  public DoubleLiteralExpression(double doubleLiteral, Location location)
80  : base(location)
81  {
82  this.doubleValue = doubleLiteral;
83  }
84 
85  #endregion
86 
87  #region Accept()
88 
95  public override Object Accept(Visitor v, Object o)
96  {
97  return v.Visit(this, o);
98  }
99 
100  #endregion
101  }
102 }
Abstract class encapsulate a programming language expression.
Definition: Expression.cs:37
override Object Accept(Visitor v, Object o)
Accept method of a concrete visitor.
double DoubleValue
Gets the double value
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
DoubleLiteralExpression(double doubleLiteral, Location location)
Constructor of DoubleLiteralExpression
string ILValue
Gets the double value in string form
Encapsulates a string literal expression.
Location location
Location: Encapsulates in one object the line, column and filename
Definition: AstNode.cs:39