mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 639420 - Speed up the scanner ten ways, part 4. r=brendan.
This commit is contained in:
parent
dac6a13a66
commit
e5921d70f1
@ -296,7 +296,10 @@ TokenStream::getChar()
|
||||
|
||||
/*
|
||||
* This gets the next char. It does nothing special with EOL sequences, not
|
||||
* even updating the line counters.
|
||||
* even updating the line counters. It can be used safely if (a) the
|
||||
* resulting char is guaranteed to be ungotten (by ungetCharIgnoreEOL()) if
|
||||
* it's an EOL, and (b) the line-related state (lineno, linebase) is not used
|
||||
* before it's ungotten.
|
||||
*/
|
||||
int32
|
||||
TokenStream::getCharIgnoreEOL()
|
||||
@ -339,7 +342,6 @@ TokenStream::ungetCharIgnoreEOL(int32 c)
|
||||
{
|
||||
if (c == EOF)
|
||||
return;
|
||||
JS_ASSERT(TokenBuf::isRawEOLChar(c));
|
||||
JS_ASSERT(!userbuf.atStart());
|
||||
userbuf.ungetRawChar();
|
||||
}
|
||||
@ -1111,30 +1113,30 @@ TokenStream::getTokenInternal()
|
||||
decimal:
|
||||
bool hasFracOrExp = false;
|
||||
while (JS7_ISDEC(c))
|
||||
c = getChar();
|
||||
c = getCharIgnoreEOL();
|
||||
|
||||
if (c == '.') {
|
||||
hasFracOrExp = true;
|
||||
do {
|
||||
c = getChar();
|
||||
c = getCharIgnoreEOL();
|
||||
} while (JS7_ISDEC(c));
|
||||
}
|
||||
if (JS_TOLOWER(c) == 'e') {
|
||||
hasFracOrExp = true;
|
||||
c = getChar();
|
||||
c = getCharIgnoreEOL();
|
||||
if (c == '+' || c == '-')
|
||||
c = getChar();
|
||||
c = getCharIgnoreEOL();
|
||||
if (!JS7_ISDEC(c)) {
|
||||
ungetChar(c);
|
||||
ungetCharIgnoreEOL(c);
|
||||
ReportCompileErrorNumber(cx, this, NULL, JSREPORT_ERROR,
|
||||
JSMSG_MISSING_EXPONENT);
|
||||
goto error;
|
||||
}
|
||||
do {
|
||||
c = getChar();
|
||||
c = getCharIgnoreEOL();
|
||||
} while (JS7_ISDEC(c));
|
||||
}
|
||||
ungetChar(c);
|
||||
ungetCharIgnoreEOL(c);
|
||||
|
||||
if (JS_ISIDSTART(c)) {
|
||||
ReportCompileErrorNumber(cx, this, NULL, JSREPORT_ERROR, JSMSG_IDSTART_AFTER_NUMBER);
|
||||
@ -1166,18 +1168,18 @@ TokenStream::getTokenInternal()
|
||||
|
||||
if (c == '0') {
|
||||
int radix;
|
||||
c = getChar();
|
||||
c = getCharIgnoreEOL();
|
||||
if (JS_TOLOWER(c) == 'x') {
|
||||
radix = 16;
|
||||
c = getChar();
|
||||
c = getCharIgnoreEOL();
|
||||
if (!JS7_ISHEX(c)) {
|
||||
ungetChar(c);
|
||||
ungetCharIgnoreEOL(c);
|
||||
ReportCompileErrorNumber(cx, this, NULL, JSREPORT_ERROR, JSMSG_MISSING_HEXDIGITS);
|
||||
goto error;
|
||||
}
|
||||
numStart = userbuf.addressOfNextRawChar() - 1;
|
||||
while (JS7_ISHEX(c))
|
||||
c = getChar();
|
||||
c = getCharIgnoreEOL();
|
||||
} else if (JS7_ISDEC(c)) {
|
||||
radix = 8;
|
||||
numStart = userbuf.addressOfNextRawChar() - 1;
|
||||
@ -1199,7 +1201,7 @@ TokenStream::getTokenInternal()
|
||||
}
|
||||
goto decimal; /* use the decimal scanner for the rest of the number */
|
||||
}
|
||||
c = getChar();
|
||||
c = getCharIgnoreEOL();
|
||||
}
|
||||
} else {
|
||||
/* '0' not followed by 'x', 'X' or a digit; scan as a decimal number. */
|
||||
@ -1207,7 +1209,7 @@ TokenStream::getTokenInternal()
|
||||
numStart = userbuf.addressOfNextRawChar() - 1;
|
||||
goto decimal;
|
||||
}
|
||||
ungetChar(c);
|
||||
ungetCharIgnoreEOL(c);
|
||||
|
||||
if (JS_ISIDSTART(c)) {
|
||||
ReportCompileErrorNumber(cx, this, NULL, JSREPORT_ERROR, JSMSG_IDSTART_AFTER_NUMBER);
|
||||
|
Loading…
Reference in New Issue
Block a user