summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/astnode.h18
-rw-r--r--src/environment.cpp0
-rw-r--r--src/environment.h0
-rw-r--r--src/function.cpp10
-rw-r--r--src/function.h17
-rw-r--r--src/scope.cpp10
-rw-r--r--src/scope.h16
-rw-r--r--src/situation.cpp0
-rw-r--r--src/situation.h0
-rw-r--r--src/userfunction.cpp21
-rw-r--r--src/userfunction.h21
-rw-r--r--src/variable.h4
12 files changed, 116 insertions, 1 deletions
diff --git a/src/astnode.h b/src/astnode.h
index 3344ca2..a345a56 100644
--- a/src/astnode.h
+++ b/src/astnode.h
@@ -9,6 +9,24 @@ public:
9 AstNode(); 9 AstNode();
10 virtual ~AstNode(); 10 virtual ~AstNode();
11 11
12 enum Type
13 {
14 tValue = 0x01000000,
15 tBranch = 0x02000000,
16 tScope = 0x02000001,
17 tIf = 0x02000002,
18 tElse = 0x02000003,
19 tNot = 0x00000004,
20 tComp = 0x02000005,
21 tCompGt = 0x02000006,
22 tCompLt = 0x02000007,
23 tCompGtEq = 0x02000008,
24 tCompLtEq = 0x02000009,
25 tStore = 0x0200000A,
26 tAnd = 0x0200000B,
27 tOr = 0x0200000C,
28 };
29
12private: 30private:
13}; 31};
14 32
diff --git a/src/environment.cpp b/src/environment.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/environment.cpp
diff --git a/src/environment.h b/src/environment.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/environment.h
diff --git a/src/function.cpp b/src/function.cpp
new file mode 100644
index 0000000..e89a06f
--- /dev/null
+++ b/src/function.cpp
@@ -0,0 +1,10 @@
1#include "function.h"
2
3Function::Function()
4{
5}
6
7Function::~Function()
8{
9}
10
diff --git a/src/function.h b/src/function.h
new file mode 100644
index 0000000..1191129
--- /dev/null
+++ b/src/function.h
@@ -0,0 +1,17 @@
1#ifndef FUNCTION_H
2#define FUNCTION_H
3
4#include <bu/string.h>
5#include "variable.h"
6
7class Function
8{
9public:
10 Function();
11 virtual ~Function();
12
13 virtual Bu::String getName() const=0;
14 virtual Variable call( const VariableList &lParams )=0;
15};
16
17#endif
diff --git a/src/scope.cpp b/src/scope.cpp
new file mode 100644
index 0000000..45d4484
--- /dev/null
+++ b/src/scope.cpp
@@ -0,0 +1,10 @@
1#include "scope.h"
2
3Scope::Scope()
4{
5}
6
7Scope::~Scope()
8{
9}
10
diff --git a/src/scope.h b/src/scope.h
new file mode 100644
index 0000000..84797f0
--- /dev/null
+++ b/src/scope.h
@@ -0,0 +1,16 @@
1#ifndef SCOPE_H
2#define SCOPE_H
3
4#include "variable.h"
5
6class Scope
7{
8public:
9 Scope();
10 virtual ~Scope();
11
12private:
13 VariableHash hVars;
14};
15
16#endif
diff --git a/src/situation.cpp b/src/situation.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/situation.cpp
diff --git a/src/situation.h b/src/situation.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/situation.h
diff --git a/src/userfunction.cpp b/src/userfunction.cpp
new file mode 100644
index 0000000..3bdd973
--- /dev/null
+++ b/src/userfunction.cpp
@@ -0,0 +1,21 @@
1#include "userfunction.h"
2
3UserFunction::UserFunction( const Bu::String &sName, const AstNode &anRoot ) :
4 sName( sName )
5{
6}
7
8UserFunction::~UserFunction()
9{
10}
11
12Bu::String UserFunction::getName() const
13{
14 return sName;
15}
16
17Variable UserFunction::call( const VariableList &lParams )
18{
19 return Variable( Variable::tNull );
20}
21
diff --git a/src/userfunction.h b/src/userfunction.h
new file mode 100644
index 0000000..67b96cc
--- /dev/null
+++ b/src/userfunction.h
@@ -0,0 +1,21 @@
1#ifndef USER_FUNCTION_H
2#define USER_FUNCTION_H
3
4#include "function.h"
5
6class AstNode;
7
8class UserFunction : public Function
9{
10public:
11 UserFunction( const Bu::String &sName, const AstNode &anRoot );
12 virtual ~UserFunction();
13
14 virtual Bu::String getName() const;
15 virtual Variable call( const VariableList &lParams );
16
17private:
18 Bu::String sName;
19};
20
21#endif
diff --git a/src/variable.h b/src/variable.h
index 67f35c8..c728718 100644
--- a/src/variable.h
+++ b/src/variable.h
@@ -76,7 +76,9 @@ namespace Bu
76{ 76{
77 template<> uint32_t __calcHashCode<Variable>( const Variable &k ); 77 template<> uint32_t __calcHashCode<Variable>( const Variable &k );
78 template<> bool __cmpHashKeys<Variable>( const Variable &a, const Variable &b ); 78 template<> bool __cmpHashKeys<Variable>( const Variable &a, const Variable &b );
79} 79};
80 80
81typedef Bu::List<Variable> VariableList;
82typedef Bu::Hash<Bu::String, Variable> VariableHash;
81 83
82#endif 84#endif