diff options
author | Strangerke | 2011-06-29 16:15:41 +0200 |
---|---|---|
committer | Strangerke | 2011-06-29 16:15:41 +0200 |
commit | b0c9c9122fc678074aba30068e5b36d347208e65 (patch) | |
tree | 79a99db08ec985f2e5f1e216823b1104d5b753fb /engines/mohawk/livingbooks_code.cpp | |
parent | f2f3124246a77036f843dee2d83ad28084234ebc (diff) | |
parent | c32a3ea0d30336771bab460ecccb58c4614e6294 (diff) | |
download | scummvm-rg350-b0c9c9122fc678074aba30068e5b36d347208e65.tar.gz scummvm-rg350-b0c9c9122fc678074aba30068e5b36d347208e65.tar.bz2 scummvm-rg350-b0c9c9122fc678074aba30068e5b36d347208e65.zip |
Merge branch 'master' of github.com:scummvm/scummvm into soltys_wip2
Diffstat (limited to 'engines/mohawk/livingbooks_code.cpp')
-rw-r--r-- | engines/mohawk/livingbooks_code.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp index 165ca4a328..e72318d86a 100644 --- a/engines/mohawk/livingbooks_code.cpp +++ b/engines/mohawk/livingbooks_code.cpp @@ -32,6 +32,10 @@ bool LBValue::operator==(const LBValue &x) const { if (type != x.type) { if (isNumeric() && x.isNumeric()) return toDouble() == x.toDouble(); + else if (type == kLBValueString && x.type == kLBValueItemPtr) + return string == x.item->getName(); + else if (type == kLBValueItemPtr && x.type == kLBValueString) + return item->getName() == x.string; else return false; } @@ -246,8 +250,10 @@ LBValue LBCode::runCode(byte terminator) { parseStatement(); if (_stack.size()) result = _stack.pop(); - if (_currToken == terminator || _currToken == kTokenEndOfFile) + if (_currToken == terminator || _currToken == kTokenEndOfFile) { + debugN("\n"); break; + } if (_currToken != kTokenEndOfStatement && _currToken != kTokenEndOfFile) error("missing EOS (got %02x)", _currToken); debugN("\n"); @@ -437,6 +443,33 @@ void LBCode::parseMain() { } break; + case kTokenPlusPlus: + case kTokenMinusMinus: + { + byte token = _currToken; + if (token == kTokenPlusPlus) + debugN("++"); + else + debugN("--"); + nextToken(); + + if (_currToken != kTokenIdentifier) + error("expected identifier"); + assert(_currValue.type == kLBValueString); + Common::String varname = _currValue.string; + debugN("%s", varname.c_str()); + LBValue &val = _vm->_variables[varname]; + + // FIXME: pre/postincrement for non-integers + if (token == kTokenPlusPlus) + val.integer++; + else + val.integer--; + _stack.push(val); + nextToken(); + } + break; + case kTokenLiteral: case kTokenConstMode: case kTokenConstEventId: |