зеркало из https://github.com/mozilla/gecko-dev.git
Deal with hex values in numerical values
This commit is contained in:
Родитель
add97af1d2
Коммит
d84249ba53
|
@ -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));
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче