Commit 9c9308b9 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

QByteArray::toLong() does not auto-detect the base and also fixed a typo in

the evaluator of bit-or expressions.
parent ae3fda8b
...@@ -164,7 +164,15 @@ protected: ...@@ -164,7 +164,15 @@ protected:
bool process_primary() bool process_primary()
{ {
if ((*_lex)->is(T_INT_LITERAL)) { if ((*_lex)->is(T_INT_LITERAL)) {
_value.set_long(tokenSpell().toLong()); int base = 10;
const QByteArray spell = tokenSpell();
if (spell.at(0) == '0') {
if (spell.size() > 1 && (spell.at(1) == 'x' || spell.at(1) == 'X'))
base = 16;
else
base = 8;
}
_value.set_long(tokenSpell().toLong(0, base));
++(*_lex); ++(*_lex);
return true; return true;
} else if (isTokenDefined()) { } else if (isTokenDefined()) {
...@@ -367,7 +375,7 @@ protected: ...@@ -367,7 +375,7 @@ protected:
{ {
process_xor(); process_xor();
while ((*_lex)->is(T_CARET)) { while ((*_lex)->is(T_PIPE)) {
const Token op = *(*_lex); const Token op = *(*_lex);
++(*_lex); ++(*_lex);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment