()
| 1370 | } |
| 1371 | |
| 1372 | function advance() { |
| 1373 | var ch, token; |
| 1374 | |
| 1375 | if (index >= length) { |
| 1376 | return { |
| 1377 | type: Token.EOF, |
| 1378 | lineNumber: lineNumber, |
| 1379 | lineStart: lineStart, |
| 1380 | start: index, |
| 1381 | end: index |
| 1382 | }; |
| 1383 | } |
| 1384 | |
| 1385 | ch = source.charCodeAt(index); |
| 1386 | |
| 1387 | if (isIdentifierStart(ch)) { |
| 1388 | token = scanIdentifier(); |
| 1389 | if (strict && isStrictModeReservedWord(token.value)) { |
| 1390 | token.type = Token.Keyword; |
| 1391 | } |
| 1392 | return token; |
| 1393 | } |
| 1394 | |
| 1395 | // Very common: ( and ) and ; |
| 1396 | if (ch === 0x28 || ch === 0x29 || ch === 0x3B) { |
| 1397 | return scanPunctuator(); |
| 1398 | } |
| 1399 | |
| 1400 | // String literal starts with single quote (U+0027) or double quote (U+0022). |
| 1401 | if (ch === 0x27 || ch === 0x22) { |
| 1402 | return scanStringLiteral(); |
| 1403 | } |
| 1404 | |
| 1405 | |
| 1406 | // Dot (.) U+002E can also start a floating-point number, hence the need |
| 1407 | // to check the next character. |
| 1408 | if (ch === 0x2E) { |
| 1409 | if (isDecimalDigit(source.charCodeAt(index + 1))) { |
| 1410 | return scanNumericLiteral(); |
| 1411 | } |
| 1412 | return scanPunctuator(); |
| 1413 | } |
| 1414 | |
| 1415 | if (isDecimalDigit(ch)) { |
| 1416 | return scanNumericLiteral(); |
| 1417 | } |
| 1418 | |
| 1419 | // Slash (/) U+002F can also start a regex. |
| 1420 | if (extra.tokenize && ch === 0x2F) { |
| 1421 | return advanceSlash(); |
| 1422 | } |
| 1423 | |
| 1424 | return scanPunctuator(); |
| 1425 | } |
| 1426 | |
| 1427 | function collectToken() { |
| 1428 | var loc, token, value, entry; |
no test coverage detected