bool Runtime::parseConditional( KILLENUM &kill ) { switch ( tokenizer.token() ) { case Token::ALIGNED: accept( Token::ALIGNED ); return thing->alignedPlayer(); case Token::ANY: return parseConditionalAny(kill); case Token::BLOCKED: return parseConditionalBlocked(kill); case Token::CONTACT: accept( Token::CONTACT ); return thing->contactPlayer(); case Token::ENERGIZED: accept( Token::ENERGIZED ); return false; case Token::NOT: accept( Token::NOT ); return !parseConditional(kill); default: // check flag break; } return false; }
StringMath::Token StringMath::parseExpression() { // Expression ::= Assignment | Conditional Token value = parseAssignment(); if(value.isEmpty()) value = parseConditional(); return value; }
KILLENUM Runtime::execIf() { accept( Token::IF ); KILLENUM kill = PROCEED; const bool results = parseConditional( kill ); if ( kill == COMMANDERROR ) return COMMANDERROR; if ( results ) { switch ( tokenizer.token() ) { case Token::SLASH: case Token::QUESTION: return sugarMove(); case Token::CRUNCH: return executeCrunch(); default: return throwError("CONDITIONAL ERROR"); } } return PROCEED; }