summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-12-18 01:07:03 -0700
committerMike Buland <eichlan@xagasoft.com>2011-12-18 01:07:03 -0700
commiteb053bb851d729fbe4db7959143df5cfb2063793 (patch)
tree0c49ad61b11611c5cdf17e8bedf13bbdb9a3d210
parent1368849e36e1b5ecd0d595b713ca73f9d88da38b (diff)
downloadstage-eb053bb851d729fbe4db7959143df5cfb2063793.tar.gz
stage-eb053bb851d729fbe4db7959143df5cfb2063793.tar.bz2
stage-eb053bb851d729fbe4db7959143df5cfb2063793.tar.xz
stage-eb053bb851d729fbe4db7959143df5cfb2063793.zip
Setting up AstNode & Variable classes.
-rw-r--r--src/astnode.cpp1
-rw-r--r--src/astnode.h15
-rw-r--r--src/parser.y1
-rw-r--r--src/variable.cpp15
-rw-r--r--src/variable.h37
5 files changed, 69 insertions, 0 deletions
diff --git a/src/astnode.cpp b/src/astnode.cpp
new file mode 100644
index 0000000..ff73346
--- /dev/null
+++ b/src/astnode.cpp
@@ -0,0 +1 @@
#include "astnode.h"
diff --git a/src/astnode.h b/src/astnode.h
new file mode 100644
index 0000000..3344ca2
--- /dev/null
+++ b/src/astnode.h
@@ -0,0 +1,15 @@
1#ifndef AST_NODE_H
2#define AST_NODE_H
3
4#include <bu/list.h>
5
6class AstNode
7{
8public:
9 AstNode();
10 virtual ~AstNode();
11
12private:
13};
14
15#endif
diff --git a/src/parser.y b/src/parser.y
index ef9d10b..b1c8ec9 100644
--- a/src/parser.y
+++ b/src/parser.y
@@ -139,6 +139,7 @@ ifnext:
139 139
140varRef: tokIdent 140varRef: tokIdent
141 | tokPlayer '.' tokIdent 141 | tokPlayer '.' tokIdent
142 | tokGlobal '.' tokIdent
142 | tokSituation '.' tokIdent 143 | tokSituation '.' tokIdent
143 ; 144 ;
144 145
diff --git a/src/variable.cpp b/src/variable.cpp
new file mode 100644
index 0000000..3954ccd
--- /dev/null
+++ b/src/variable.cpp
@@ -0,0 +1,15 @@
1#include "variable.h"
2
3Variable::Variable() :
4 eType( Undef ),
5 bNull( true ),
6 iValue( 0 )
7{
8}
9
10Variable::~Variable()
11{
12 if( eType == String )
13 delete sValue;
14}
15
diff --git a/src/variable.h b/src/variable.h
new file mode 100644
index 0000000..3df9255
--- /dev/null
+++ b/src/variable.h
@@ -0,0 +1,37 @@
1#ifndef VARIABLE_H
2#define VARIABLE_H
3
4#include <stdint.h>
5
6#include <bu/string.h>
7
8class Variable
9{
10public:
11 enum Type
12 {
13 Undef,
14 Int,
15 Float,
16 Bool,
17 String
18 };
19
20public:
21 Variable();
22 virtual ~Variable();
23
24private:
25 Type eType;
26 bool bNull;
27
28 union
29 {
30 int64_t iValue;
31 double fValue;
32 bool bValue;
33 Bu::String *sValue;
34 };
35};
36
37#endif