()
| 3969 | } |
| 3970 | |
| 3971 | function advance() { |
| 3972 | var ch; |
| 3973 | |
| 3974 | if (!state.inJSXChild) { |
| 3975 | skipComment(); |
| 3976 | } |
| 3977 | |
| 3978 | if (index >= length) { |
| 3979 | return { |
| 3980 | type: Token.EOF, |
| 3981 | lineNumber: lineNumber, |
| 3982 | lineStart: lineStart, |
| 3983 | range: [index, index] |
| 3984 | }; |
| 3985 | } |
| 3986 | |
| 3987 | if (state.inJSXChild) { |
| 3988 | return advanceJSXChild(); |
| 3989 | } |
| 3990 | |
| 3991 | ch = source.charCodeAt(index); |
| 3992 | |
| 3993 | // Very common: ( and ) and ; |
| 3994 | if (ch === 40 || ch === 41 || ch === 58) { |
| 3995 | return scanPunctuator(); |
| 3996 | } |
| 3997 | |
| 3998 | // String literal starts with single quote (#39) or double quote (#34). |
| 3999 | if (ch === 39 || ch === 34) { |
| 4000 | if (state.inJSXTag) { |
| 4001 | return scanJSXStringLiteral(); |
| 4002 | } |
| 4003 | return scanStringLiteral(); |
| 4004 | } |
| 4005 | |
| 4006 | if (state.inJSXTag && isJSXIdentifierStart(ch)) { |
| 4007 | return scanJSXIdentifier(); |
| 4008 | } |
| 4009 | |
| 4010 | if (ch === 96) { |
| 4011 | return scanTemplate(); |
| 4012 | } |
| 4013 | if (isIdentifierStart(ch)) { |
| 4014 | return scanIdentifier(); |
| 4015 | } |
| 4016 | |
| 4017 | // Dot (.) char #46 can also start a floating-point number, hence the need |
| 4018 | // to check the next character. |
| 4019 | if (ch === 46) { |
| 4020 | if (isDecimalDigit(source.charCodeAt(index + 1))) { |
| 4021 | return scanNumericLiteral(); |
| 4022 | } |
| 4023 | return scanPunctuator(); |
| 4024 | } |
| 4025 | |
| 4026 | if (isDecimalDigit(ch)) { |
| 4027 | return scanNumericLiteral(); |
| 4028 | } |
no test coverage detected