aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction/parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'engines/parallaction/parser.h')
-rw-r--r--engines/parallaction/parser.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/engines/parallaction/parser.h b/engines/parallaction/parser.h
index f2a2a0c4b6..d29a6c7e73 100644
--- a/engines/parallaction/parser.h
+++ b/engines/parallaction/parser.h
@@ -27,6 +27,7 @@
#define PARALLACTION_PARSER_H
#include "common/stream.h"
+#include "parallaction/objects.h"
namespace Parallaction {
@@ -58,6 +59,63 @@ public:
+class Opcode {
+
+public:
+ virtual void operator()() const = 0;
+ virtual ~Opcode() { }
+};
+
+template <class T>
+class OpcodeImpl : public Opcode {
+
+ typedef void (T::*Fn)();
+
+ T* _instance;
+ Fn _fn;
+
+public:
+ OpcodeImpl(T* instance, const Fn &fn) : _instance(instance), _fn(fn) { }
+
+ void operator()() const {
+ (_instance->*_fn)();
+ }
+
+};
+
+typedef Common::Array<const Opcode*> OpcodeSet;
+
+
+class Parser {
+
+public:
+ Parser() { reset(); }
+ ~Parser() {}
+
+ uint _lookup;
+
+ Common::Stack<OpcodeSet*> _opcodes;
+ Common::Stack<Table*> _statements;
+
+ OpcodeSet *_currentOpcodes;
+ Table *_currentStatements;
+
+ void bind(Script *script);
+ void unbind();
+ void pushTables(OpcodeSet *opcodes, Table* statements);
+ void popTables();
+ void parseStatement();
+
+protected:
+ void reset();
+
+ Script *_script;
+};
+
+
+
+
+
} // namespace Parallaction
#endif