diff options
Diffstat (limited to 'engines/parallaction/parser.cpp')
-rw-r--r-- | engines/parallaction/parser.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/engines/parallaction/parser.cpp b/engines/parallaction/parser.cpp index cc0a772b45..665da16636 100644 --- a/engines/parallaction/parser.cpp +++ b/engines/parallaction/parser.cpp @@ -209,4 +209,47 @@ uint16 Script::readLineToken(bool errorOnEOF) { return fillTokens(line); } + +void Parser::reset() { + _currentOpcodes = 0; + _currentStatements = 0; + _script = 0; +} + +void Parser::pushTables(OpcodeSet *opcodes, Table *statements) { + _opcodes.push(_currentOpcodes); + _statements.push(_currentStatements); + + _currentOpcodes = opcodes; + _currentStatements = statements; +} + +void Parser::popTables() { + assert(_opcodes.size() > 0); + + _currentOpcodes = _opcodes.pop(); + _currentStatements = _statements.pop(); +} + +void Parser::parseStatement() { + assert(_currentOpcodes != 0); + + _script->readLineToken(true); + _lookup = _currentStatements->lookup(_tokens[0]); + + debugC(9, kDebugParser, "parseStatement: %s (lookup = %i)", _tokens[0], _lookup); + + (*(*_currentOpcodes)[_lookup])(); +} + +void Parser::bind(Script *script) { + reset(); + _script = script; +} + +void Parser::unbind() { + reset(); +} + + } // namespace Parallaction |