Skip to content

Commit

Permalink
MOHAWK: Handle ++/-- operators in LBCode.
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzie committed Jun 24, 2011
1 parent 685934e commit 2b03a3a
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions engines/mohawk/livingbooks_code.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,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:
Expand Down

0 comments on commit 2b03a3a

Please sign in to comment.