()
| 1173 | } |
| 1174 | |
| 1175 | function collectRegex() { |
| 1176 | var pos, loc, regex, token; |
| 1177 | |
| 1178 | skipComment(); |
| 1179 | |
| 1180 | pos = index; |
| 1181 | loc = { |
| 1182 | start: { |
| 1183 | line: lineNumber, |
| 1184 | column: index - lineStart |
| 1185 | } |
| 1186 | }; |
| 1187 | |
| 1188 | regex = scanRegExp(); |
| 1189 | loc.end = { |
| 1190 | line: lineNumber, |
| 1191 | column: index - lineStart |
| 1192 | }; |
| 1193 | |
| 1194 | /* istanbul ignore next */ |
| 1195 | if (!extra.tokenize) { |
| 1196 | // Pop the previous token, which is likely '/' or '/=' |
| 1197 | if (extra.tokens.length > 0) { |
| 1198 | token = extra.tokens[extra.tokens.length - 1]; |
| 1199 | if (token.range[0] === pos && token.type === 'Punctuator') { |
| 1200 | if (token.value === '/' || token.value === '/=') { |
| 1201 | extra.tokens.pop(); |
| 1202 | } |
| 1203 | } |
| 1204 | } |
| 1205 | |
| 1206 | extra.tokens.push({ |
| 1207 | type: 'RegularExpression', |
| 1208 | value: regex.literal, |
| 1209 | range: [pos, index], |
| 1210 | loc: loc |
| 1211 | }); |
| 1212 | } |
| 1213 | |
| 1214 | return regex; |
| 1215 | } |
| 1216 | |
| 1217 | function isIdentifierName(token) { |
| 1218 | return token.type === Token.Identifier || |
no test coverage detected