diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/astnode.cpp | 1 | ||||
-rw-r--r-- | src/astnode.h | 15 | ||||
-rw-r--r-- | src/parser.y | 1 | ||||
-rw-r--r-- | src/variable.cpp | 15 | ||||
-rw-r--r-- | src/variable.h | 37 |
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 | |||
6 | class AstNode | ||
7 | { | ||
8 | public: | ||
9 | AstNode(); | ||
10 | virtual ~AstNode(); | ||
11 | |||
12 | private: | ||
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 | ||
140 | varRef: tokIdent | 140 | varRef: 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 | |||
3 | Variable::Variable() : | ||
4 | eType( Undef ), | ||
5 | bNull( true ), | ||
6 | iValue( 0 ) | ||
7 | { | ||
8 | } | ||
9 | |||
10 | Variable::~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 | |||
8 | class Variable | ||
9 | { | ||
10 | public: | ||
11 | enum Type | ||
12 | { | ||
13 | Undef, | ||
14 | Int, | ||
15 | Float, | ||
16 | Bool, | ||
17 | String | ||
18 | }; | ||
19 | |||
20 | public: | ||
21 | Variable(); | ||
22 | virtual ~Variable(); | ||
23 | |||
24 | private: | ||
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 | ||