Deal with hex values in numerical values

This commit is contained in:
vidur 1998-06-30 02:18:05 +00:00
Родитель add97af1d2
Коммит d84249ba53
2 изменённых файлов: 17 добавлений и 2 удалений

Просмотреть файл

@ -502,7 +502,7 @@ IdlVariable* IdlParser::ParseConst(IdlSpecification &aSpecification)
// position INTEGER_CONSTANT
if (token->id < INTEGER_CONSTANT) {
delete constObj;
throw ConstParsingException("Missing identifire. Const name undefined.");
throw ConstParsingException("Missing identifier. Const name undefined.");
}
else if (INTEGER_CONSTANT == token->id) {
constObj->SetValue(token->value.vLong);

Просмотреть файл

@ -1111,8 +1111,23 @@ void IdlScanner::Number(int aStartChar, Token *aToken)
}
if (isdigit(aStartChar)) {
long base = 10;
if ('0' == aStartChar) {
aStartChar = mInputFile->get();
if (('x' == aStartChar) || ('X' == aStartChar)) {
base = 16;
aStartChar = mInputFile->get();
}
else if (isdigit(aStartChar)) {
base = 8;
}
else {
mInputFile->putback(aStartChar);
}
}
do {
value = value * 10 + (aStartChar - '0');
value = value * base + (aStartChar - '0');
aStartChar = mInputFile->get();
} while (isdigit(aStartChar));