void PostfixExprEvaluator::processToken(Token &token,
	                                    std::stack<Token> &operands,
	                                    Variables &vars)
{
	switch (token.type)
	{
		case TokenType::TOK_VARIABLE:
			token = vars.at(token.value.valueString);
			processToken(token, operands, vars);
			break;
		case TokenType::TOK_LPAREN:
		case TokenType::TOK_RPAREN:
			break;
		case TokenType::TOK_FLOAT:
		case TokenType::TOK_INT:
			operands.push(token);
			break;
		case TokenType::TOK_UNARYOP:
			processUnaryOp(token, operands);
			break;
		case TokenType::TOK_BINARYOP:
			processBinaryOp(token, operands);
			break;
	}  
}
Exemplo n.º 2
0
static void filterFields (const StringSet &avoid, Variables &fields) {
	for (int i = 0; i < fields.length (); i++) {
		const VariableDef &cur = fields.at (i);
		
		if (avoid.contains (cur.type)) {
			fields.remove (i);
			i--;
		}
		
	}
	
}