fixed tokenization bug (treating "+.foo" as a number)

This commit is contained in:
peterl%netscape.com 1999-03-28 04:31:12 +00:00
parent 888bd39b4a
commit b7974865e3
3 changed files with 36 additions and 6 deletions

View File

@ -324,10 +324,20 @@ PRBool nsCSSScanner::Next(PRInt32& aErrorCode, nsCSSToken& aToken)
if ((ch == '.') || (ch == '+') || (ch == '-')) {
PRInt32 nextChar = Peek(aErrorCode);
if ((nextChar >= 0) && (nextChar <= 255)) {
if (((lexTable[nextChar] & IS_DIGIT) != 0) ||
(('.' == nextChar) && ('.' != ch))) {
if ((lexTable[nextChar] & IS_DIGIT) != 0) {
return ParseNumber(aErrorCode, ch, aToken);
}
else if (('.' == nextChar) && ('.' != ch)) {
PRInt32 holdNext = Read(aErrorCode);
nextChar = Peek(aErrorCode);
if ((0 <= nextChar) && (nextChar <= 255)) {
if ((lexTable[nextChar] & IS_DIGIT) != 0) {
Pushback(holdNext);
return ParseNumber(aErrorCode, ch, aToken);
}
}
Pushback(holdNext);
}
}
}
if ((lexTable[ch] & IS_DIGIT) != 0) {

View File

@ -324,10 +324,20 @@ PRBool nsCSSScanner::Next(PRInt32& aErrorCode, nsCSSToken& aToken)
if ((ch == '.') || (ch == '+') || (ch == '-')) {
PRInt32 nextChar = Peek(aErrorCode);
if ((nextChar >= 0) && (nextChar <= 255)) {
if (((lexTable[nextChar] & IS_DIGIT) != 0) ||
(('.' == nextChar) && ('.' != ch))) {
if ((lexTable[nextChar] & IS_DIGIT) != 0) {
return ParseNumber(aErrorCode, ch, aToken);
}
else if (('.' == nextChar) && ('.' != ch)) {
PRInt32 holdNext = Read(aErrorCode);
nextChar = Peek(aErrorCode);
if ((0 <= nextChar) && (nextChar <= 255)) {
if ((lexTable[nextChar] & IS_DIGIT) != 0) {
Pushback(holdNext);
return ParseNumber(aErrorCode, ch, aToken);
}
}
Pushback(holdNext);
}
}
}
if ((lexTable[ch] & IS_DIGIT) != 0) {

View File

@ -324,10 +324,20 @@ PRBool nsCSSScanner::Next(PRInt32& aErrorCode, nsCSSToken& aToken)
if ((ch == '.') || (ch == '+') || (ch == '-')) {
PRInt32 nextChar = Peek(aErrorCode);
if ((nextChar >= 0) && (nextChar <= 255)) {
if (((lexTable[nextChar] & IS_DIGIT) != 0) ||
(('.' == nextChar) && ('.' != ch))) {
if ((lexTable[nextChar] & IS_DIGIT) != 0) {
return ParseNumber(aErrorCode, ch, aToken);
}
else if (('.' == nextChar) && ('.' != ch)) {
PRInt32 holdNext = Read(aErrorCode);
nextChar = Peek(aErrorCode);
if ((0 <= nextChar) && (nextChar <= 255)) {
if ((lexTable[nextChar] & IS_DIGIT) != 0) {
Pushback(holdNext);
return ParseNumber(aErrorCode, ch, aToken);
}
}
Pushback(holdNext);
}
}
}
if ((lexTable[ch] & IS_DIGIT) != 0) {