diff --git a/src/apps/debugger/source_language/c_family/CLanguageExpressionEvaluator.cpp b/src/apps/debugger/source_language/c_family/CLanguageExpressionEvaluator.cpp index b7d40ac0e7..cc468404ec 100644 --- a/src/apps/debugger/source_language/c_family/CLanguageExpressionEvaluator.cpp +++ b/src/apps/debugger/source_language/c_family/CLanguageExpressionEvaluator.cpp @@ -72,10 +72,6 @@ static BString TokenTypeToString(int32 type) token = "%"; break; - case TOKEN_POWER: - token = "**"; - break; - case TOKEN_OPENING_PAREN: token = "("; break; @@ -1521,17 +1517,17 @@ CLanguageExpressionEvaluator::_ParseProduct() { static Operand zero(int64(0LL)); - Operand value = _ParsePower(); + Operand value = _ParseUnary(); while (true) { Token token = fTokenizer->NextToken(); switch (token.type) { case TOKEN_STAR: - value *= _ParsePower(); + value *= _ParseUnary(); break; case TOKEN_SLASH: { - Operand rhs = _ParsePower(); + Operand rhs = _ParseUnary(); if (rhs == zero) throw ParseException("division by zero", token.position); value /= rhs; @@ -1540,7 +1536,7 @@ CLanguageExpressionEvaluator::_ParseProduct() case TOKEN_MODULO: { - Operand rhs = _ParsePower(); + Operand rhs = _ParseUnary(); if (rhs == zero) throw ParseException("modulo by zero", token.position); value %= rhs; @@ -1550,7 +1546,7 @@ CLanguageExpressionEvaluator::_ParseProduct() case TOKEN_LOGICAL_AND: { value.SetTo((value != zero) - && (_ParsePower() != zero)); + && (_ParseUnary() != zero)); break; } @@ -1558,44 +1554,44 @@ CLanguageExpressionEvaluator::_ParseProduct() case TOKEN_LOGICAL_OR: { value.SetTo((value != zero) - || (_ParsePower() != zero)); + || (_ParseUnary() != zero)); break; } case TOKEN_BITWISE_AND: - value &= _ParsePower(); + value &= _ParseUnary(); break; case TOKEN_BITWISE_OR: - value |= _ParsePower(); + value |= _ParseUnary(); break; case TOKEN_BITWISE_XOR: - value ^= _ParsePower(); + value ^= _ParseUnary(); break; case TOKEN_EQ: - value.SetTo((int64)(value == _ParsePower())); + value.SetTo((int64)(value == _ParseUnary())); break; case TOKEN_NE: - value.SetTo((int64)(value != _ParsePower())); + value.SetTo((int64)(value != _ParseUnary())); break; case TOKEN_GT: - value.SetTo((int64)(value > _ParsePower())); + value.SetTo((int64)(value > _ParseUnary())); break; case TOKEN_GE: - value.SetTo((int64)(value >= _ParsePower())); + value.SetTo((int64)(value >= _ParseUnary())); break; case TOKEN_LT: - value.SetTo((int64)(value < _ParsePower())); + value.SetTo((int64)(value < _ParseUnary())); break; case TOKEN_LE: - value.SetTo((int64)(value <= _ParsePower())); + value.SetTo((int64)(value <= _ParseUnary())); break; default: @@ -1606,43 +1602,6 @@ CLanguageExpressionEvaluator::_ParseProduct() } -CLanguageExpressionEvaluator::Operand -CLanguageExpressionEvaluator::_ParsePower() -{ - Operand value = _ParseUnary(); - - while (true) { - Token token = fTokenizer->NextToken(); - if (token.type != TOKEN_POWER) { - fTokenizer->RewindToken(); - return value; - } - - Operand power = _ParseUnary(); - Operand temp = value; - int64 powerValue = power.PrimitiveValue().ToInt64(); - bool handleNegativePower = false; - if (powerValue < 0) { - powerValue = abs(powerValue); - handleNegativePower = true; - } - - if (powerValue == 0) - value.SetTo((int64)1); - else { - for (; powerValue > 1; powerValue--) - value *= temp; - } - - if (handleNegativePower) { - temp.SetTo((int64)1); - temp /= value; - value = temp; - } - } -} - - CLanguageExpressionEvaluator::Operand CLanguageExpressionEvaluator::_ParseUnary() { diff --git a/src/apps/debugger/source_language/c_family/CLanguageExpressionEvaluator.h b/src/apps/debugger/source_language/c_family/CLanguageExpressionEvaluator.h index e6f07d41a6..d75a2a3203 100644 --- a/src/apps/debugger/source_language/c_family/CLanguageExpressionEvaluator.h +++ b/src/apps/debugger/source_language/c_family/CLanguageExpressionEvaluator.h @@ -62,7 +62,6 @@ private: private: Operand _ParseSum(); Operand _ParseProduct(); - Operand _ParsePower(); Operand _ParseUnary(); Operand _ParseIdentifier(ValueNode* parentNode = NULL); Operand _ParseAtom(); diff --git a/src/apps/debugger/source_language/c_family/CLanguageFamilySyntaxHighlightInfo.cpp b/src/apps/debugger/source_language/c_family/CLanguageFamilySyntaxHighlightInfo.cpp index 40a36fb9be..b1b1454c7d 100644 --- a/src/apps/debugger/source_language/c_family/CLanguageFamilySyntaxHighlightInfo.cpp +++ b/src/apps/debugger/source_language/c_family/CLanguageFamilySyntaxHighlightInfo.cpp @@ -326,7 +326,6 @@ CLanguageFamilySyntaxHighlightInfo::_MapTokenToSyntaxType(const Token& token) case TOKEN_STAR: case TOKEN_SLASH: case TOKEN_MODULO: - case TOKEN_POWER: case TOKEN_OPENING_PAREN: case TOKEN_CLOSING_PAREN: case TOKEN_OPENING_SQUARE_BRACKET: diff --git a/src/apps/debugger/source_language/c_family/CLanguageTokenizer.cpp b/src/apps/debugger/source_language/c_family/CLanguageTokenizer.cpp index d5e15ef2ec..8d5e02a769 100644 --- a/src/apps/debugger/source_language/c_family/CLanguageTokenizer.cpp +++ b/src/apps/debugger/source_language/c_family/CLanguageTokenizer.cpp @@ -273,10 +273,6 @@ Tokenizer::_ParseOperator() case '*': switch (_Peek()) { - case '*': - type = TOKEN_POWER; - length = 2; - break; case '/': type = TOKEN_END_COMMENT_BLOCK; length = 2; diff --git a/src/apps/debugger/source_language/c_family/CLanguageTokenizer.h b/src/apps/debugger/source_language/c_family/CLanguageTokenizer.h index 65fedecb6e..a7194ac17a 100644 --- a/src/apps/debugger/source_language/c_family/CLanguageTokenizer.h +++ b/src/apps/debugger/source_language/c_family/CLanguageTokenizer.h @@ -33,8 +33,6 @@ enum { TOKEN_SLASH, TOKEN_MODULO, - TOKEN_POWER, - TOKEN_OPENING_PAREN, TOKEN_CLOSING_PAREN,